Showing posts with label uv. Show all posts
Showing posts with label uv. Show all posts

Tuesday 28 March 2023

fusing geo using uv attribute (eg. separated head from neck)

Lets say you've separated the head geo from the body for rigging purposes or otherwise.
How do you glue it back together reliably, without resorting to many individual vertex pair selections and fusing each?
UV's! As long as your mesh has good non overlapping UV's (which existed before you chopped it), you can promote them from vertex to point (might as well give it a new name, and keep the originals for actual texture use) then specify this new attribute at the Match Attribute (see below). Turn off Snap Distance, as the UV data is what will snap vertices/points together (in this case I've called it fuse_uv). I've left everything else in the Fuse node as default.
This is super handy especially if your model's point count is not fixed (eg you're not sure where you're cutting the model yet)


Thursday 22 September 2022

camera projection uv, texture reference object a la Maya

A simple thing..

In Maya, you can project UVs from a camera. To prevent textures from swimming if you do animate the object, you must create a Texture Reference Object. Here's how you do it in Houdini.

The gist is - 

  • use the UVTEXTURE node to project your uv's. Set the texture type to Perspective from Camera and specify the projection camera in the appropriate box.
  • freeze the object on the frame you want the projection to occur at, using a TIMESHIFT.
  • copy the uv attribute back onto the moving object, using the ATTRIBUTE COPY node.

Wednesday 30 October 2019

camera projection with houdini

Houdini camera projection is as simple as creating a "UV TEXTURE" node and plugging it into the geo you're projecting onto.
In this node, select "Perspective from Camera", from the Texture Type dropdown menu.
You could name the UV Attribute something other than the default of "uv" if you are creating some alternate uv sets.
In the Camera dialog box, specify the camera node. Eg. /obj/cam1 & usually the attribute class for the uv's will be set to vertex.

Now, whatever material you apply to it will use these uv's. (or maybe a different set if you specify within the shader network!) eg. uv2.

Tuesday 6 March 2018

calculating nice uvs for polywires/regular surface

int div=`chs("../polywire2/div")`;
@uv.x=float(@ptnum%div)/div;

f@numRows=float(@numpt)/div;


i@rowNum=@ptnum/div;
@uv.y=float(@rowNum)/float(@numRows);


I then promote this to a vertex attribute...not sure why I didn't do it via vertx in the first place ...

The channel bits of code "chs...." just refer to the number of divisions down the tube. eg an 8 sided cylinder.

This setup keeps the UVs within 0-1 space.

Monday 22 May 2017

voronoi fracture woes & exporting alembics to maya

Voronoi fracturing is often used to create destruction fx. It also creates a lot of dirty geometry, which leads to pain when exporting your geometry to Maya -

"UVs aren't per-vertex or per-polygon per-vertex, skipping"

 This also plays havok with motion blur and any other vertex attributes you might have in play.

Using a For-Each loop, or For-Each subnetwork (if using the subnetwork, attach a Connectivity SOP first, with a "class" attribute, so the For-Each knows what pieces to run over. You type "class" into the Attriubute field of the ForEach Subnetwork parameter box) use Clean SOPs to fix any nasty geo that might have been generated. You'll want to tick most of the boxes - your mileage may vary with the Non-Manifold option.

This probably won't fix the problem still - the fracturing process can make a lot of stray edges - 2 point primitives, which don't play nice.

drop down a Primitive Wrangle and use this code-
i@vertnum = primvertexcount(0,@primnum);

It creates a variable called vertnum that counts how many vertices you have in each primitive.

Follow this wrangle with a blast that has
@vertnum==2
in it's Group box. This will kill any stray edges & hopefully fixes everything!

Saturday 3 December 2016

Attribute Interpolating UVs & things other than scattered points.

Creating "sourceprim" and "sourceprimuv" attributes for things other than scattered points. In the Houdini docs for the scatter node, there is a guide on getting your scattered points to follow animated/deforming geometry. The scatter node can generate the source primitive and it's uv attributes for you at the tick of a box. You then stick that into an attribute interpolate node and away you go.

However, if you want to interpolate something else like say..a colour attribute or a UV attribute, or something like that - then you'll have to create your own sourceprim and sourceprimuv.
Freeze your geo using a timeshift. Then just lay down a pointVOP, connect it to your geo & then plug the source (ie in the case of the scatter example, it's the object you want to stick to) into the second input.
Within the VOP make an XYZdist node and wire up P to the position input and the second input into the "file" . Create two bind exports and change the output names to sourceprim and sourceprimuv, making sure the data types are correct.
Finally just play around with the search distance in the XYZdist node so you get correct values. Jump out of the VOP and plug the appropriate bits into the Attribute Interpolate node. Adjust the settings to whatever you need (Vertex,point etc...) and everything should be good! You might have to change the pointVop to a vertexVop... too haha.