Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    UVW projections

    SDK Help
    0
    12
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 31/10/2006 at 06:48, xxxxxxxx wrote:

      You don't use ShdProjectPoint(), it's a internal function. You should use ProjectPoint instead.

      Bool ProjectPoint(TexData* tdp, LONG global_id, const Vector & p, const Vector& n, Vector* uv)
      Compute the UVW coordinates for a texture.

      Return
      Bool
      Success of generating the UVW coordinate.

      Parameters
      TexData* tdp
      The texture to use for the UVW coordinates. The caller owns the pointed object.

      LONG global_id
      The global polygon ID for the UVW coordinates.

      const Vector & p
      The point for the UVW coordinate.

      const Vector & n
      The normal for the UVW coordinate.

      Vector* uv
      The returned UVW coordinate.

      Let me know if that helps, also at what point in the Videopost are you calling the function.

      cheers,
      Matthias

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 31/10/2006 at 08:49, xxxxxxxx wrote:

        Thanks Matthias, I'm afraid it's not working though :(, it always returns FALSE. Here's how I'm using it:

        ... called from VidePostData::Execute(...) when vps->VP == VP_RENDER

        (simplified code)

        VolumeData* pVolumeData = vps->vd;
        RayObject* pObject = pVolumeData->GetObj(objID);
        TexData* pTexData = vps->vd->GetTexData(pObject, 0);

        Vector* pPolygonPointNormals = ...

        for (LONG p = 0; p < pObject->vcnt; p++)
        {
           RayPolygon polygon = pObject->vadr[ p ];               
           LONG polygonGlobalID = pVolumeData->Obj_to_ID(pObject) + p,

        Vector vA = pObject->padr[polygon.a];          
           Vector nA = !(ObjectRotationMatrix * pPolygonPointNormals[p * 4]); // normal in world space

        UVWStruct UVW;
        // assuming the object has a spherical mapping for instance
           Bool res = pVolumeData->ProjectPoint(pTexData , polygonGlobalID, vA, nA, &UVW.a;); // <-- returs false, UVW.a = {0,0,0}

        ...
        }

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 01/11/2006 at 17:44, xxxxxxxx wrote:

          I found out why it's probably not working for you (actually I had trouble to get it to work too). You have to be in VP_INNER to get a result from ProjectPoint, took me some time to figure that out 🙂 Anyway it's working for me, if you have still some problems don't hesitate to ask.

          cheers,
          Matthias

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 02/11/2006 at 01:43, xxxxxxxx wrote:

            Phew Matthias, its working now 😉 thank you so much, you ended up with 3 frustrating days of trial and error.

            cheers!

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              On 21/12/2006 at 07:53, xxxxxxxx wrote:

              I all,

              i'm trying to get the projected UVW from volume data and texdata.. but always i'm getting this problem with the spherical projection.

              What's the correct way to get stored and prepared UVW in VP_INNER?

              I've used ProjectPoint and return me some artifact.

              Cheers
              Renato T.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

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

                On 22/12/2006 at 15:46, xxxxxxxx wrote:

                What i mean is:

                When c4d prepare the geometry accessibile in the volumedata i imagine that store in UVW all kind of projection.
                But i don't understand how to get the "spherical" or "flat"   transformed UVW. GetUVW fill the UVW polyvector only for the UVW mapped object. I can't trust that ProjectPoint is called when rendering.

                thanks in advance and merry xmas to all 🙂
                Renato

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

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

                  On 31/12/2006 at 05:45, xxxxxxxx wrote:

                  and.. Happy New Year

                  Renato

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

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

                    On 02/01/2007 at 01:30, xxxxxxxx wrote:

                    In my case I use ProjectPoint, but I haven't noticed any problem with spherical projections (?). In order to be able to retrieve UVW mapping, the object needs to have a Texture Tag, which you cand obtain like this:

                      
                    polygon is an own structure, where pParentObject is a RayObject*  
                      
                    VolumeData* pVD ...  
                    for (LONG TextureID = 0; (!pAssignedMaterial) && (TextureID < polygon.pParentObject->texcnt); TextureID++)  
                    {  
                       TexData* pTexData = pVD->GetTexData(polygon.pParentObject, TextureID);  
                       if (TextureAppliedOnPolygon(pTexData, polygon.localPolygonID, polygon.pParentObject, pVD))   
                                   pAssignedMaterial = pTexData;  
                    }  
                    

                    and then

                      
                    pVD->ProjectPoint(pAssignedMaterial, polygon.globalPolygonID, polygon.vA, polygon.nA, &pUVW-;>a);  
                      
                    same with b and c  
                    

                    where vA and nA are vectors (position and normal) of the 1st vertex

                    TextureAppliedOnPolygon implementation is provided somewhere in the sdk

                      
                    BOOL TextureAppliedOnPolygon(TexData* pTexture, LONG localPolygonID, RayObject* pObject, VolumeData* pVD)  
                    {  
                    if (pTexture->restrict)  
                         {  
                              if (pObject->type != O_POLYGON ||   
                                   pTexture->restrict >= pObject->rscnt ||   
                                   !pObject->rsadr[pTexture->restrict]) return FALSE;  
                      
                            if (!(pObject->rsadr[pTexture->restrict][localPolygonID>>5]&(1<<(localPolygonID&31)))) return FALSE;  
                        }  
                         return TRUE;  
                    }  
                    

                    hope it helps

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

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

                      On 02/01/2007 at 09:39, xxxxxxxx wrote:

                      Thanks Joesfer,

                      but i've made exactly the same 🙂

                      but maybe that i'm looking in the wrong place.

                      Thanks
                      Renato

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

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

                        On 02/01/2007 at 09:45, xxxxxxxx wrote:

                        well you've done a little progress in some sense, at least discarding one possible fail... 🙂 luck!

                        1 Reply Last reply Reply Quote 0
                        • H
                          Helper
                          last edited by

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

                          On 03/01/2007 at 12:10, xxxxxxxx wrote:

                          Thanks!

                          Renato

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post