Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
maxtarpini
636 Views, 6 Replies

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

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

Labels (2)
6 REPLIES 6
Message 2 of 7
maxtarpini
in reply to: maxtarpini

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 !

Message 3 of 7
maxtarpini
in reply to: maxtarpini

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.

Message 4 of 7

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 ?

Message 5 of 7
maxtarpini
in reply to: maxtarpini

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

Message 6 of 7

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....

Message 7 of 7
maxtarpini
in reply to: maxtarpini

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report