problem with normal map

it is my first attempt at using normal map and my texture displays in black and white in panda.

I set up two layers, normals and colors (nor and cor) for my material in blender then panda displays a colored texture.

I haven`t seen any bump effect till now…

any help?
thanks.

did you enable the autoshaders and added a light to your scene?

yes, the same code found in the sample program:

        # add a light
        self.lightpivot = lightNode.attachNewNode("lightpivot")
        self.lightpivot.setPos(0,-20,110)
        
        plight = PointLight('plight')
        plight.setColor(Vec4(1, 1, 1, 1))
        plight.setAttenuation(Vec3(0.7,0.05,0))
        
        plnp = self.lightpivot.attachNewNode(plight)
        
        self.levelModel.setLight(plnp)
        self.levelModel.setShaderInput("light", plnp)

        # add an ambient light
        alight = AmbientLight('alight')
        alight.setColor(Vec4(0.05, 0.05, 0.05, 1))
        alnp = lightNode.attachNewNode(alight)
        self.levelModel.setLight(alnp)
        
        self.levelModel.setShaderAuto()

I’m using Blender 2.49 Chicken Exporter version R91 and Python 2.6.6

I assume you added tangents and binormals to your model?

David

The Chicken Exporter has two options enabled by default ‘Tangents & Binormals’ and ‘Force Relative Tex’.

I believe it added tangents & binormals, is it possible that the script is not working?

Well, there are three different pieces involved here:
(1) the Python code
(2) the model
(3) the texture

Try swapping out each one of these, one at a time, with the same piece from the sample program, to see if you can narrow down which one is causing the problem. That might help you gain some insight.

David

Setting Nor in one place is not enough. You have to set it as a normal map in another place too…

In Blender: go into Texture Buttons (F6). Select your normal map texture. Find the Map Image area. In there, around the middle of it, you’ll find a button that says “Normal Map” and has a drop down list aside of it. Enable the “normal map” button and select “Tangent” from the list. That should do the trick.

The need to enable this is not documented well enough in the Chicken manual.

I did it, but panda still displays a colored texture. I used a script in Gimp to generate the normal map, I will try another settings and I will report any results. But I believe it is a blender settings issue. May I have to deselect any button?

I found using Blender for bump mapping a pain. There’s a free program called SSbump Generator; just run a search on it.

SSbump Generator is perfect if you know how to use it and it can be tricky to use because the tutorials on using it are not that well done; but the program is dirt easy to use once you know how.

The program lets your create a Normal Map and Height Map of your texture. Panda Manual shows code for using both Normal and Height Maps together and you want to do that.

The key is the textures. When I first used SSbump Generator, I was using the program wrong and my bump mapping came out bad all the time. I just recently learned how to do it right a couple of months ago.

When I saw true bump mapping for the first time, with my mountain ranges…I was like “OMG, Wow!” I’ve learned that too much Height in the bump mapping will make some textures look bad because the cracks in textures (example, rock) that seem to have depth will appear too big.

Everything turned out to look like a million bucks for me once I got a feel for how much bump mapping should be applied to what kind of texture; and it only takes a couple of minutes to generate your textures…being that most of that generation time will be you adjusting the settings to your liking.

:wink:

I don’t think the problem here is making a normal map. It’s rather applying the normal map so it’s visible in Panda.

If nothing helps, upload the files somewhere (one click hoster) and give us a link.

Figured that…that’s why I suggested the SSbump program. You can practically take the code right from the manual after the bump and height generation and you’ll see the bump mapping in real engine time.

But I guess doing it from Blender is the preferred choice.

Good luck with it.

PheTexBM = loader.loadTexture(MYGameDIR+"data/phe/phetexturemat_n.jpg", MYGameDIR+"data/phe/phetexturemat_h.jpg");


tsgPheTexBM = TextureStage('PheTexureNH');
        tsgPheTexBM.setMode(TextureStage.MNormalHeight);
        self.PheBS.setTexture(tsgPheTexBM, PheTexBM);

You can take the code from the manual use it and assign a normal map generated in Blender, through baking, or from the color map in Gimp, SSBump, CrazyBump alike and it will also work. Always. This has nothing to do with how you create the normal map.

The issue here is to export this information (what texture to use and how) from Blender, using Chicken, into the model’s Egg file, in order to avoid setting the texture from Python which is terribly inconvenient. That way, the egg contains information about what textures to use and you can simply loader.loadModel() getting the correct material and texturing done automatically.

And assigning textures within Blender and exporting this data into Egg does work. It’s just easy to omit some required step or do something else wrong because you can get lost in Blender’s interface (which, again, isn’t that much Blender’s fault, it’s all there for a reason).

Like I texted… Good luck.