how can I get each primitive's uv become the same?

   12002   15   2
User Avatar
Member
111 posts
Joined: Dec. 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.

Attachments:
jiujiang_send.hip (49.3 KB)
send.jpg (187.4 KB)

User Avatar
Member
8585 posts
Joined: July 2007
Offline
just a quick example with Vertex SOP

Attachments:
jiujiang_send_fix.hip (114.2 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
111 posts
Joined: Dec. 2008
Offline
thank you very much, houdini master!
It is great to get such an useful reply from your post, but I still can not understand the fellowing expressing using in the vertex node, could you give some simple explanation ?
best

Attachments:
send_2.jpg (29.1 KB)

User Avatar
Member
861 posts
Joined: Oct. 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
Edited by - Jan. 12, 2011 00:23:45
--
Jobless
User Avatar
Member
861 posts
Joined: Oct. 2008
Offline
Maybe this helps to explain my ramblings above.

Attachments:
uv.hip (125.7 KB)
Clipboard01.jpg (114.7 KB)

--
Jobless
User Avatar
Member
111 posts
Joined: Dec. 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.

Attachments:
jiujiang.zip (59.1 KB)
send3.jpg (351.8 KB)

User Avatar
Member
8585 posts
Joined: July 2007
Offline
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

Attachments:
send_two_fix.hip (185.8 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
861 posts
Joined: Oct. 2008
Offline
Fantastic! I was thinking about looking at neighbouring prims and using a common edge, but this is really better.
--
Jobless
User Avatar
Member
861 posts
Joined: Oct. 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
User Avatar
Member
861 posts
Joined: Oct. 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.

Attachments:
Clipboard01.jpg (39.4 KB)

--
Jobless
User Avatar
Member
8585 posts
Joined: July 2007
Offline
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
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
861 posts
Joined: Oct. 2008
Offline
Ah, yes, a tube… you are right tamte, it would't work for that.

Unless… I have one more idea, but it involves intrinsic geometric flows… I might have to come back to this topic in a year or two, after some hard study.
:wink:
--
Jobless
User Avatar
Member
861 posts
Joined: Oct. 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]
--
Jobless
User Avatar
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
User Avatar
Member
861 posts
Joined: Oct. 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.
--
Jobless
User Avatar
Member
111 posts
Joined: Dec. 2008
Offline
thanks guys ,you are really nice people. And I learned a lot from your network.
  • Quick Links