Strange Vertex color issues

I have a model, generated in code. It has vertex colors, which work correctly on my mac.

On this particular windows machine, and maybe others (brand new, latest generation Nvidia card, windows 7, updated drivers, panda 1.8), the vertex colors are rather screwy. If I render fixed function (no shaders) its fine, but if I use a shader, any value greater than 1/255 produces 1, and any lower value produces 0 for each of the color channels. I can not make any gradients: the fractional part of the color is always 0.

My GeomVertexFormat is GeomVertexFormat.getV3n3c4()

I’m loading up the colors via GeomVertexWriter.add_data4f

If I do:
This makes solid blue (0,0,1,1) for my shader (below) and the autoshader, but fixed function colors it about black like it should.

The issue looks a bit like the problem pictured here:
[url]ShaderGenerator ignores vertex colors] (It could be the same incorrect rendering problem, though the cause may differ)

I reduced my shader to this:


void vshader(
	in uniform float4x4 mat_modelproj,
	in float4 vtx_position : POSITION,
	in float4 vtx_color : COLOR,
	out float4 l_position : POSITION,
	out float4 l_vtx_color : TEXCOORD0
	l_position = mul(mat_modelproj, vtx_position);

void fshader(
	in float4 l_vtx_color : TEXCOORD0,
	out float4 o_color : COLOR

I tried setColorOff(100) and setAttrib(ColorAttrib.makeVertex(),1000) which both made no difference.

Any ideas for what could possibly cause this or what to try to fix it? I’m completely confused.

It’s rather hard in this case to extract a minimal example, but if I can’t resolve it, I’ll work on that.

I may also try it with intel drivers+gfx tomorrow.


Edit: loadPrcFileData(’’, ‘basic-shaders-only 1’) seems to fix it. I have no idea why/how, but I suspect its a panda bug. Lucky for me, I’m fine with basic shaders for this project.

I had a similar problem and solved by using something like what drwr sugested in this thread:
[Passing vertex color to a shader)