Hey there polycounters,
I'm doing some weird vertex shader magic in Unity and would like to be able to save more data in my model's vertices that I could later use in the shader.
I'm using Maya 2018 for my modelling and as it currently stands, I've been using two UV sets and vertex coloring for storing different stuff (eg. animation direction vectors), but I've read that in some other apps (like 3dsMax) you're able to store data in the w channel of a vertex. Is this at all possible in Maya? Neither the component editor, nor trying to edit the uv's flags have helped.
There's supposed to be a
blind data editor somewhere in Maya, which could hypothetically help me add some custom data to my vertices that I then could try and write a custom importer in Unity for, but I haven't been able to get the editor to even show up so I'm starting to lose hope. I found a
forum thread from a year ago that said that it was a known issue and that changing a maya environment variable could make the editor accessible again, but of course no one bothered writing the name of the environment variable and I haven't been able to get it right (tested a bunch of variations I thought could work, to no avail).
So...I'm starting to lose hope.
Is there some way of adding custom data to a vertex through script?
Replies
Have you considered baking the information to textures and then either compiling it back into the model in Unity or just reading it direct from the textures?
I'd love to know more about encoding multiple values into one float, though.
100100 is your value and you split it to get 100 and 100.
So you have to half your resolution to get twice as many values in there.
But note: floats are handled differently then ints as they are stored with the famous "floating point". So you might only get two values in a float.
The internet will tell you a lot more then I can: https://stackoverflow.com/questions/17638800/storing-two-float-values-in-a-single-float-variable
Btw: I'm using this in my game Dwarf Mines so I know it works but it's difficult to handle in the shader and if there is any way to avoid it I would do