Trying to improve auto GameRes process from GameDev toolkit

   1994   5   2
User Avatar
Member
46 posts
Joined: March 2016
Offline
I've been trying to set up a workflow where I create a sculpt in ZBrush, then automatically handle the lowpoly and UV mapping in Houdini using the GameDev toolkit.
I've largely gotten this to work by following the various guides on it, but I have a few problems I'm still trying to work out.

1) I need to make it automatically delete occluded areas of the mesh so it isn't wasting space on stuff you never see.
I'm currently struggling on this one. I've been able to mark the occluded areas I need to delete by using the Calculate Occlusion node.
This works on a gradient, so I tried to use an Attribute Wrangle to then delete any points with a value under a certain amount.
This seems to work, but the listed number of polygons doesn't go down. I tried deleting primitives instead, but got a messed up result because, I assume, I couldn't find a proper way to convert the point attribute to primitives.
Using Clean seems to fix this ghost polygons issue, but also seems very sub-optimal compared to just not creating this error in the first place.
-Edit- 1 is solved, read below.

2) I need to figure out how to get it to split long UV islands. This is a prevalent issue in stuff like swords, which have long, unbroken planes.
If an island is too long relative to the rest, it has to stretch all the way from 0-1 in the UV space just to fit, and the need to maintain texel density means that everything else becomes super small. Thus you wind up not using the majority of UV space.
I think I can solve this in one of two ways, but I'm stuck on each.
I could find a way to automatically split a long island, which I've hardly been able to wrap my head around without knowing of any means to even measure a UV island. Or I could probably just use non-square textures, but this would have its own host of complications, and I don't see any way to force the UVs into only half the UV space.
-Edit- 2 is solved, read below.

3) This is a tough one; I need to get the UV mapping to create fewer small islands. The GameDev tools have a feature for this built in, but it appears to be extremely buggy and unreliable.
No matter what settings I use, it ignores a very large number of tiny islands, and the settings for this don't even seem to have a consistent correlation with the results they give. IE; a higher or lower setting does not consistently affect larger or smaller islands the way it's intended.
Worse yet, it seems prone to causing severe deformation of UV islands on certain settings.

4) This is a more distant and less serious issue, but Polyreduce tends to create extremely long triangles in some areas.
Equalize Lengths doesn't help this, as it seems to focus only on maintaining a roughly equal surface area. No matter how high I set it, I still get a number of incredibly long and skewed triangles.
Edited by Grimwolf - Sept. 6, 2018 16:45:26
User Avatar
Member
833 posts
Joined: Jan. 2018
Offline
You should contact Mike Lyndon directly with these issues. He might be following this thread, or he might miss it. So perhaps a direct message to him would be the best course of action.
>>Kays
For my Houdini tutorials and more visit:
https://www.youtube.com/c/RightBrainedTutorials [www.youtube.com]
User Avatar
Member
46 posts
Joined: March 2016
Offline
I seem to have solved #1.
I removed the blur from the Occlusion node and sharpened the curve so the result would be more binary and more accurately acquire only areas that are fully occluded.
Then I used Attribute Promote to transfer the Occlusion attribute over to the primitives comprised of the points with that attribute, then used a Wrangle to delete all the primitives with a value less than 0.05.
Not only is this a clean result without a bunch of ghost polygons left behind, but it more accurately determines which faces to remove, since deleting the points comprising those faces would lead to ALL connected faces being removed.

2 and 3 are going to be far more difficult to solve.
On #2, I've gotten so far as to create an integer attribute on each primitive defining its UV island by number. I'm struggling now to find a way to iterate over each of them and measure them, in order to find islands that are exceptionally large and long compared to the rest. After that I need to find a way to split it in half.
I think if I can manage this, I can re-use much of the process to solve #3 as well, since it requires me to measure each individual UV island.

I'm going to examine the structure of the Merge Small Islands node to get an idea for how I can measure the islands. Although based on the behavior of this node I described earlier, it may not be set up correctly.
Edited by Grimwolf - Sept. 5, 2018 14:33:41
User Avatar
Member
46 posts
Joined: March 2016
Offline
I've found a solution to #2.
The solution is actually incredibly simple. It turns out if you use UV Layout set to Single Tile, you can set the Size to non-square values and restrict the area it lays them out into.
So all I had to do was set the height to 0.5, the center of the height to 0.25, and then use Transform UV to stretch it vertically to fill the full 0-1 space.

#3 on the other hand is looking even more complicated than I anticipated. While I can look at the internal structure of the Merge Small Islands node, there's virtually no commenting or network boxes to explain why anything was done or what purpose any particular section serves.
Since this does already exist in the GameDev toolset, I may just have to wait for the developers to fix #3 themselves.
So I suppose I'll be on to #4 next.
Edited by Grimwolf - Sept. 7, 2018 19:44:34
User Avatar
Member
46 posts
Joined: March 2016
Offline
I've found a much better solution to #2, which I edited into my post above.
I've also both found and solved a 5th problem; exploding the mesh for baking.
This isn't included in the baker by default, but I was able to create a way to automatically explode the mesh before baking.
First I group the entirety of the lowpoly mesh. Then I use File to grab the highpoly mesh.
I merge the two together, then use Exploded View. The high and the low share the same part names because of ZBrush, so they get exploded identically together.
Then I use Split with the group name of the lowpoly to separate them again, and input the exploded low and high into the baker node.
Edited by Grimwolf - Sept. 8, 2018 12:33:40
User Avatar
Member
46 posts
Joined: March 2016
Offline
Ahaha, I might've stumbled on something wonderful for improving the auto-UV process.
So I think I mentioned this earlier, but both the auto-lowpoly and auto-UV processes can be a bit janky, and when you combine the two the problems become compounded and increased.
The reason being, that auto-UV needs fairly clean geometry to have any chance of giving a decent result, and the auto-lowpoly process absolutely does not give that.

Here's how I'm working around it, though.
I can first create an extremely dense but reduced mesh with a relatively weak PolyReduce, and auto-UV that. Even if the geometry is messy, the sheer density allows the UV process to pick out the best and cleanest lines to split.
I can then run a second PolyReduce, but set the UV seams created earlier as Hard Edges.
This means that, in the process of reducing it to a full lowpoly model, it retains the position of those clean UV edges and reduces everything around them.
I haven't perfected it yet, but I've already been able to get far cleaner UVs this way.

-Edit-
A bit more progress. It seams that setting the UVs as “Soft Edges” is better than “Hard Edges”, since it attempts to maintain the shape and position of the edges, while still allowing the points along them to be reduced.
I've gotten surprisingly good results on hard surface assets as well by hardening normals, and incorporating those normal values into the calculation (which are normally explicitly removed from the calculation).
This causes it to be more aggressive in reducing planar surfaces, while maintaining angles and curves.
Edited by Grimwolf - Oct. 25, 2018 13:13:57
  • Quick Links