Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

Questions about RayObject and UVW

Author
Message
  Topic Search Topic Search
MohamedSakr View Drop Down
Member
Member
Avatar

Joined: 2012 Sep 17
Location: Egypt
Online Status: Offline
Posts: 577
Direct Link To This Post Topic: Questions about RayObject and UVW
    Posted: 2015 Apr 25 at 11:23am

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.
cheers,
Mohamed Sakr
Back to Top
S_Bach View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2011 Jun 27
Online Status: Offline
Posts: 1379
Direct Link To This Post Posted: 2015 Apr 28 at 5:24am
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

Edited by S_Bach - 2015 Apr 28 at 5:31am
SDK Support Engineer
Back to Top
MohamedSakr View Drop Down
Member
Member
Avatar

Joined: 2012 Sep 17
Location: Egypt
Online Status: Offline
Posts: 577
Direct Link To This Post Posted: 2015 Apr 28 at 6:37am
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) ?
cheers,
Mohamed Sakr
Back to Top
S_Bach View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2011 Jun 27
Online Status: Offline
Posts: 1379
Direct Link To This Post Posted: 2015 Apr 28 at 10:33am
Hello,

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

Best wishes,
Sebastian
SDK Support Engineer
Back to Top
MohamedSakr View Drop Down
Member
Member
Avatar

Joined: 2012 Sep 17
Location: Egypt
Online Status: Offline
Posts: 577
Direct Link To This Post Posted: 2015 Apr 28 at 10:57am
using multiple UVWTag(s) in my renderer, custom material, I just need to "force" them to get calculated in RayObject, but not sure how?
cheers,
Mohamed Sakr
Back to Top
S_Bach View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2011 Jun 27
Online Status: Offline
Posts: 1379
Direct Link To This Post Posted: 2015 Apr 29 at 12:17am
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
SDK Support Engineer
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.125 seconds.