Change Vertex Color at runtime

good day.
I’m using PositionNormalColor to load a model with technique ‘NoTextureVCol’.
i’m trying to change the vertex colors, but that is not possible through SetShaderParameter since the material is the same for all colored vertexes even when them have different colors.
How could this be overcome?

Thanks in advance.

You need to lock your vertex buffer , then apply changes to vertex color in your vertex data and then unlock it. See example 34 for how dynamic vertex buffers work.

1 Like

Thanks.
i’ll try it
:smiley:

It worked.
thanks.
Just another thing.
How can i alter the alpha when NoTextureVCol is applied?

I think you may have to create a custom technique for that purpose by adding an alpha pass to the NoTextureVCol technique, turning it into NoTextureVColAlpha:

<pass name="alpha" depthwrite="false" blend="alpha" />