how can I get each primitive's uv become the same?
12880 15 2- syzmatrix
- Member
- 111 posts
- Joined: 12月 2008
- Offline
Hello guys, I have a problem for quads polygon uv mapping, now I am designing an architecture with a lot of panels in diffent size and direction in space, and I want each primitive(face) of the quads textured with the same picture. So for each primitive,the uv points shoud fit into the whole uv window(both u,v is from 0 to 1 for each primitive). What should I do in order to get the result. Thanks in advance.
I attach a simple file,but should treat the null object as the initial input geometry. thanks again.
I attach a simple file,but should treat the null object as the initial input geometry. thanks again.
- tamte
- Member
- 8785 posts
- Joined: 7月 2007
- Online
- syzmatrix
- Member
- 111 posts
- Joined: 12月 2008
- Offline
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
Each primitive has vertices. They are numbered cyclically, one cycle for each primitive. So for 4 sided polys you have vertex id 0,1,2,3 and the next 0,1,2,3 etc etc
The idea is to create a uv attribute that ranges from 0-1 so as to create a coordinate system with 2 axes, one u and one v. So you want the points belonging to two axes and create a value for each pair of points defining the axis edge. The u direction is specified by $VTX>1. So Vertex 0 and 1 are 0, and vertex 2 and 4 are 1 (one pair of opposite edges). So now there is a 0-1 gradient between the two. A similar argument applies for the v direction.
You can actually replace the second expression by $VTX == 1 || $VTX == 2 and it still works (and may be easier to understand), or do one axis as $VTX == 0 || $VTX == 1 and the other $VTX == 1 || $VTX == 2
The idea is to create a uv attribute that ranges from 0-1 so as to create a coordinate system with 2 axes, one u and one v. So you want the points belonging to two axes and create a value for each pair of points defining the axis edge. The u direction is specified by $VTX>1. So Vertex 0 and 1 are 0, and vertex 2 and 4 are 1 (one pair of opposite edges). So now there is a 0-1 gradient between the two. A similar argument applies for the v direction.
You can actually replace the second expression by $VTX == 1 || $VTX == 2 and it still works (and may be easier to understand), or do one axis as $VTX == 0 || $VTX == 1 and the other $VTX == 1 || $VTX == 2
Edited by - 2011年1月12日 00:23:45
--
Jobless
Jobless
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
- syzmatrix
- Member
- 111 posts
- Joined: 12月 2008
- Offline
thanks for the great idea.now the problem is getting more interesting. I use the method in my mesh.But the problem is due to some primitive vertex order problem(the primitive is Rectangle).I can not get my mesh get right textured. Can I get the texture right for direction. Maybe should change the vertex order.
I also attach my working bego and hip file. thank you guys very much again.
I also attach my working bego and hip file. thank you guys very much again.
- tamte
- Member
- 8785 posts
- Joined: 7月 2007
- Online
this is more challenging and probably foreach SOP will find it's use
here is something with user controlled orientation
i think, it's pretty straightforward
you just make rough UVs for your geometry in a way that polygons are oriented the way you want
the important part is that the bottom edge of each polygon in UV space is more horizontal than vertical
the rest is automatic
i've done this quickly so hopefully it's not buggy
EDIT: for everyone else, you'll need bgeo file from previous post
here is something with user controlled orientation
i think, it's pretty straightforward
you just make rough UVs for your geometry in a way that polygons are oriented the way you want
the important part is that the bottom edge of each polygon in UV space is more horizontal than vertical
the rest is automatic
i've done this quickly so hopefully it's not buggy
EDIT: for everyone else, you'll need bgeo file from previous post
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
Tamte, rather than using a uv space to decide which vertices are in what order, what if we were to use the point position (say BB because its in a nice 0-1 range) and then use this to find the uvw axes for each primitive. The various uvw axes of the prims should then be smoothly changing, no? The u axis of neighbouring prims should be pointing in the same direction for neighbours, the same for u. As long as the changes are locally smooth we should not get any weird surprises in the final, global, object.
--
Jobless
Jobless
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
Here's an illustration of what I mean.
The red and white vectors are the “uv” directions according to a calculated color gradient (color from bb values).
From one prim to another the change is smooth.
The problem is that one of the the color gradient components may lie orthogonal to all of the prims edges. In that case we loose one axis, but I think this should be solvable? Perhaps by aligning the uv axis vectors with the prim-plane, but whithoiut loosing its direction.
Hmmmmmm.
The red and white vectors are the “uv” directions according to a calculated color gradient (color from bb values).
From one prim to another the change is smooth.
The problem is that one of the the color gradient components may lie orthogonal to all of the prims edges. In that case we loose one axis, but I think this should be solvable? Perhaps by aligning the uv axis vectors with the prim-plane, but whithoiut loosing its direction.
Hmmmmmm.
--
Jobless
Jobless
- tamte
- Member
- 8785 posts
- Joined: 7月 2007
- Online
i can't imagine this working for complex shapes (look at the whole object syzmatrix posted, not just the part I isolated) it would produce “seams” on areas you would have not expected (smoothly changing surface, but crossing the axis)
for example a cylinder, it would not flow around continuously, the textures will flip in x when crossing z axis even though they will be correctly pointing up the y
or half-cylinder laying on the ground, sort of arc or tunnel then maybe you sometimes want it to be textured continuously so that it starts on one side facing up then it follows the surface so on other side it is facing down and sometimes you may want it to be facing up on both sides of the tunnel and meet at the top (wihich may be the case of BB, but opposite sites would be mirrored, which may not be desired)
and because of this many possibilities and issues I think that UV hint is easy and very artistic controlled solution
for example a cylinder, it would not flow around continuously, the textures will flip in x when crossing z axis even though they will be correctly pointing up the y
or half-cylinder laying on the ground, sort of arc or tunnel then maybe you sometimes want it to be textured continuously so that it starts on one side facing up then it follows the surface so on other side it is facing down and sometimes you may want it to be facing up on both sides of the tunnel and meet at the top (wihich may be the case of BB, but opposite sites would be mirrored, which may not be desired)
and because of this many possibilities and issues I think that UV hint is easy and very artistic controlled solution
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
This is related to what I was talking about. The curvature tensor bit.
http://www.geometry.caltech.edu/pubs/ACDLD03.pdf [geometry.caltech.edu]
http://www.geometry.caltech.edu/pubs/ACDLD03.pdf [geometry.caltech.edu]
--
Jobless
Jobless
- petz
- Member
- 5 posts
- Joined:
- Offline
that´s an interesting paper! at work we have our own texture sop that aligns uvs to either a gradient of a scalar or the principal directions of curvature. it doesn´t work for all kind of shapes but for most cases it is doing a good job.
but for the example above i guess it would be a bit overdone. since the whole geometry constist of quads, wouldn´t it be the easiest way to flip the uvs if necessary to match the directions?
petz
but for the example above i guess it would be a bit overdone. since the whole geometry constist of quads, wouldn´t it be the easiest way to flip the uvs if necessary to match the directions?
petz
- Soothsayer
- Member
- 874 posts
- Joined: 10月 2008
- Offline
Hey Petz, that's interesting what you say. I am happy to see it's used somewhere. I think we could even use this method to create short hair fur, automatic uv's (rough anyway) and such things. Maybe it is ultimately not useful for this specific case but it's so very interesting! There are all kinds of gradients we could calculate. It could be useful in letting things move across a surface automatically, etc.
I tried to implement an algorithm of it today but I failed. I find tensors very confusing, with all the indices and summing up all those bits. My brain can't keep up. It's my new year resolution to wrap my head around it, so hopefully I will sooner or later have some working examples of this. In any case it wouldn't be wasted time, even if it fails for this.
I tried to implement an algorithm of it today but I failed. I find tensors very confusing, with all the indices and summing up all those bits. My brain can't keep up. It's my new year resolution to wrap my head around it, so hopefully I will sooner or later have some working examples of this. In any case it wouldn't be wasted time, even if it fails for this.
--
Jobless
Jobless
- syzmatrix
- Member
- 111 posts
- Joined: 12月 2008
- Offline
-
- Quick Links