Issue with the normal map (is there a way automate binormal/tangent generation?)

so funny story, at the time of making this thread, I was already researching how apply binormal and tangent though code, and the article I was on when I made this thread turned out to have 95% of the solution how to code the light bumping effect in.

Even though this thread is solved for me, for the sake for others and curiosity’s sake I will post the code version.

from panda3d.egg import EggData, loadEggData
from panda3d.core import GlobPattern, Filename
                    egg = EggData()
                    self.scene = NodePath(loadEggData(egg))
                    self.sceneTexture = loader.loadTexture("filepath/texture.png")
                    tsnormal = TextureStage("tsnormal")
                    normal = loader.loadTexture("filepath/normalmap.png")
                    self.scene.setTexture(tsnormal, normal)

Credit is given where it’s due (for the above code).

I have also included my method of generating normal maps, that I leaned it from this youtube video

But for those having trouble with the video, I have included my blender3d file here.
normalmap.blend (530.8 KB)
Where I have done all the work in the video, all you have to do is a open (or create) a new image from UV editor window on the right, then in the tab right of of the UV editor, change the “Image Texture” bar to “Displace-Texture”.

Then scroll down the image section and from that image icon change the image to your newly loaded image, and you will see a normal map of your image, click the camera icon in the 2nd bottommost bar of the screen which will open a new window.

Then in that window hit the Image tab then save as image, from here you will need to crop and resize the image on your own to match the source image the map was based on.

1 Like