## 3D on the web with Java and Irrlicht - Effects

written by: Matthew Caspersonโขedited by: Linda Richterโขupdated: 10/5/2009

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.

• slide 1 of 8

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.

• slide 2 of 8

### Point Cloud

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).

• slide 3 of 8

### Wireframe

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).

• slide 4 of 8

### Sphere Map

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).

• slide 5 of 8

### Normal 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).

• slide 6 of 8

### Parallax Map

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).

• slide 7 of 8

Check out the online demo here, browse the source code here, and download the source code in a TAR file here.

• slide 8 of 8

### Related Article

Away3D Lite Programming Tutorials - Materials

See the various materials that can be applied to a 3D model in Away3D Lite.

#### 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.