Tackled an interesting problem this week - tried to efficiently generate and integrate a kit of 100+ hologram sign assets in @unity3d using @sidefx #Houdini, for use in @ZenFri's @TheLastTaxi! #gamedev #unity3d #procedural #indiedev #indiegames
First, I have to build the sign meshes. I had a folder of sign textures made by @christian_amiel, so I set up a Houdini network with some Python to skim the folder of textures, and make me a plane for each texture in the folder.
The planes got UV'd and were sized proportionally to their corresponding textures so we got nice results like this. This is all happening procedurally, I didn't have to manually UV anything.
I put all the textures into an array so I wouldn't need 100+ separate materials in Unity. In Houdini, I assigned a unique 0-1 vertex colour to the planes. In the shader (using @AmplifyCreates shader editor) I pull it out and use it as the index for the texture array.
The texture array was getting pretty huge, so we decided to build an array for each in-game location. That way, we only load an array with the signs for the area you're in, rather than all the signs in the game. A spreadsheet was provided with signs and their valid locations.
So, now we have 11 texture arrays - we need a material for each array, but that's still a lot better than 100+ separate materials. The issue now is the array indices (baked to vertex colours) don't work any more, because the arrays are all different lengths!
To fix the indices, I went back to Houdini and set up another network. I have a Python node that takes the previous spreadsheet in as CSV, and builds me a tiny texture for each location/array.
The textures looked like this. The grey pixels are the same 0-1 index values we set on the sign meshes' vertex colours, just spaced out based on the array they're meant to translate indices for.
I reconfigured the shader to use the sign's existing vertex colour to get the corresponding pixel on the texture we baked, and use that pixel's colour as the index for the corresponding array. It worked!
The signs got emitters or frames generated in Houdini. Everything was batch exported from Houdini with some Python.

Fun fact, the emitter / glow effect below works the same way the sign shader works - it just samples the texture arrays at a really high (7) mip level.
So, the result of all this:

- 132 sign assets generated procedurally
- Only needed 1 material per location (11)
- Only needed 1 texture array per location (11)
- Only needed 1 32x32 texture per array (11)
You can follow @MikeSafioles.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.