Hi there
I recently resorted to using panda3d’s internal materials, because
some material properties don’t quite export from blender.
However, the materials look grainy while other properties have no effect when applied using python e.g. setDefuse
from direct.showbase.ShowBase import ShowBase
from panda3d.core import *
from panda3d.core import Material
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.model = loader.loadModel("models/model.egg")
self.dlight = PointLight('my dlight')
self.dlight.setAttenuation((1, 1, 1))
self.dlnp = render.attachNewNode(self.dlight)
#Texturing the model
self.myMaterial = Material()
self.myMaterial.setRoughness(1.0)
self.myMaterial.setSpecular((5,2,1,0.5))
#self.myMaterial.setShininess(100.0) #Make this material shiny
#self.myMaterial.setAmbient((0.45, 0.14, 0.04, 1)) #Make this material blue
self.myMaterial.setTwoside(True)
#self.myMaterial.setDiffuse((0,0,0,1))
self.myMaterial.setEmission((350,140,70,1))
self.modelNM = loader.loadTexture("models/tex/modelNM.png")
self.modelDF = loader.loadTexture("models/tex/modelDF.png")
self.model.setMaterial(self.myMaterial,1)
self.model.setTransparency(True)
self.model.setTransparency(TransparencyAttrib.MDual)
self.model.set_two_sided(True);
self.modleNM_ts = TextureStage('ts')
self.modleNM_ts.setMode(TextureStage.MNormal)
self.model.setTexture(self.modleNM_ts,self.modelNM)
self.model.setTexture(self.modelDF)
render.setLight(self.dlnp)
self.model.setMaterial(self.myMaterial) #Apply the material to this nodePath
self.model.reparentTo(render)
render.setShaderAuto()
app = MyApp()
app.run()
.
Any ideas on what I could be doing wrong?
May someone please help.
Best regards