i wrote a custom material shader for maya, all has gone very well until I put it in a override field of a basic surface shader( ex. Reflection Material. ), and in the final image, i got the object shaded in a basic shading. I looked in the vray_MtlOverride.cpp and I noticed that override’s shade() calls my overriding material’s shade(). I tried printing something when my own material’s shade() is called. But nothing was printed… So I supposed that override material has not called my material’s shade() at all??? How that could happen?? Am I missing something?
Best regards
thekraken
here is a simple pseudo code of my material shader:
Is the newBSDF() method called for your material? It is possible that your material is wrapped in a MtlSingleBRDF material eventually, and that MtlSingleBRDF is attached to the node. In that case, it will call only the BSDF/BRDF functions of your material, and not its shade() method.
1. Is the newBSDF() method called for your material?
Yes, override shader called newBSDF() for sure, and it called only newBSDF()
2. It is possible that your material is wrapped in a MtlSingleBRDF material eventually, and that MtlSingleBRDF is attached to the node.
nope, my material is not wrapped in a MtlBRDF(If I have understood CORRECTLY what you talked about)… it was just in a lambert’s override material field…
could you PLEASE detail a little… i’ve been looking for the solution for 4 hours… it’s driving me crazy…
Ok then; can you show me a .vrscene file with the material exported in this way? In any case, the solution would probably be to do what you need in the traceForward() method of your BRDF - i.e. derive your own BRDF class from VUtils:iffuseBRDF and reimplement its traceForward() method to do what you need (you’ll still need to call DiffuseBRDF::traceForward() to do the regular shading stuff before that).
Well, you could attach the MtlOverride material directly to the node, instead of passing it through a MtlSingleBRDF material. You can do this for example with the post-translate Python callback.
I wrote a new class derived from BRDF to do the things finally and that works well. Thank you for all your replies. I will try the post-translate python callback later.