Can I download a basic mesh sample to test this? I can't find any online (meshlab's obj with vertex color data that is). I have a importer script but can't test if that works without that.
When I imported the .obj file after adding ObjFileFormatVertexColorImporter.cs , I got the following error. What's the problem? "Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array" here is my data, can you help me? https://drive.google.com/file/d/1hU41Z4m_Q5zgAriEsgj-YEhjpUB6JKJr/view?usp=sharing Thank you for reading it.
1. OBJ file format specification does not support vertex color
This is why it’s not supported by default in most applications, Unity included. People need to write their own extensions for that to change and here is one of those:
Add this ObjFileFormatVertexColorImporter.cs to your project and it will start importing vertex color data for every .obj file on next reimport (Right click>Reimport).
2. Shader
Importing vertex color data is one thing but seeing it is another. For that to happen you need a material that uses a shader created to visualize this vertex color data in some way (final color, surface color tint, etc.).
If your project supports Shader-Graph then creating such shader is very straight forward:
Thanks for sharing that test mesh. I looked into it and made sure it imports fine now.
I finally achieved the exact results I wanted by trying the code you provided. I am immensely grateful for your assistance. Thank you for your time i really appreciate it!!!
Can I download a basic mesh sample to test this? I can't find any online (meshlab's obj with vertex color data that is). I have a importer script but can't test if that works without that.
– andrew-lukasikWhen I imported the .obj file after adding ObjFileFormatVertexColorImporter.cs , I got the following error. What's the problem? "Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array" here is my data, can you help me? https://drive.google.com/file/d/1hU41Z4m_Q5zgAriEsgj-YEhjpUB6JKJr/view?usp=sharing Thank you for reading it.
– scn03170Thanks for sharing that mesh @scn03170 ! I think I know what is wrong and will fix it soon. Will let you know.
– andrew-lukasik