[Solved]Normal Mapping Question

Hi Everyone,

I have a stupid newbie question. I think I’ve found a few possible ways to circumvent this problem here on the forums, but I’d really like to know if I’m just doing something wrong here.

I can run the normal mapping demo just fine (looks really awesome), whether I use the auto shader generator or use the included manual shader. I have this script:

import direct.directbase.DirectStart
from pandac.PandaModules import PointLight
from direct.task import Task
from pandac.PandaModules import VBase4
from pandac.PandaModules import TextureStage

sphere = loader.loadModel('sphere')
sphere.setPos(0, 5, 0)

sphCol = loader.loadTexture('colormap.bmp')
sphColStage = TextureStage('colstage')
sphere.setTexture(sphColStage, sphCol)

sphNrm = loader.loadTexture('layingrock-n.jpg')
sphNrmStage = TextureStage('nrmstage')
sphere.setTexture(sphNrmStage, sphNrm)

key = PointLight('key')
key.setColor(VBase4(1, 1, 1, 1))
keyPath = render.attachNewNode(key)
keyPath.setPos(5, 0, 0)


When I run it, I get this output on the console:

I get this output on all of the Panda scripts that I run.

colormap.bmp is an image I have. layingrock-n.jpg is the normal map included with the normal mapping demo.

The problem is, when I run the script, I see my model with the color map, but no noticeable bump. I tried removing the color map stage to see if it was there but I just couldn’t see it, but no dice.

As an aside, I also rendered out a grayscale noise image to use in place of a normal map. I ended up with just big splotches of black on the surface of my sphere, and the light moves through to the opposite side of the sphere.

I’m running an nVidia GeForce 8800 with the latest drivers installed.

Help! :open_mouth:



Did you generate tangents and binormals on the sphere.egg model? You can’t apply a normal map to just any model; you need to first calculate the tangents and binormals.

egg-trans -tbnall inputfile.egg -o outputfile.egg

Guess this question needs to get put in the FAQ. :slight_smile:


Wow, thanks so much for the quick reply! :smiley:

That works really well. I guess I assumed that the normal map would be fine since it was shading properly from the light. I guess that conversion command adds extra information (like tangents) that the normal mapping shader needs?

Thanks again!