Community
Arnold General Rendering Forum
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

incident ray in shader_evaluate() in C++ API

1 ANTWORT 1
Antworten
Nachricht 1 von 2
tony.fanQDZT4
262 Aufrufe, 1 Antwort

incident ray in shader_evaluate() in C++ API

Hello,

 

I am writing a custom ray switch shader. I need to access the incident ray so that I can retrieve the traceset of the incident ray. But I do not know how to retrieve the incident ray in shader_evaluate(). Can you please help?

 

 

Thanks,

Tony Fan

1 ANTWORT 1
Nachricht 2 von 2
maxtarpini
als Antwort auf: tony.fanQDZT4

When your shader is called (evaluated) .. meaning a (incident) ray intersected a geometry where your shader is attached to .. Arnold fills a global structure with data where you can check what kind of ray did hit your shader and many other things. 'shader_evaluate' is a macro defined for 'static void Evaluate(AtNode* node, AtShaderGlobals* sg)'.

 

That 'AtShaderGlobals' is what you need to check to retrieve any info available at the intersection point. So for example in your 'shader_evaluate' simply start with 'sg->' and your intellisense should give you a rollout with all the member available from AtShaderGlobals (or check ai_shaderglobals.h). For the purpose of a 'ray switch' shader you may want to check for example sg->Rt .. that is the ray type .. AI_RAY_CAMERA AI_RAY_DIFFUSE_REFLECT etc. (see ai_ray.h) of the incident ray that called your shader.

 

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report