Jump to content

Move UVs per Copy


Recommended Posts

Actually I got two questions currently regarding UVs.

 

My imported mesh got three different texture projections. Each for a different purpose. I need all of them. Since I copy the objects, I need change some projections, otherwise the newly generated geometrie's UVs would be placed ontop of the original one.

 

So with the help of the stamp function in my Copy Sop and the Attribute Create node I can generate groups and/or an attribute per each copy with the copy ID. The IDs (e.g. 0-9) are supposed to be used as an offset in the x direction of the texture projection.

 

So, big questions:

 

a) How do I move the UVs in my texture projection on the per point (or is it per vertex?) context practically?

 

b)CTRL-4 splits my screen nicely and I can choose the UV view in one of the view ports. But how do I choose the texture projection I want to look at? I'm looking at one of them. But how do I switch my view to the other two projection?

 

Cheers and thanks in advance

Tom

Edited by Pancho
Link to comment
Share on other sites

For question 'a', if I understand it correctly, you can use an attrib wrangle with the following code

int _id = i@id;     // @id is the name of the id attribute you created
@uv[0] += _id;      // we add the corresponding id to the x axis of your uvs --> offset

This is only taking care of the default uv attribute, if you have others, named as edward suggested, you might want to update the code using some sort of modulo operation but it's difficult to figure out an appropriate code without having more informations or a hip file.

 

Could be something like this (even though something will probably go wrong with only that but that can give a you start)

int _id = i@id;
@uv[0] += _id % 3;           // modulo 3 because you have 3 projections
@uv1[0] += (_id %3) + 1;
@uv2[0] += (_id %3) + 2;

Whereas you should set your attribute wrangle as point or vertex depend on where your uvs are defined.
Middle click on the node to see if they are listed as point or vertex. It should probably be set to vertex.

 

 

If it is on vertex and you defined the id attribute on points, replace the first line with

int _id = point(0, "id", @ptnum);

or promote it to vertex instead.

 

 

Or post a hip file :)

Link to comment
Share on other sites

Hi there!

 

Thanks so far. Didn't work unfortunately. The textures were created in Modo.

 

My texture projections are named, in this case, Texture_01[2fv], Texture_02[2fv] and Texture_03[2fv]. My custom attribute is name uvOffset[1f]. Textures and uvOffset are both vertex attributes.

 

Tried to alter your code, but it didn't work.

 

@Texture_01[0] = @Texture_01[0] * 0.5

 

doesn't work either. The 0 is underlined red and UVs and model are disappearing.

 

Mmmmmh .... : )

Edited by Pancho
Link to comment
Share on other sites

in your case, since it's a custom name, you have to specify it is a vector.

@ is by default interpreted as a float value.

Some attributes are automatically recognized as vectors (P, uv and v for example)

 

try

v@Texture_01[0]
Link to comment
Share on other sites

Thanks!

 

v@uv[0] += f@uvOffset*0.1 works.

 

What I still don't understand is how the UVs work in H. In Modo e.g. there is a list with all the created UV textures. You click on them and they appear in the UV view. In H so far I don't understand the functionality in this area. Currently the UV view displays uv1 (UV:vertex). And as you can see in the code, I need to set uv, not Texture_01 in order to see differences, ALTHOUGH my imported model doesn't carry a texture named UV.

 

I need to use a Convert node in order to make my mesh editable with a Attribute Vop. Otherwise it is treated as one point. Is the Convert node adding the uv attribute?

 

P.S.: Without the Convert node my own UVs don't show up (when middle-clicking on the node). So I guess I need this node.

Link to comment
Share on other sites

In Houdini, attributes are NOT tagged as "texture" per se. It all goes by naming convention. So the viewport always uses the point/vertex attribute named "uv" as the texture for materials. In fact, it actually depends on the shader. The shader that is used for rendering needs to know the *name* of the attribute to use for texturing, and most shaders default to "uv".

Link to comment
Share on other sites

So, if I import objects via alembic how do I work with all my uv textures? Some images will need Texture_01 for projecting, others, e.g. for specularity Texture_02. If I can only see the texture projection named UV in the viewport things get a bit weird from my point of view. Is there no pulldown menu to choose which projection is visible in the viewport?

 

Also, if I use the UV Texture node to create an additional projection, there is no way to name my new projection. Strange. In Modo I'm used to choose/create a texture projection and then alter it in the viewport. How would one do this stuff in H? In SI I can choose my projection in the explorer and then work on it.

 

That's the problem when coming from another software. It's not only learning where all the buttons have gone to, but learn the philosophy of the new program.

 

But thanks for all the help so far.

Tom

Link to comment
Share on other sites

Yeah, switching to a new software is basically embracing frustration.

You probably can't access your uv attributes without a convertSOP because the alembicSOP is set to load as "Alembic Delayed Load Primitives".

From the help card: "These custom primitives are very light-weight and will display faster in the viewport. They are not as full featured as other Houdini primitive types (i.e. ray-tracing is not very accurate), but can be converted to other primitive types if need be."

You might not be able to name your projection, but you can find other workflow such as creating new branch in your network, project, rename (attribcreateSOP or attribWrangleSOP), and copy this new attribute back (attribCopySOP).
As Edward said, you can name them whatever you want, as long as you reuse the same name in shaders.

Regarding the viewport... welcome to Houdini :)
This might not be the strongest side of H at the moment but you'll get used to it (How long until you meet the"ghost object" bug ?)
Some stuff are missing (UDIM are on their way) but the strength of H is that you are rarely stranded if the tool does not exist. A bit of VEX will help you to build your own UDIM support for example.
But yeah... as far as I know -and I barely know things related to viewport- there is not default pulldown to switch textures in viewport.

 

 

Edit: Peter Quint's videos are always worth a watch :

UVs1 https://vimeo.com/12547162

UVs2 https://vimeo.com/12547587

UVs3 https://vimeo.com/12547985

UVs4

Edited by iamyog
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

you can use a rename attribute, and change uv2 to uv, uv4 to uv, and use it like that to see another uv set

 

the same way, you can use the uv texture, and then rename the uv attribute to uv7832 or whatever you like and attribute copy it to your already existing object, aka merging it to what you had.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...