PDA

View Full Version : Knowing which lights are Excluded in a custom shader ?



dlanier
November 7th, 2005, 21:22
Hi,

In a custom Mental Ray shader, I'd like to know if someone has succeeded in knowing which lights are excluded when we sample the lights for a given object ?

There seems to have a specific custom data (seen when exporting the scene in .mi format)



declare data
"max_NodeData" (
color "WireColor",
integer "NodeID",
integer "NodeRenderID",
array light "illuminators",
array light "shadowmakers",
boolean "useGlobalLights",
array integer "materialRequirements"
)
version 2
end declare


So I have parsed the string found in the user data usin g:


miQuery(miQ_DATA_DECL,...
miQuery(miQ_DECL_PARAM,...


Then I am able to retrieve the values but how can I get the content of the Array as the interesting parameter is a Light Array. How is it coded inits binary format ? A length followed by the miTags of the lights ?
Well, any hint on this would be welcome :)
Thank you.

Regards,

bart
November 8th, 2005, 03:54
Do you have the mental ray on-line manual distribution?
Autodesk should be able to point you to one.
Check out the section Using and Writing Shaders -> Shader Parameter Declarations.

I can't do it justice with a quick reply.
On the C side, inside a shader, declared arrays end up as three things.
For example, for a parameter named 'list':


int i_list;
int n_list;
miInteger list[1];

n is the number of elements and i gives the offset to the list.
Access by list[i_list+index];
where index is < n.
It may end up in a user data block the same way as it does inside a shader.

dlanier
November 8th, 2005, 07:11
Hi Bart,

Thanks for your answer !
It is probably what I get as the first integer is 8... I am going to dig this way :-)
Regards,