Normal mapping

Hey again, trying to get normal mapping working- So far having little to no luck. For some reason all I get is a black screen. When I turn off the shader it seems to work again with the lights. So not sure if its the shader, its the one from the normal mapping example.

      self.ambientLight = AmbientLight( 'ambientLight' )
      self.ambientLight.setColor( Vec4( .5, .5, .5, .6 ) )
      self.ambientLightNP = render.attachNewNode(self.ambientLight)

      self.dlight = DirectionalLight('dlight')
      self.dlight.setColor(VBase4(1, 1, 1, .6))
      self.dlnp = render.attachNewNode(self.dlight)
      self.dlnp.setPos(0, 0, 25)
      self.dlnp.setHpr(0, -10, 0)

      self.environ.setShaderInput("light", self.dlnp)

Have you tried the with the bumpMapper.sha and comment out the auto shader call ? I can get it work very well.

Yes, I can to. Its just when I go and replace that model they use for mine or try to just do the code for my game, it doesnt seem to work. I know I have to be doing it wrong just not sure on witch part or if its the shader it self.

Actully I had a error once with the autoshader for my map. I’ll have to redo the code to see what that error was again. I know it had to be some sorta limitation I think.

Hmm, why not use the auto-shader to do normal mapping?

Also, if your model doesn’t work, make sure you have binormals and tangents generated for it.

How to use autoshader for normal-mapping?

If you are using a modeler like Blender, Maya or Max, use that application’s setting for normal mapping.
If you have your texture specified in the .egg file, set the “envtype” scalar to “normal” in the entry.
If it’s applied at runtime, use setMode(TextureStage.MNormal) on the texture stage (as explained here).

You also need to call setShaderAuto() on the node in question to enable the shader generator.