I conducted a test with the software creation of texture modes based on the post @Thaumaturge
https://discourse.panda3d.org/t/simplepbr-no-normals-or-emission
And I found out that it does not work as expected. I repeated the values from the Egg file.
Modified. pbrTest.egg (6.5 KB)
from direct.showbase.ShowBase import ShowBase
from panda3d.core import PandaNode, NodePath, DirectionalLight, TextureStage, SamplerState, Texture
import simplepbr
class Game(ShowBase):
def __init__(self):
ShowBase.__init__(self)
simplepbr.init(use_normal_maps=True)
self.accept("escape", base.userExit)
self.updateTask = taskMgr.add(self.update, "update")
self.model = loader.loadModel("pbrTest")
self.model.reparentTo(render)
tex0 = loader.loadTexture("tex/colour.png")
tex0.setMagfilter(SamplerState.FT_linear_mipmap_linear)
tex0.setMinfilter(SamplerState.FT_linear_mipmap_linear)
tex0.setWrapU(Texture.WM_repeat)
tex0.setWrapV(Texture.WM_repeat)
colour = TextureStage('colour')
colour.setMode(TextureStage.MModulate)
self.model.setTexture(colour, tex0)
tex1 = loader.loadTexture("tex/normals.png")
tex1.setMagfilter(SamplerState.FT_linear_mipmap_linear)
tex1.setMinfilter(SamplerState.FT_linear_mipmap_linear)
tex1.setWrapU(Texture.WM_repeat)
tex1.setWrapV(Texture.WM_repeat)
normals = TextureStage('normals')
normals.setMode(TextureStage.MNormal)
self.model.setTexture(normals, tex1)
tex2 = loader.loadTexture("tex/metalRoughness.png")
tex2.setMagfilter(SamplerState.FT_linear_mipmap_linear)
tex2.setMinfilter(SamplerState.FT_linear_mipmap_linear)
tex2.setWrapU(Texture.WM_repeat)
tex2.setWrapV(Texture.WM_repeat)
metalRoughness = TextureStage('metalRoughness')
metalRoughness.setMode(TextureStage.MSelector)
self.model.setTexture(metalRoughness, tex2)
tex3 = loader.loadTexture("tex/emission.png")
tex3.setMagfilter(SamplerState.FT_linear_mipmap_linear)
tex3.setMinfilter(SamplerState.FT_linear_mipmap_linear)
tex3.setWrapU(Texture.WM_repeat)
tex3.setWrapV(Texture.WM_repeat)
emission = TextureStage('emission')
emission.setMode(TextureStage.MEmission)
self.model.setTexture(emission, tex3)
light = DirectionalLight("mew")
light.setColor((1, 1, 1, 1))
lightNP = render.attachNewNode(light)
lightNP.setHpr(5, -5, 0)
render.setLight(lightNP)
def update(self, task):
dt = globalClock.getDt()
self.model.setH(self.model, dt*17)
return task.cont
app = Game()
app.run()
result:
Maybe I missed something. Also, for GeoMipTerrain
, you will need to take care of tangents.