Shading in Panda3d

Above are top and side view of Dome 3D model with point light source and auto shader.

As per my understanding it is not producing expected output, because light should not illuminate inner surface and here it is being illuminated.

If anyone has any idea how to apply Phong and Gouraud Shading instead of auto shader in Panda3D.

Also I want to know how can I obtain result of shading as if light source like ‘SUN’ is illuminating my model.


If you didn’t do anything with backface culling or winding orde

then I think your model is double sided. You might need to fix it in your modeling software and export again.

Phong shading is what you get when you enable the auto shader, Gouraud is what you get with the shader generator off (this is often referred to as per pixel or per vertex shading or fixed function pipeline for the latter). You can also write your own shaders.

Thank you for replying.

I have taken this model is from PANDA3D models itself.

Please tell me how to write my own shader file (.sha) for Phong and Gouraud shading.
Because I am neither getting Phong Shading effect by auto shader nor getting Gouraud Shading by turning shader generator off.

Yeah, the problem is not with the shader, but with the model. It does not have the normals you expect. Try with a different model and see if you get the same unexpected results.

If you want phong shading without the shader generator, you will have to create a GLSL shader. Here is a sample program showing a GLSL shader that performs shading and shadowing.

Thankyou for replying.
I will try out glsl shading.