AiTrace doesn't trace AiStandardSurface reflections (without caustics enabled)

AiTrace doesn't trace AiStandardSurface reflections (without caustics enabled)

maxtarpini
Collaborator Collaborator
1,748 Views
6 Replies
Message 1 of 7

AiTrace doesn't trace AiStandardSurface reflections (without caustics enabled)

maxtarpini
Collaborator
Collaborator

This dummy code doesn't trace back reflections from an AiStandardSurface shader (on the right) if caustics are not enabled in the material. The problem is of course that as soon as caustics are enabled a lot of fireflies just start appearing.

However an AiStandardSurface traces back reflections from another AiStandardSurface even without caustics enabled. So, - how can we get reflections while tracing an AiStandardSurface without caustics enabled ? Thanks !

AtScrSample scrs; scrs.color = 0.f;
if(sg->Rt != AI_RAY_DIFFUSE_REFLECT) 
{
AtVector rdir= AiReflect(sg->Rd, sg->Nf);
AtRay wi_ray= AiMakeRay(AI_RAY_ALL_REFLECT, sg->P, &rdir, AI_BIG, sg);
if( !AiTrace(wi_ray, AI_RGB_WHITE, scrs))
AiTraceBackground(wi_ray, scrs);
}
sg->out.RGB() = scrs.color;

233-noreflections.png

0 Likes
Accepted solutions (1)
1,749 Views
6 Replies
Replies (6)
Message 2 of 7

maxtarpini
Collaborator
Collaborator

Ehy there, no one on this ..

doesn't look weird to you that your own materials cannot be fully traced ? Yes it works with AiBSDFIntegrate but I still need AiTrace alone to be able to trace reflections of an AiStandardSurface. Can someone chime in .. thanks in advance !

0 Likes
Message 3 of 7

maxtarpini
Collaborator
Collaborator

Ehy guys c'mon, I need an answer here. Can't you just take a look at the base code and see what's preventing your own SDK trace function to fully trace AiStandardSurface ? Thanks. Appreciated.

0 Likes
Message 4 of 7

sebastien.blaineau.ortegaHRM3U
Autodesk
Autodesk
Accepted solution

Hi,

speculars are only evaluated after a diffuse bounce if caustics are on.

Here your ray type is AI_RAY_ALL_REFLECT, which is a combination of diffuse and specular, so this might be the problem. Could you try replacing it with AI_RAY_SPECULAR_REFLECT ?

0 Likes
Message 5 of 7

maxtarpini
Collaborator
Collaborator

Hi Sebastien,

thanks it works with AI_RAY_ALL_SPECULAR (AI_RAY_SPECULAR_REFLECT). I'm still not sure however why it isn't also working with AI_RAY_ALL_REFLECT but if you say you have some kind of heuristics in place to deal with caustics I just take that as a fact. So it's all cool at the moment 🙂

Thanks ! Max

0 Likes
Message 6 of 7

sebastien.blaineau.ortegaHRM3U
Autodesk
Autodesk

Maybe the ray types and terminology changes in Arnold 5 are making it confusing :

-AI_RAY_DIFFUSE_REFLECT (diffuse reflections, some would simply say "global illumination")

-AI_RAY_SPECULAR_REFLECT (previous "glossy" rays in Arnold 4, for blurry or sharp reflections )

-AI_RAY_SPECULAR_TRANSMIT (sharp or blurry refractions)

-AI_RAY_ALL_REFLECT (mixture of diffuse and "glossy")

-AI_RAY_ALL_SPECULAR (mixture of "glossy" and refractions)

In your case, I think it makes more sense to use AI_RAY_SPECULAR_REFLECT since that's what your ray is doing. AI_RAY_ALL_SPECULAR would also consider this ray as a refraction, which could affect the ray depth, etc....

0 Likes
Message 7 of 7

maxtarpini
Collaborator
Collaborator

Yep as noted above I'm using AI_RAY_SPECULAR_REFLECT. And thanks for the clarification about ray types.

0 Likes