How to correctly access the Multiple uv sets??

The issue is with UV sets other than the 0 set. 


int NumUVs = Mesh->getNumUVSets();  - this gives me the correct number of sets
DzMap *UVMap = Mesh->getUVs(); -- works and is the same as below when used with 0


        DzUVSet *UVMapSet = Mesh->getUVSet(UVIndex);
        if(UVMapSet == NULL) return;
        DzMap *UVMap = (DzMap*)UVMapSet;

The 0 set works perfectly, all points appear to be correct.

But using UVIndex 1-5 returns a uv set with various amounts of garbage.

I can see from
    DzEnumProperty *EP = Mat->getUVSetControl();
int which = EP->getValue();

which set is in use, but I cannot correctly get back the sets above index 0.

I get the uv values by:

DzPnt2 *UVs = UVMap->getPnt2ArrayPtr();

the faces m_uvwIdx into this array yield perfect results for UV set 0, but not subsequent uv sets.

How do you correctly access these other UVSets?

0 seems to be the leqacy set and all old models work fine. It is the Genesis models that have an issue. Genesis 1 models using the Victoria 5 UV set (UV index 5) show scrambled uv lines when I plot them as shown above.

Anyone know what is different about the extra sets?

David

Comments

  • surrealsurreal Posts: 169

    Why the cast to DzMap* ?      i.e. DzMap *UVMap = (DzMap*)UVMapSet;

    why not use the DzUVSet* object?            e.g. DzPnt2 *UVs = UVMapSet->getPnt2ArrayPtr();

    I would not have a great deal of confidance in using the UVMap pointer in your code. DzUVSet inherits from DzMap, but they are still different object types. Where I absolutly have to cast I find it safer to use static_cast (or one of its sister operators) and check for null result.

    Cast using (T)e can be very handy for doing things that you should not do and getting around a lot of safeguards and boundaries wink  

  • Thanks.

    I did find out that the extra uv sets are only useable via the cached geometry, which only have the base set. Sp you have to just use the DzMap *UVMap = Mesh->getUVs(), the other multi uv set functions always fail.

    They create the complte uv set when the make the cached materialized version. What is available directly in the base geom is only the set 0 uvs. Plus the cached has the full set of subdivided faces, the base only the original set as loaded from the file. So the base is only really good for exporting to something like zbrush to make morphs or clothes.

    I was working with the wrong instance of the geometry.

Sign In or Register to comment.