- Home /
Prevent mesh normals for being normalized when building for mobile?
I'm procedurally generating a mesh and using the mesh's normals to store custom, per-vertex meta-data. Specifically, I'm storing a single float in the z component of the normal. For desktop builds, everything works as expected. I'm able to retrieve the float and use it in my vertex shader to modify the vertex's characteristics. When deploying to mobile, I'm experiencing erratic behavior and it seems to be because the mesh's normals are being normalized.
A two part question:
1) Is there any way to prevent the mesh's normals for being normalized (which corrupts my meta-data)?
B) Is there another place to store a single-float's worth of per-vertex meta data (I would even take a half)? The normals or tangents are the optimal places as they will never be used (the shader doesn't perform any type of lighting). A back-up location is in the secondary UV coordinate, however there is a possibility this will be needed for traditional purposes in the future. The color is another option, however I'm wary of breaking a 32-bit float down into 8-bit chunks and expecting it to be correctly reconstructed on a bunch of different graphics architectures.
Thanks for your help!
Just for my understanding, would it be possible to simply have another array of your own, where you store that data?? thx
To be sure to be sure, you're not accidentally calling RecalculateNormals
somewhere?
(For example, perhaps where you RecalculateBounds
out of habit?)
I swear there's an annoying situation, where, it automatically recalculates the normals; this has come up on here before a few times, unfortunately I can't lay hands on it ...
Your answer
![](https://koobas.hobune.stream/wayback/20220613115949im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to implement stencil shadows/shadow volumes 1 Answer
How to set pre-render properties to UGUI Image? 0 Answers
Render vertices in OpenGL ES with gl_PointSize 0 Answers
Oculus rendeing bug 0 Answers
Depth Rendering Issue 0 Answers