hello:thumbsup:
Iāve received some info through a mental ray shader, mailling group on mental ray tag feature. Iām not too sure i understand any of it, but hereās what was asked and a professionals reply
Question
Iām new in MR shader developement. I work on Maya 5.01 using MR 3.2 How can I get the shader associate with a parameters in a shader ?
Answer
Short answer is that you canāt. mi_eval_* evaluates the connection for you automatically. It was a design decision of mental images not to expose how this works internally nor let you travel around the shading network tree as you are bound to be wanting to do very bad things, most likely.
Yet⦠if you want to live very dangerouslyā¦Iāll tell you how :
You can find out if a shader is connected at all with something like:
template< typename T >
inline bool connected( const miState* const s, const T& p )
{
return (!(s)->shader->ghost_offs ? false :
(!((miTag)((char*)(&p)+(s)->shader->ghost_offs)) ? false :
true));
}
you use the function like ( I hate c pointers, thatās why I tend to code in c++ whenever possible ā use a macro if you hate c++):
if ( connected( state, params->color )
{
{
If you also see mi_eval() in shader.h and you will kind of understand how you could perhaps get the tag you want.
Potentially, my guess is that the expression: ((miTag*)((char*)(&p)+(s)->shader->ghost_offs) is returning a pointer to the miTag of the shader you need.
But I would not trust it to keep working in future versions as it is undocumented.
Perhaps the question is why do you need to do that (ie. what are you trying to achieve in the end)?
And if you really, really have to, why not pass the shader name from maya directly as a shader parameter and then you can do a simple mi_api_name_lookup, perhaps, as that is indeed documented.
- I know this appears to be maya related, but iām sure the same basic code applies to max aswell.
I hope this helps ! :applause:
Philip Bruton
I did some tests before applying it to my car, I found that with the IOR of 2.5(what it was set at when Dlād) it wasnāt giving me much reflection at all. I turned it up, probably too much, and did a render of the Rolls. The IOR is about 4.2, a bit too reflective now, but the render gives the idea. The renders you posted were they with the ior set at 2.5? Just wondering if I was doing something wrong;) I also applied your tire rubber material to my tiresā¦looks very good! Anyway, I did have to apply mapping co-ords for the paint, the first car render had an area of splotchiness. Hereās the link for those interested in seeing it applied to a model.
I was looking for the solution from the render settings and it was a photoshop thing all along ⦠hehe


