Hello, this is my first question on unity answers.
I am trying to create a model from script using the Mesh class, and represent each face with a separate color. I have a mesh filter, and a renderer attached to the game object. At the moment, it is a simple cube.
My problem is that I can not find out how to properly set these colors I desire. I have read about Mesh.colors and colors32, but none of the shaders will show these colors. Only the GUI/Text shader has been successful in getting close to what I’m looking for. The cube, upon creation turns grey, such as when you have an object without a material.
When I import a model as normal, Unity automatically creates as many materials as needed by the file, a unique material for each color. This would be great, if I was importing models, but I’m making procedural meshes. And even if I create several materials from code, applying them to the Cube does nothing to tell it which faces I want colored, and it only shows one of the materials anyway.
This troubles me, because I may want non-textured models to be loaded from an outside source (for example, user generated content, or a storage cache outside the unity folder), but it seems that even with a custom loader written, Unity does not expose the methods of applying these colors properly, and mostly gives support for skinned/uv models imported into the editor. This seems backwards to me, because with raw opengl, I can support solid colors easier than a texturing/uv system. However, I really enjoy Unity, and for all other aspects love it’s rendering engine, so I’d like to be able to use it for my projects instead of deploying my own engine.
Let me note, I do not want to use textures at all, I’m purposely attempting to use vertex colored models. An example of the art style would be Mario 64, or the old runescape models. In those games, the characters and some world geometry used simple vertex colors, and any texturing was solely for detail effects.
Is there any way to accomplish what I want? It may be a product of me missing a critical documentation piece, and if so, would you please point me in the right direction? Thank you in advance for reading this question.