- Home /
How can I write a custom cutout diffuse shader that supports custom vertex colors?
I'm currently writing a voxel engine to get some practice in, and it's been going well so far, with the exception of one thing. In order to do lighting that fits the voxel engine and feels better aesthetically, I need to be able to set the color values of individual vertices when I'm generating a voxel mesh. Unfortunately, none of the default Unity shaders (even some of the legacy ones) seem to support the coloring of vertices when generating a mesh from code. I'm currently using the "Legacy/Cutout Diffuse", but I'm not sure how to modify it so that it supports custom vertex coloring. Is this even possible?
Answer by tanoshimi · May 24, 2016 at 06:17 AM
Of course - vertex colours of a mesh are passed in the input struct to a vertex shader using the COLOR semantic, as described at http://docs.unity3d.com/Manual/SL-VertexProgramInputs.html
Your answer
Follow this Question
Related Questions
Custom shader light blending 0 Answers
Lighting problem 0 Answers
URP 2D lights with Mesh Renderer?,URP 2D Light for Mesh Renderer? 0 Answers
Odd shadow effect, help! 1 Answer