Jump to content

per face mapping


jwoelper

Recommended Posts

Hi!

Despite searching odforce and sidefx forums, i cannot find out how to map every face of a polygon mesh completely to the 0-1 UV range.

I see the purpose of the UVtexture SOP, when set to face - the help says "Maps a copy of the texture onto every face along its normal, orienting the texture properly. However, the map is not scaled to fit each polygon, nor is it distorted by the shape of each polygon." - I can live without distorting the polygon (although i'd like that) - but every primitive face should be scaled to fit inside the 0-1 UV range. In Maya there was a "Unitize" option which did just that... Is there a way to accomplish that?

Thanks and all the best,

Johann

Link to comment
Share on other sites

Do you need a mesh or can you use polygon? If you put down a Grid SOP and assign a shader with a texture to it, you will see the texture applied to every face of the grid when rendered. Notice you don't use the UV Texture SOP here.

If you don't assign an UV Texture SOP to polygon geometry, each polygon will be treated as individual faces with 0-1 UV range.

Hope the above helps!

Cheers!

steven

Link to comment
Share on other sites

Do you need a mesh or can you use polygon? If you put down a Grid SOP and assign a shader with a texture to it, you will see the texture applied to every face of the grid when rendered. Notice you don't use the UV Texture SOP here.

If you don't assign an UV Texture SOP to polygon geometry, each polygon will be treated as individual faces with 0-1 UV range.

Hope the above helps!

Cheers!

steven

Hi!

Thank you for the quick reply! I can use polygons. I understand that if i render the geometry, each face on a plane will be mapped to the 0-1 range without explicitly set UVs. I should have been a bit more precise in my question, but i need the real UV coordinates on the face since i am going to export the geometry and i am not planning to render it (at least not in software - this will be for a game engine). I already have pre-built geometry which i explicitely want to map per face - so the way of leaving the default UVs may not work...

Johann

Link to comment
Share on other sites

Thanks a million! This does indeed work, and maybe this is a base to start with - although in the end I need triangles, converting my polygons to triangles during the modeling process is highly unproductive... If somebody comes across a solution for mapping the entire polygon (or at least, quad) please let me know...

Cheers and thank you very much

Johann

Try this, put down a vertex sop and turn on Add texture, then put $VTX==0 in the first parameter and $VTX==1 in the second. This will only work for triangles but if you are going to a game engine I guess that's what you have anyway.
Link to comment
Share on other sites

You could extend my solution to quads easily enough and if you have a mix of quads and tris I think you could build a group of each type and do them seperately. But why is converting to triangles such a problem? Just put a convert sop at the end of your network before you write out your geometry, then you can work on everything as quads or whatever and just convert it at the output stage.

Link to comment
Share on other sites

Thanks Edward! This is exactly what I need! Thank you for compiling this neatly in the .hip file!

You could extend my solution to quads easily enough and if you have a mix of quads and tris I think you could build a group of each type and do them seperately. But why is converting to triangles such a problem? Just put a convert sop at the end of your network before you write out your geometry, then you can work on everything as quads or whatever and just convert it at the output stage.

Converting to tris is a problem because I have a large bunch of geometry (like in my case an airfield) which is composed of all sorts of n-sided primitives. The per-face mapping is an initial or intermediate step before mapping individual areas (e.g. map a gridlike surface with grass texture per primitive, then add detail). If i would triangulate, i will lose the flexibility to easily edit the mesh since it's then all tris - the mesh has many primitives with 50 vertices or more.

Again, thanks a ton for the great help, this is a truly great forum!

Johann

P.S.

For the record, sibarrick's solution also works great. For quads, use a vertex SOP, choose "Add Texture" and enter ($VTX==2)||($VTX==3) as the first, ($VTX==1)||($VTX==2) as the second component.

Edited by jwoelper
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...