Hi!
Lets say I wanted to promote prim UVs to replace the UVs for texturing, how would I go about this?
-Olivier
prim uvs to actual UV attribute?
2194 6 0-
- olivierth
- Member
- 1177 posts
- Joined: April 2017
- Offline
-
- tamte
- Member
- 9376 posts
- Joined: July 2007
- Offline
-
- tamte
- Member
- 9376 posts
- Joined: July 2007
- Offline
-
- olivierth
- Member
- 1177 posts
- Joined: April 2017
- Offline
-
- jsmack
- Member
- 8177 posts
- Joined: Sept. 2011
- Online
I don't think xyzdist will work for polygon meshes. Since the shared points need to have different values for the parametric uvs.
For quads, you can use vertexindex to retrieve the corner number within the quad, and then use it to index into a barycentric coord array.
e.g.:
For triangles, I think you might need to duplicate one of the corner vertices to replicate mantra behavior. ngons shade completely differently as the u represents the index, and v is the distance from the barycenter, which isn't possible to represent as uv coordinates without triangulating.
For quads, you can use vertexindex to retrieve the corner number within the quad, and then use it to index into a barycentric coord array.
e.g.:
int index = vertexindex(0, @primnum, @vtxnum); vector corners[] = array({0,0,0}, {1,0,0}, {1,1,0}, {0,1,0}); @uv = corners[index];
For triangles, I think you might need to duplicate one of the corner vertices to replicate mantra behavior. ngons shade completely differently as the u represents the index, and v is the distance from the barycenter, which isn't possible to represent as uv coordinates without triangulating.
-
- tamte
- Member
- 9376 posts
- Joined: July 2007
- Offline
jsmackwhy wouldn't it?
I don't think xyzdist will work for polygon meshes. Since the shared points need to have different values for the parametric uvs.
it's using current prim as a group scope, so each vertex only gets primuv coords from its own prim
EDIT: I mean you may be right for ngons that wrap onto itself, like single polygons with bridged holes, but I assume that's not the case
Edited by tamte - March 29, 2021 20:40:12
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- jsmack
- Member
- 8177 posts
- Joined: Sept. 2011
- Online
tamtejsmackwhy wouldn't it?
I don't think xyzdist will work for polygon meshes. Since the shared points need to have different values for the parametric uvs.
it's using current prim as a group scope, so each vertex only gets primuv coords from its own prim
EDIT: I mean you may be right for ngons that wrap onto itself, like single polygons with bridged holes, but I assume that's not the case
Ah, scoping it to the primitive may work for quads and triangles, but not if they have coincident points. It also won't work for ngons because the v value is the same for all of the vertices. It's also a sort of raytracing and will be a lot slower than indexing an array.
-
- Quick Links
