Odd color handling for cardmaker object?

I have a puzzling situation in which two objects have had the same color set, but the colors display differently. See the attached image. The larger orange area is the room’s floor, which is a cardmaker object. The smaller and brighter orange area is a flattened box which I’ve generate using the vertexdata methods. Both have had the same color set. Neither one reports possessing any Material attributes. Both are flat objects, oriented with the XZ plane. But they show differently if I use any lighting other than ambient, with the cardmaker object being consistently darker. I can’t seem to get the cardmaker plane to match the color of the other object.

The vertexdata geometry had vertex colors set when it was built. Would that make a difference, in this case? I am as yet unfamiliar with how such things handle in Panda. :question:

(Editing to note that I meant “XY plane”, above. These objects are on the ground, as it were, facing upward. Panda’s Z-up coordinate system keeps confusing me. :blush: )

There is lighting present, isn’t there? If so, perhaps it could be in the normal vectors? Does one perhaps have normals pointing in a slightly different direction, or perhaps the normals are simply longer?
If no normals are present at all for one model, then that would be the issue - lighting is calculated based on the normal vector, so having no normals means you won’t get shading on that model.

If you don’t figure it out based on that, you could render.writeBamFile(“scene.bam”) and upload that .bam file and I might be able to take a look.

There is lighting, yes. In this case, a point light and an ambient light. The point light seems to provoke the oddities.

I assume a cardmaker object is created with normals of length 1.0 which are perpendicular to the plane of the card. I’m pretty sure that’s what I’m creating, too. The process I’m using to build the lighter-colored box (and the rest of the geometry) is still pretty much what I’ve posted before. To the +Z-facing polygons, I am assigning a normal of (0.0, 0.0, 1.0). The correctness of that handling has been verified in the “complex procedural cube example” I’ve posted, which uses a simpler version of the same process, and with which I have exported correctly-handling obj files. All logic suggests to me that there is nothing odd about the normals, but I’ll see if I can post a .bam file for you. Logic keeps getting me in trouble, with Panda. Among other things, I am easily and frequently confused by the +Z-up coordinate system. :laughing: Years of using +Y leads to certain habits, you know. :laughing:

I’ve been thinking more that the problem lies somehow in materials or vertex color conditions. I don’t know enough about such matters to try to track down an issue relating to them, however.

The .bam file is actually larger than the script and all its supporting files. :open_mouth: I’m attaching the script to this post. I have uploaded the (zipped) scene.bam to my website, here: http://www.morphography.uk.vu/~cagepage/2014/panda3D/Adv_P3D_5_8_14/scene.zip

Thank you for any help you can give me with this. :smiley:
Adv_P3D_5_8_14.zip (246 KB)

Okay, I see what was happening. The point light was handling object depth differently than I expected. I anticipated that the point light with no attenuation set would have constant falloff and thus display the same brightness for lit surfaces which face the same way. Not so, apparently. Switching to a directional light removes the oddity, as shown in the attached image. There’s a very slight offset between the two planes in question, with the larger cardmaker-floor object lying at Z = 0.0 and the smaller object’s parallel top plane lying at Z = 0.1. Apparently that small offset makes a big difference, as far as the point light is concerned. The truly constant falloff for the directional light gives me the handling I expected.

So… problem solved, I guess. :slight_smile: