Straighten UVs into a grid pattern?
4173 3 4- HenrikVilhelmBerglund
- Member
- 23 posts
- Joined: April 2016
- Offline
I'm making game models and I want to straighten UVs so they are straight in the U and V directions, like a square/rectangular grid of UVs. This makes it very easy to create procedural textures. There's an Orbolt asset that does this (https://www.orbolt.com/asset/mifth::mifth_uv_grid) [orbolt.com] however there's a limitation where the UVs need to be grid based from the start, so for example it doesn't work if you've got extrusions, also it seems the SOP is a bit bugged in recent Houdini versions.
I tried doing this in VEX but got stuck pretty fast (very new at VEX). I'm looking for ideas how this can be done, either in VEX or any other method really. In this example I put down an UV flatten (left image) and then mifth_uv_grid.
I tried doing this in VEX but got stuck pretty fast (very new at VEX). I'm looking for ideas how this can be done, either in VEX or any other method really. In this example I put down an UV flatten (left image) and then mifth_uv_grid.
Edited by HenrikVilhelmBerglund - July 28, 2016 11:29:08
- sidenimjay
- Member
- 702 posts
- Joined:
- Offline
- HenrikVilhelmBerglund
- Member
- 23 posts
- Joined: April 2016
- Offline
- HenrikVilhelmBerglund
- Member
- 23 posts
- Joined: April 2016
- Offline
I have continued working on this and have come up something that kind of works. I have made two small HDAs.
UV_Allprims - Creates UVs from a 2x2 grid, placing all of the primitives' UVs overlapping on the topmost left UV square (A1).
UV_Gridify - (assumes UV_Allprims is before it), by inputting a group (primitive numbers) it will space the UVs next to eachother in a line. This only works horizontally for now. There's also a bunch of options for primitive sorting, transforms and so on. It's still WIP though, some things are weird/broken.
Some issues I am having:
1. I've got a group parameter exposed in the HDA in UV_Gridify to specify the groups. However the “Select geometry” arrow doesn't work, I get an error “argument of type ‘NoneType’ is not iterable”. If you dive into the HDA and click the Select geometry arrow there it works fine. Is this a bug or am I doing something wrong? Maybe it's better to get the input groups by creating something that figures out the inputs by inputting two primitive numbers and calculating a straight line between them instead?
2. All UVs are created square for now but it could be useful if the UVs actually look like the primitives on the model itself if they're not square(basically preserving texel density). Any ideas how this can be done?
3. I used a point VOP to space the UVs. I couldn't get it to work with wrangling. How would a VEX example of this look? (if the VOP is even reasonable at all. at least it works )
UV_Allprims - Creates UVs from a 2x2 grid, placing all of the primitives' UVs overlapping on the topmost left UV square (A1).
UV_Gridify - (assumes UV_Allprims is before it), by inputting a group (primitive numbers) it will space the UVs next to eachother in a line. This only works horizontally for now. There's also a bunch of options for primitive sorting, transforms and so on. It's still WIP though, some things are weird/broken.
Some issues I am having:
1. I've got a group parameter exposed in the HDA in UV_Gridify to specify the groups. However the “Select geometry” arrow doesn't work, I get an error “argument of type ‘NoneType’ is not iterable”. If you dive into the HDA and click the Select geometry arrow there it works fine. Is this a bug or am I doing something wrong? Maybe it's better to get the input groups by creating something that figures out the inputs by inputting two primitive numbers and calculating a straight line between them instead?
2. All UVs are created square for now but it could be useful if the UVs actually look like the primitives on the model itself if they're not square(basically preserving texel density). Any ideas how this can be done?
3. I used a point VOP to space the UVs. I couldn't get it to work with wrangling. How would a VEX example of this look? (if the VOP is even reasonable at all. at least it works )
-
- Quick Links