Archive 17/01/2023.

Change Vertex Color at runtime

josuemnb

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.

Dave82

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.

josuemnb

Thanks.
i’ll try it
:smiley:

josuemnb

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

Modanung

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" />
josuemnb

thanks for your help.