Shader problem

I got a problem with shader,
i tried to modify the nvidia nature démo on the code snipplet section,
with a map of mine, it works fine on my laptot computer, i got the same result as the demo, but on all the other pc’s i tried, with the same code, the same file, the ground is black, but when i try with the map on the nvidia nature demo, then it works fine.
I don’t really understand why it work on my laptot and not on any other pc’s.
here are some screenshot for show you what i said :
On my laptot :

On other pc’s :

If I got you right then you have written code including Python and shader files, and this code runs well on your laptop, and it doesn’t run well on your PC (or PC’s).

Not much info to work with. Let’s exclude some basics first:

  • perhaps some resources (textures for grass, dirt or whatever, or shaders files) are not found on your PC. Are the (relative/absolute) path of ALL required resources the same on your laptop and PC?

  • perhaps, though unlikely, your PC simply doesn’t support the shader features you want to use. Have you checked this? How did you checked?

More information is required. Do you get any warnings perhaps? If not, do you have debug out turned off?

Hi, thanks for your reply, yes you undestand my problem.

  • I have no warning and no errors, on my pc, and i get all the ressources needed, (same .rar), my pc support shader i tryed on a pc that doesn’t support shader and on it, the ground il all with the grass texture, then it can’t be a shader problem.
    The most strange is with the map of the nvidia nature demo, it works fine on my pc…

Slowly getting better at understanding you. I think I missed some of your info:

  • if you use the terrain mesh from the Nvidia demo (‘terrain.bam’) then your code works on all computers, laptop and other PC’s.
  • if you use a self-made mesh for the terrain then it works on your laptop, but not on other PC’s

This is strange. If something was missing in your self-made mesh (e.g. vertex normals or UV’s which are required by the simple terrain shader that comes with the demo) then it shouldn’t work on all computers and not just on a few.

Perhaps someone else can help If not you have to narrow down the problem.

On my self-made mesh, i mish vertex normal ,because i don’t know how calculate that, but if it’s the case why the demo work on my laptot and not on other pc’s ? I really don’t understand…

The terrain shader uses normals for lighting calculation. No normal means the dot-product with normal is zero, and so the terrain will be black.

I don’t understand why it still works on your laptop. But why don’t you go on and try to find out more:

  • You use Panda3D code to generate your egg files? Then have a look at the API-reference, there you will find how to compute vertex normals.

  • You use a modeler to create your terrain? certainly there is some documentation for it. Or try to ask “how do I make vertex normals with XYZ?”

  • Remove the lighting code from the shader, and see what happens. Still getting black terrain? Then it must be something else.


Ok i’ll try to add normals, bu how can i calculate normals for each vertex ?
Wha’ts the equation ^^

For a given vertex find all faces which touch this vertex. For each face compute a face normal, which is the (normalized) cross product of any two edges. Finally sum up all face normals. Oh, and don’t forget to normalize.

But this is not what I have suggested. If you create the mesh yourself have a look at the API documentation. There you will find this:

If you use a modeler, then I suggest to use the modeler to create vertex normals. I don’t know if or what modeler you use, so I can’t give advice here, obviously.


I use a python code, found on htis forum , i already modified it for add u,v coordinate and i can add normal without problems, just need to understand how calculate it ^^
Thanks for your help.

If you want to compute the vertex normals yourself, then here is how to compute them:

Sorry my bad English. Not my native language. The wikipedia page say about the same, with other words if mine are hard to understand.

But you don’t need to compute them yourself. Panda3D can do for you. If your use the EGG API then look at my previous post. You will see a method that computes vertex normals for you. I have used this method to create the vertex normal in the Nvidia nature demo terrain for example.


Ok thx,
i have generate my maps with 3ds studio max and there are no more problems ^^
Thanks for your help.