Learn how to create fully fledged 3D applications that integrate seamlessly with a web browser using Java, WebStart and Irrlich with this comprehensive tutorial series. This tutorial shows you how to easily add some material effects to Irrlicht models.
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.