Two UV-related questions

   6626   8   4
User Avatar
Member
41 posts
Joined: Jan. 2007
Offline
Sorry if this is a repost, but the search function won't work for terms under 2 characters (frustrating for uvs and s & t coordinates!)

I've never fully grasped UVs and textures in mantra, so hopefully someone can answer these questions:

1) How do I access UV values in a shop network? I am only given s & t values in the globals. Can anyone point me to a good tutorial about the difference?

2) What's the best way to tile a texture? I don't seem to have any control over this. I can transform my UVs with the UV transform SOP, and in the viewport this works fine. However, my shader ignores this entirely, and just seems to read s & t, whatever they are. If I multiply my s & t by a float, the tile sizes remain the same but the texture inside that tile scales.

Thanks!
User Avatar
Member
41 posts
Joined: Jan. 2007
Offline
More questions!

3) On the Material SOP, how do I know to use point, primitive or detail attributes? With the mantra surface shader, I only see my texture if it's set to point attributes - with primitive attributes it doesn't render at all. However, with the “leaf” texture, it only works if it's set to primitive attributes!
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
UV's are stored as a vertex or point float3 attribute on your geometry, it's not in the globals so you need to do is import it with a Parameter or Bind node. S and T are implicit coordinates for each primitive, which is why they are in the globals.
Multiplying your UV's by a scalar should allow you to tile your texture, assuming your Color Map is set to repeat .
Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
41 posts
Joined: Jan. 2007
Offline
Interesting!

It does seem that when I use the uv coords param/bind, I can scale and transform it accurately. Exactly what I was looking for!

However, do you know the difference between the point/primitive/detail binding on the Material SOP? And why the results can be so different?
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
tk421storm
1) How do I access UV values in a shop network? I am only given s & t values in the globals. Can anyone point me to a good tutorial about the difference?
You can use the UV Coords VOP or the Shading Layer VOP to bring in your uv co-ordinates from your geometry.

You can also add a Bind VOP and set the name to uv and the type to vector to bring them in as well. This method works for any bound attribute on the geometry. Make sure to check the “Use Input Parameter if Not Bound” option to not take up needless memory if the attribute on the given geometry doesn't exist.

2) What's the best way to tile a texture? I don't seem to have any control over this. I can transform my UVs with the UV transform SOP, and in the viewport this works fine. However, my shader ignores this entirely, and just seems to read s & t, whatever they are. If I multiply my s & t by a float, the tile sizes remain the same but the texture inside that tile scales.
Relates to Question 1. You need to bring the uv's in using the SHOP shader using the three methods above first.

Once you have the uv's in, you can apply a UV Transform VOP to scale and position the uv's on the shader along with modifying the UV's directly on the geometry.

Do both. It is very common to apply a UV Transform VOP inside your shader to give the artist the ability to tweak the position of the texture within the shader.

3) On the Material SOP, how do I know to use point, primitive or detail attributes? With the mantra surface shader, I only see my texture if it's set to point attributes - with primitive attributes it doesn't render at all. However, with the “leaf” texture, it only works if it's set to primitive attributes!
As far as the SHOP shader is concerned, it doesn't care if the attribute is of type vertex, point, primitive or detail. When mantra loads in the geometry, if the shader has a VOP that requests a specific attribute, in this case the vector “uv” attribute, it will promote it to a vertex type at render time.

Almost invariably you will want to set the UV Texture SOP and UV Project SOP's to always create vertex uv's.

To do this for UV Texture SOP, place a fresh one down, change the “apply to” parameter to vertex. Then from the gear menu on the parameters for this node, select the “Save as Permanent Defaults”.

To do this for the UV Project SOP, place a fresh one down, change the “Group Type” to vertices. Then from the gear menu on the parameters for this node, select the “Save as Permanent Defaults”.

Yes you can apply uv's to points but I simply don't do that as vertex uv's are far more flexible especially when tweaking uv's.

The only reason to use point type uv's is if you are using a VOP SOP as you can only work on point type attributes. You can insert an Attribute Promote SOP and promote the vertex uv's to point uv's in those cases.


Many users coming from other apps get thrown by Houdini's separation of points and vertices in general. Points are actual points in the scene and are the lowest data type in Houdini. Vertices are used by Primitives to index in to the points. Vertices are unshared between primitives and are indexing the points by number. You can see this in the Details View if you inspect the vertex attribute. It clearly shows the primitive:point that the vertex is both bound and referencing.



Hope this helps.

Attachments:
uv_basics_in_shader.hip (144.8 KB)

There's at least one school like the old school!
User Avatar
Member
41 posts
Joined: Jan. 2007
Offline
Thank you!!! That is a really awesome, thoughtful response that helps me understand what's going on.

I'm still a bit confused about the material SOP applying to point, primitive or detail. If I throw down a grid and then apply a material sop to it, and set it to primitive or detail, I can see the texture fine. However, if I set it to point I don't see anything. Is a point-applied material SOP for a specific situation, separate from most texturing tasks?

Thanks.
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
The Material SOP is used to add a string attribute to either a Detail global attribute for all primitives in the SOP, to selected primitives in the SOP (default and what you should use in most cases) or to points for special case uses such as instancing where you want the point to pass on material attributes on to the instances later on at render time with Mantra.

Using points with the Material SOP won't work in the viewport for what you want.

So set the Material SOP to primitives when you want to apply materials to actual primitives in your scene.

—-

This workflow is carried through to the support of Alembic Delay Load primitives introduced in Houdini12.5 where you can use the Material SOP to assign per-Alembic-primitive materials to the various primitives in the Alembic archive.
There's at least one school like the old school!
User Avatar
Member
41 posts
Joined: Jan. 2007
Offline
Ahhhh, ok. That makes sense. With that advice, I've been texturing non-stop for two days!

Thanks again.
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Fantastic!
There's at least one school like the old school!
  • Quick Links