jwoelper Posted April 7, 2009 Share Posted April 7, 2009 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 Quote Link to comment Share on other sites More sharing options...
stevenong Posted April 7, 2009 Share Posted April 7, 2009 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 Quote Link to comment Share on other sites More sharing options...
jwoelper Posted April 7, 2009 Author Share Posted April 7, 2009 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 Quote Link to comment Share on other sites More sharing options...
sibarrick Posted April 7, 2009 Share Posted April 7, 2009 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. Quote Link to comment Share on other sites More sharing options...
jwoelper Posted April 14, 2009 Author Share Posted April 14, 2009 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. Quote Link to comment Share on other sites More sharing options...
edward Posted April 15, 2009 Share Posted April 15, 2009 I'm not quite sure what you want but is it something like this? (ignore any load warnings) unitize_uv.hip Quote Link to comment Share on other sites More sharing options...
_suz_ Posted April 16, 2009 Share Posted April 16, 2009 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? Quote Link to comment Share on other sites More sharing options...
sibarrick Posted April 16, 2009 Share Posted April 16, 2009 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. Quote Link to comment Share on other sites More sharing options...
jwoelper Posted April 16, 2009 Author Share Posted April 16, 2009 (edited) 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 January 19, 2012 by jwoelper Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.