The Value of "p3d_Color" Being Black

In a GLSL shader, what might cause the value of “p3d_Color” to be black in generated geometry, presuming that not explicit vertex-colours have been set (by me, at least)?

To be specific, I’m generating a few pieces of geometry, some using CardMaker and some using MeshDrawer, and I’m applying a work-in-progress shader to each. For now, the shader does little, but it does attempt to access “p3d_Color”–and alas, that input seems to always be black.

This despite my not setting any colour (that I’m aware of) on the CardMaker-generated cards, and applying various colours within the generative calls to MeshDrawer.

What might be causing this behaviour?

(I feel like I’m making some silly mistake here…)

Here’s a short program that produces the behaviour on my machine:

from direct.showbase.ShowBase import ShowBase

from panda3d.core import CardMaker, NodePath, Shader

from panda3d import __version__ as pandaVersion
print (pandaVersion)

import sys
print (sys.version)

class Game(ShowBase):
    def __init__(self):

        cardMaker = CardMaker("kitty") = NodePath(cardMaker.generate()), 4, -0.5)

        shader = Shader.make(Shader.SL_GLSL,
"""#version 130

in vec4 p3d_Vertex;

uniform mat4 p3d_ModelViewProjectionMatrix;

void main()
    gl_Position = p3d_ModelViewProjectionMatrix*p3d_Vertex;

"""#version 130

in vec2 texCoord;
in vec4 p3d_Color;

out vec4 color;

void main()
{ =;
    color.w = 1;

        self.accept("escape", base.userExit)

app = Game()

p3d_Color is a vertex input, not a fragment input.

Aaaah, that would do it, yes!

I even looked at shaders of mine that worked, searching for a difference–and I didn’t think to check what sort of shader-files the input was appearing in! ^^;

Thank you very much for the answer! :slight_smile: