.obj export: Texture Projection



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/02/2008 at 11:13, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9/10 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Im still working on a decent .obj export.

    At the moment i'm trying to figure out how to export the UVW coordinates for the projection types like Specical or Cubic.

    Searching the Froums i find a lot of hints like "Have a look at TexData" or "You have to be in VP_INNER".

    So i had a look at TexData, but what now? I need to have acces to VolumeData, which i only have in VP_INNER. Do i really need to have a VideoPostData plugin? If yes, how is it done right?

    Please help :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/02/2008 at 13:20, xxxxxxxx wrote:

    If you go to the TexData documentation you will find the sourcecode of the ShdProjectPoint() function listed. There you can see how to calculate UVs for all the different projections. You have to calculate the UVs for any projection except UVW on your own.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/02/2008 at 09:13, xxxxxxxx wrote:

    Just curious about what you're trying to do... can you not get "decent .obj export" with my Riptide plugin?
    Depending on what exactly you're trying to achieve, I may be able to help more.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/02/2008 at 09:51, xxxxxxxx wrote:

    ...in the meantime, have a look at the GenerateUVW() function, as well as my posts at the bottom of this thread: http://www.plugincafe.com/forum/display_topic_threads.asp?ForumID=4&TopicID=2858&SearchPagePosition=1&search=Giblet&searchMode=allwords&searchIn=Author&forum=4&searchSort=dateDESC&ReturnPage=Search



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/02/2008 at 02:14, xxxxxxxx wrote:

    Hey Giblet,

    Thanks for your reply!

    Of course i can get decent Obj export with your Riptide plugin, but my exporter plugin needs to have its own Obj exporter.

    I had a look at the GenerateUVW() function and the way you used it, think it helps me out here. Thank you!
    Calculating the UVW's on my own always inverted the texture...

    In fact, i have a fully working Obj export, but im struggeling with making it more efficient.
    The export time is rather long and the exported files are pretty big, due to many diplicated VN's and VT's.

    I think i read sth in your Riptide changelog about killing duplicates, and it would be great if you could tell me how you achieved it!

    Fused



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/02/2008 at 10:01, xxxxxxxx wrote:

    _"I had a look at the GenerateUVW() function and the way you used it, think it helps me out here. Thank you!
    Calculating the UVW's on my own always inverted the texture..."
    _
    The GenerateUVW() function (used the way I did) can help when other mapping types are set in the Texture Tags on your objects, and/or when those tags have scaling/offset values set in them.  As for the inverted part, the UVs may be flipped vertically from what you want, either way... so you may (still) have to invert the v value before you export:

        
        
          
        --------------- S N I P --------------
        
        
        
        
        typedef struct _UVCoord {  
         Real u;  
         Real v;  
         Real w;  
        } UVCoord;  
          
          UVCoord a, b, c, d;
        
        
        
        
          uvw = uvTag->Get(i);  
          
          a.u = uvw.a.x;  
          b.u = uvw.b.x;  
          c.u = uvw.c.x;  
          d.u = uvw.d.x;  
          
          a.v = 1.0-uvw.a.y;  
          b.v = 1.0-uvw.b.y;  
          c.v = 1.0-uvw.c.y;  
          d.v = 1.0-uvw.d.y;
        
        
        
        
          ...etc...
        
        
        
        
        --------------- S N I P --------------  
        
    

    "I think i read sth in your Riptide changelog about killing duplicates, and it would be great if you could tell me how you achieved it!"

    Yes, most of your UVs and many of your Normals will be duplicates, since most of your polygons share common points/edges and may be on the same plane.  My code just does a brute-force scan through the polygon/face list, looking at the uv/normal vertices, keeping track of (and removing) duplicates and adjusting the index values of all the polygons as it goes.
    Frankly, that code took some effort to come up with and I'm a bit reluctant to post it here in the forum, but if you get hung up, send me an e-mail (typhoon at jetbroadband dot com).
    Keith



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/02/2008 at 10:18, xxxxxxxx wrote:

    "Frankly, that code took some effort to come up with and I'm a bit reluctant to post it here in the forum, but if you get hung up, send me an e-mail (typhoon at jetbroadband dot com)."

    hehe, i was thinking that you might say that.

    thank you for you help, so far. ill try once again, and if i cant make it, ill come back to your offer.

    geetz
    fused


Log in to reply