I’ve noticed that lighting in DirectX mode can be very different than in OpenGL mode, sometimes drastically, depending on exactly how you have things setup.
As an example, here’s a teapot with specular highlights in OpenGL:
and in DirectX 9:
Here’s the code:
import direct.directbase.DirectStart
from direct.showbase.ShowBaseGlobal import *
class World( DirectObject.DirectObject ):
def __init__( self ):
base.mouseInterfaceNode.setPos( 0, 10, -2 )
base.setBackgroundColor( Vec4( 0 ) )
self.accept( "f9", base.screenshot )
self.teapot = loader.loadModelCopy( "teapot" )
self.teapotMaterial = Material()
self.teapotMaterial.setSpecular( VBase4( 1, 1, 1, 1 ) )
self.teapotMaterial.setShininess( 30.0 )
self.teapot.setMaterial( self.teapotMaterial )
self.teapot.reparentTo( render )
self.ambientLight = AmbientLight( "ambientLight" )
self.ambientLight.setColor( Vec4( 0.2, 0.2, 0.2, 1.0 ) )
self.ambientLightNodePath = render.attachNewNode( self.ambientLight.upcastToPandaNode() )
self.directionalLight = DirectionalLight( "directionalLight" )
self.directionalLight.setColor( Vec4( 0.7, 0.7, 0.7, 1 ) )
self.directionalLightNodePath = render.attachNewNode( self.directionalLight.upcastToPandaNode() )
self.directionalLightNodePath.setHpr( -40, -50, 0 )
render.setLight( self.ambientLightNodePath )
render.setLight( self.directionalLightNodePath )
world = World()
run()
Specular highlights are perhaps a bit esoteric, but I’ve also seen differences in the way particles and CardMaker geometry is rendered (see here also).
Are these differences known and considered bugs? Are there any known workarounds?