Lets start! | -|||||||
-
-
-
- We start like in some tutorials before. Please note that this time, - the 'shadows' flag in createDevice() is set to true, for we want to - have a dynamic shadow casted from an animated character. If your this - example runs to slow, set it to false. The Irrlicht Engine checks - if your hardware doesn't support the stencil buffer, and disables - shadows by itself, but just in case the demo runs slow on your hardware. -
For our environment, we load a .3ds file. It is a small room I modelled
- with Anim8or and exported it into the 3ds format because the Irrlicht
- Engine did not support the .an8 format when I wrote this tutorial.
- I am a very bad 3d graphic artist, and so the texture mapping is not
- very nice in this model. Luckily I am a better programmer than artist,
- and so the Irrlicht Engine is able to create a cool texture mapping
- for me: Just use the mesh manipulator and create a planar texture
- mapping for the mesh. If you want to see the mapping I made with Anim8or,
- uncomment this line. I also did not figure out how to
Now, for the first special effect: Animated water. It works like - this: The WaterSurfaceSceneNode takes a mesh as input and makes it - wave like a water surface. And if we let this scene node use a nice - material like the MT_REFLECTION_2_LAYER, it looks really cool. We - are doing this with the next few lines of code. As input mesh, we - create a hill plane mesh, without hills. But any other mesh could - be used for this, you could even use the room.3ds (which would look - really strange) if you wanted to. -
The second special effect is very basic, I bet you saw it already - in some Irrlicht Engine demos: A transparent billboard combined with - a dynamic light. We simply create a light scene node, let it fly around, - an to make it look more cool, we attach a billboard scene node to - it. -
The next special effect is a lot more interesting: A particle system.
- The particle system in the Irrlicht Engine is quit modular and extensible
- and yet easy to use. There is a particle system scene node into which
- you can put particle emitters, which make particles come out of nothing.
- These emitters are quite flexible and usually have lots of parameters
- like direction, amount and color of the particles they should create. Because only with emitters particle system would be a little bit
- boring, there are particle affectors, which modify particles during
- they fly around. They can be added to the particle system, simulating
- additional effects like gravity or wind. The particle affector we
- use in this example is an affector, which modifies the color of the
- particles: It lets them fade out. Like the particle emitters, additional
- particle affectors can also be implemented by you, simply derive a
- class from IParticleAffector and add it with addAffector(). After
- we set a nice material to the particle system, we have a cool looking
- camp fire. By adjusting material, texture, particle emitter and affector
- parameters, it is also easily possible to create smoke, rain, explosions,
- snow, and so on.
As our last special effect, we want a dynamic shadow be casted from
- an animated character. For this we load a DirectX .x model and place
- it into our world. For creating the shadow, we simply need to call addShadowVolumeSceneNode().
- The color of shadows is only adjustable globally for all shadows, by
- calling ISceneManager::setShadowColor(). Voila, here is our dynamic
- shadow.
Finally we simply have to draw everything, that's all. -
- - - |
-
- - + + +
Lets start! | +|||||||
+
+
+
+ We start like in some tutorials before. Please note that this time, + the 'shadows' flag in createDevice() is set to true, for we want to + have a dynamic shadow casted from an animated character. If your this + example runs to slow, set it to false. The Irrlicht Engine checks + if your hardware doesn't support the stencil buffer, and disables + shadows by itself, but just in case the demo runs slow on your hardware. +
For our environment, we load a .3ds file. It is a small room I modelled
+ with Anim8or and exported it into the 3ds format because the Irrlicht
+ Engine did not support the .an8 format when I wrote this tutorial.
+ I am a very bad 3d graphic artist, and so the texture mapping is not
+ very nice in this model. Luckily I am a better programmer than artist,
+ and so the Irrlicht Engine is able to create a cool texture mapping
+ for me: Just use the mesh manipulator and create a planar texture
+ mapping for the mesh. If you want to see the mapping I made with Anim8or,
+ uncomment this line. I also did not figure out how to
Now, for the first special effect: Animated water. It works like + this: The WaterSurfaceSceneNode takes a mesh as input and makes it + wave like a water surface. And if we let this scene node use a nice + material like the MT_REFLECTION_2_LAYER, it looks really cool. We + are doing this with the next few lines of code. As input mesh, we + create a hill plane mesh, without hills. But any other mesh could + be used for this, you could even use the room.3ds (which would look + really strange) if you wanted to. +
The second special effect is very basic, I bet you saw it already + in some Irrlicht Engine demos: A transparent billboard combined with + a dynamic light. We simply create a light scene node, let it fly around, + an to make it look more cool, we attach a billboard scene node to + it. +
The next special effect is a lot more interesting: A particle system.
+ The particle system in the Irrlicht Engine is quit modular and extensible
+ and yet easy to use. There is a particle system scene node into which
+ you can put particle emitters, which make particles come out of nothing.
+ These emitters are quite flexible and usually have lots of parameters
+ like direction, amount and color of the particles they should create. Because only with emitters particle system would be a little bit
+ boring, there are particle affectors, which modify particles during
+ they fly around. They can be added to the particle system, simulating
+ additional effects like gravity or wind. The particle affector we
+ use in this example is an affector, which modifies the color of the
+ particles: It lets them fade out. Like the particle emitters, additional
+ particle affectors can also be implemented by you, simply derive a
+ class from IParticleAffector and add it with addAffector(). After
+ we set a nice material to the particle system, we have a cool looking
+ camp fire. By adjusting material, texture, particle emitter and affector
+ parameters, it is also easily possible to create smoke, rain, explosions,
+ snow, and so on.
As our last special effect, we want a dynamic shadow be casted from
+ an animated character. For this we load a DirectX .x model and place
+ it into our world. For creating the shadow, we simply need to call addShadowVolumeSceneNode().
+ The color of shadows is only adjustable globally for all shadows, by
+ calling ISceneManager::setShadowColor(). Voila, here is our dynamic
+ shadow.
Finally we simply have to draw everything, that's all. +
+ + + |
+
+ + -- cgit v1.1