THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/02/2003 at 10:17, xxxxxxxx wrote:
Cinema 4D Version: 8.012
Platform: Mac OSX ;
Language(s) : C++ ;
I'm still learning all this 3d stuff so everyone's help is greatly appreciated!
Is there any way to get local UV coordinates (texture verts or texture faces ) on a per vertex basis vs. the UVW global positions that are coming from the C4D API?:
UVWTag* theUVWTag = ( UVWTag* )inNode->GetTag( UVWStruct theUVVertCoord = theUVWTag->Get( PolyIndex );
From what I've seen and am used to is the ability to get TexterVerts (sometimes in an .obj and .3ds) that contains local UV values and then an index array of what polygon verticies are associated to each value... many times the number of texture verts could be higher than the number of verts in a poly mesh because each vert will contain UV values for adjacent poly faces.
What i've done in say, 3DS SDK or Maya SDK:
thePolyMesh->GetTextureVerts( *UVIndexArray );
for( long i = 0; i < thePolyMesh->TextureVertCount; i++ )
theUVCoords[theUVVert].m_U = thePolyMesh[ theUVVert ].x;
theUVCoords[theUVVert].m_V = thePolyMesh[ theUVVert ].y;
this essentually builds an array "theUVCorods" that contain local UV coords per-vertex..
then later per face, the api can address which texture vert is associated to the vertex.
did i explain it correctly? It seems that on VolumeData, there is something called GetDU/DV.. but does this happen for regular polygon objects?
Thanks to anyone that can shed light on this!
On 21/02/2003 at 06:14, xxxxxxxx wrote:
as far as i got it you have to compute vertex UV coordinates yourself. cinema works with polygon UV values only. you have to read the UV coordinates from the UVW tag and look which polygon they belong to. then you have to get the three (or four) vertex indices for this polygon and write the UV cooridnates into the corresponding vertices. but there is a problem when you have two polygons, that share one edge (-> 2 vertices) but have different UVs at this vertices. in this case the vertices have to be reduplicated.
hope this helps, good luck
On 22/02/2003 at 12:20, xxxxxxxx wrote:
Thanks for your help. I kinda figured as much on this.
Quick question on the UVWTag struct..
the array is something like
a.x, a.y, a.z
b.x, b.y, b.z
c.x, c.y, c.z
d.x, d.y, d.z
I am assuming I diregard the "d" if we have a tri instead of a quad polygon? If not then it's the similar caluclation of converting quads to tris for these verts?
On 22/02/2003 at 15:22, xxxxxxxx wrote:
yep. should work this way
On 28/02/2003 at 22:08, xxxxxxxx wrote:
awesome, I got it working, thanks for the help!!!