In this exercise you'll start with an empty room and then add some “sparkly” special effects to make it more engaging.
beammaterial = Material() beammaterial.setDiffuse(VBase4(1,1,1,1)) beammaterial.setEmission(VBase4(1,1,1,1)) beammodel = loader.loadModel("Models/Textures/wall_door_beams.egg") beam = self.parent.attachNewNode("beam") beam.setMaterial(beammaterial) beammodel.instanceTo(beam) beam.setPos(1.55,-0.75,0.5) beam2 = self.parent.attachNewNode("beam2") beam2.setMaterial(beammaterial) beammodel.instanceTo(beam2) beam2.setPos(1.55,-0.65,0.5) beam2.setH(-10)
But note that wall_door_beams.egg doe snot exist yet! You have to create this animation from a couple of still frames in your texture folder. Go into the texture folder and run the following command egg-texture-cards -fps 2 -o wall_door_beams.egg wall_tanned_door_beams3.tif wall_tanned_door_beams4.tif. This will create a card that switches between the two given textures at the rate of 2 frames per second. If this is successful, then you should see the animated beams in the room. Experiment with the frame rate.
projector = self.parent.attachNewNode(LensNode('projector')) lens = PerspectiveLens() projector.node().setLens(lens) projector.setPos(2.55,-0.5,1.55) projector.lookAt(1.5,-0.5,0) lightimage = loader.loadTexture("Models/Textures/wall_tanned_door_light.tif") lightimage.setWrapU(Texture.WMClamp) lightimage.setWrapV(Texture.WMClamp) lightts = TextureStage('lightts') self.floors.projectTexture(lightts,lightimage,projector)
base.enableParticles() self.p = ParticleEffect() self.p.loadConfig(Filename("ar.ptf")) self.p.start(self.parent) self.p.setPos(1.6,-0.7,0.0) self.p.setHpr(0,-45,0)
This already comes with a small particle system called “ar.ptf”, make sure you see those particles in your scene. Then see if you can create a new particle system using the Panda 3D Particle Panel (it's under Samples/Particles) and insert that system instead. Can you make something that looks and behaves like flies?
render.setShaderAuto() self.filters = CommonFilters(base.win, base.cam) self.filters.setBloom(size="large")
You can play with the “size” value, which can also be “small” and “medium”. Experiment with other filters as well, such as blur. You can look up all the common filters on the Common Image Filters page in the manual.