Jump to content
Sign in to follow this  
jwoelper

per face mapping

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

haai!

are u looking for a projection of each face to the [0,1] range at SOP level - that (s,t) in vex does automatically?

:huh:

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×