import direct.directbase.DirectStart
from pandac.PandaModules import *

egg = loader.loadModel("jj")
egg.reparentTo(render)
egg.setScale(3.0,3.0,3.0)
egg.setPos(0,10,-7)

base.trackball.node().setPos(0, 100, 10)

#light setting
ambientLight = AmbientLight( 'ambientLight' )
ambientLight.setColor( Vec4( 0.5, 0.7, 0.1, 1 ) )
ambientLightNP = render.attachNewNode( ambientLight.upcastToPandaNode() )
render.setLight(ambientLightNP)

directionalLight = DirectionalLight( "directionalLight" )
directionalLight.setColor( Vec4( 1.0, 1.0, .5, 1 ) )
directionalLightNP = render.attachNewNode( directionalLight.upcastToPandaNode() )
# This light is facing backwards, towards the camera.
directionalLightNP.setHpr(-90, -50,50)
render.setLight(directionalLightNP)

directionalLight = DirectionalLight( "directionalLight" )
directionalLight.setColor( Vec4( 0.0, 1.0, 0.0, 1 ) )
directionalLightNP = render.attachNewNode( directionalLight.upcastToPandaNode() )
# This light is facing forwards, away from the camera.
directionalLightNP.setHpr(0, -20, 0)
render.setLight(directionalLightNP)

run()

사용자 삽입 이미지

Posted by Real_G