Shaders and multiple UVW tags?



  • On 16/06/2015 at 02:50, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R15 
    Platform:    Mac  ;  
    Language(s) :     C++  ;

    ---------
    Greetings to all.

    I'm in dire need of a shader that can select different UVW tags in order to allow for multiple UV sets within a single material. I'd like to write it myself, but I'm not entirely clear on where to start or if this is even possible within the C4D C++ SDK. I've found some mention to multiple UV sets in VolumeData::GetUVW(), but I don't know what this means or if it's what I'm looking for.

    I was wondering if anyone could offer any pointers on implementing a shader like this. What I'm basically looking to do is to have a shader that accepts a child shader, and has a slot for a UVW tag you can drop into it. That child shader then uses the UVW ordinates from the selected tag, rather then whichever tag might be the default based on the position of the material tag on the host object.

    PS: I'm not looking for anyone to write the shader for me- I'd just like to know: A) if it's possible, and B) where I might start in implementing such a beast.

    -CMPX



  • On 16/06/2015 at 07:03, xxxxxxxx wrote:

    Hello,

    A shader can handle subshaders (as seen in the Mograph Multi-Shader) and it should be possible to link to an UVW Tag. But the problem might be to determine the "new" UV coordinates for the currently rendered fragment. You would have to look at VolumeData and RayHitID. You might use GetPolygon() to get the polygon and use that information with the position of the current intersection point to calculate the new UVW coordinates.

    Best wishes,
    Sebastian


Log in to reply