Java and Irrlicht tutorial series - Effects
Irrlicht offers a number of interesting effects that can be incorporated into your 3D applications with ease. With just a few lines of code you can add bump mapping, parallax mapping, sphere mapping, wireframe and point cloud effects.
Point clouds show only the vertices of a model as single points. This effect can be achieved by calling ISceneNode.setMaterialFlag(E_MATERIAL_FLAG.EMF_POINTCLOUD, true**)**.
The wireframe effect draws the edges of triangles instead of the full triangles themselves. This effect can be used to show all the triangles in a scene as triangles that would normally be hidden can be shown through a wireframe. This effect can be achieved by calling ISceneNode.setMaterialFlag(E_MATERIAL_FLAG.EMF_WIREFRAME, true**)****.**
Sphere mapping is a way to quickly render what looks like a reflective surface onto a model. Rendering a true reflection is still too computationally expensive for today’s hardware, but a sphere map is a reasonable approximation of what a reflection would look like, and can be rendered quickly. This effect can be achieved by calling ISceneNode.setMaterialType(E_MATERIAL_TYPE.EMT_SPHERE_MAP).
Normal mapping is used to give a texture the appearance of depth. As a light moves shadows appear to move across the surface of the object. This effect is used to give a low polygon model the appearance of having more detail than it does. This effect requires that the model have two textures assigned to it: the first being the normal color map, and the second being the normal map. You create a normal map by calling the IVideoDriver makeNormalMapTexture function. You then need to set the material flag with a call to ISceneNode.setMaterialType(E_MATERIAL_TYPE.EMT_NORMAL_MAP_SOLID).
Parallax mapping is an enhancement of the normal mapping technique. Like normal mapping it gives a low polygon model the appearance of having a high level of detail. Like the normal map, parallax mapping requires two textures with the first is the color map, the second being the normal map. The martial flag then needs to be set with a call to ISceneNode.setMaterialType(E_MATERIAL_TYPE.EMT_PARALLAX_MAP_SOLID). You can also change the height of the parallax effect by calling ISceneNode.getMaterial(0).setMaterialTypeParam(parallaxHeight).
Check out the online demo here, browse the source code here, and download the source code in a TAR file here.
Away3D Lite Programming Tutorials - Materials
See the various materials that can be applied to a 3D model in Away3D Lite.
This post is part of the series: 3D on the web with Java and Irrlicht
Learn how to use the Irrlicht 3D engine with Java to deliver 3D application via the web.
- 3D on the web with Java and Irrlicht - Getting Started
- 3D on the web with Java and Irrlicht - Lighting
- 3D on the web with Java and Irrlicht - Displaying 2D textures
- 3D on the web with Java and Irrlicht - Keyboard Input
- 3D on the web with Java and Irrlicht - 2D Collision Detection
- 3D on the web with Java and Irrlicht - Effects