Questions about RayObject and UVW



  • On 25/04/2015 at 11:23, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   15+ 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    here is some code:

    for(Int32 i = 0; i < vps->vd->GetObjCount(); ++i)
    {  
        RayObject *op = vps->vd->GetObj(i);
        GePrint("object: " + String::IntToString(i) + ", uvcount: " + String::IntToString(op->uvwcnt));
    }
    

    it always prints 2, now the questions are:
    1- how uvwcnt is modified? "I guess it reflects multiple UVs, but when the object got multiple UVWTag it remains 2 which I think is weird, what does it represent?"

    2- related to question 1, how to access multiple UVs "UVWTag" , I can do the manual stuff like getting object and checking for UVWTag(s) , but I guess uvwcnt is an automatic way??

    please advice.



  • On 28/04/2015 at 05:24, xxxxxxxx wrote:

    Hello,

    actually uvwcnt is something you should not care about much. In Cinema 4D you can assign multiple UVW tags to an object. But the data you get from the VolumeData object is only the data relevant for rendering. So you can add multiple UVW tags but using VolumeData and RayObject you can only access the UVW data that is actually used by a material; UVW data not used by a material is ignored.

    So you have to access the textures that are assigned to an object and use the texture's uvwind property to access the UVW data with GetUVW(), something like this:

      
    RayObject* op = vps->vd->GetObj(i);  
      
    const Int32 texCount = op->texcnt;  
      
    for(Int32 textureIndex = 0; textureIndex < texCount; ++textureIndex)  
    {  
     const TexData* texData = vps->vd->GetTexData(op,textureIndex);  
      
     if(texData != nullptr)  
     {  
         const Int32 uvwIndex = texData->uvwind;  
      
         // get uvws for polygon 0  
         Int32 polygonIndex = 0;  
      
         PolyVector uvw;  
         vps->vd->GetUVW(op,uvwIndex,polygonIndex,&uvw);  
      
     }  
    }  
    

    best wishes,
    Sebastian



  • On 28/04/2015 at 06:37, xxxxxxxx wrote:

    Hi Sebastian,

    thanks for clarification, so a related question to "use" all UVWTag(s)
    when you assign a material to a polygon object, and projection is set to uv mapping, in the material Assignment tab it shows the object with the UVWTag (if it exists) , but it always points to the first UVWTag, is there a chance to force it to use multiple UVWTag(s) ?



  • On 28/04/2015 at 10:33, xxxxxxxx wrote:

    Hello,

    in Cinema 4D a material uses only one UVW tag. What are you exactly trying to do?

    Best wishes,
    Sebastian



  • On 28/04/2015 at 10:57, xxxxxxxx wrote:

    using multiple UVWTag(s) in my renderer, custom material, I just need to "force" them to get calculated in RayObject, but not sure how?



  • On 29/04/2015 at 00:17, xxxxxxxx wrote:

    Hello,

    as said, the VolumeData object provides access to the data that is necessary to render the scene the way Cinema 4D does. Data is not deleted, just presented in another way. In case of UVW data, nothing is calculated; the data is just accessed in a different way for convenience.

    If your material behaves differently than the standard Cinema materials you can still access the UVW data of several UVW tags by simply getting them from the given BaseObject.

    For questions no longer related to this thread's original topic please open a new thread. Thanks.

    Best wishes,
    Sebastian


Log in to reply