Home >> Python >> Panda3D Texture and Material
from direct.showbase.ShowBase import ShowBase from direct.showbase.Loader import Loader from panda3d.core import * base = ShowBase( ) loader = Loader( base ) model = loader.loadModel( "cube.dae" ) tex = loader.loadTexture( "ABCD.jpg" ) model.setTexGen( TextureStage.getDefault( ), TexGenAttrib.MWorldPosition ) model.setTexture( tex ) model.setPos( 0, 10, -1 ) model.setHpr( -90, 0, 0 ) model.setScale( 2 ) model.reparentTo( render ) base.run( )
model.setTexTransform(TextureStage.getDefault(), \ TransformState.makePosHprScale(VBase3(0,0,0),VBase3(0, 90, 180),VBase3(-1,1,1)))
from pandac.PandaModules import Material from pandac.PandaModules import VBase4 #VBase4 has to be imported in order to set colors in the methods myMaterial = Material() myMaterial.setShininess(5.0) #Make this material shiny myMaterial.setAmbient(VBase4(0,0,1,1)) #Make this material blue myNode = loader.loadModel("cube.dae") #Load the model to apply the material to myNode.setMaterial(myMaterial) #Apply the material to this nodePath
material.setAmbient(VBase4(R,G,B,A)) # 全体色 material.setDiffuse(VBase4(R,G,B,A)) # 反射色 material.setEmission(VBase4(R,G,B,A)) # グロー(自己発光)色 material.setShininess(実数値) # specularのサイズ material.setSpecular(VBase4(R,G,B,A)) # ハイライト色
Panda 3d Affine Transform | Python | Python 3d Lighting/Camera |