Build X3d Graphics With Textures

Using 2D image textures mapped to 3D geometries brings greater realism to 3D graphics. X3D has five node types, which allows for basic texture mapping: Background, ImageTexture, MovieTexture, MultiTexture, and PixelTexture in the core profile. Advance texture mapping components are supported in the advanced X3D profiles such as 3D textures, Multi-Texturing, Image Shaders, and Cube mapping.


1. Decide what piece of geometry is going to have the 2D texture applied in the X3D scene and add an Appearance tag as a child in the scene. The Appearance node should have a DEF name applied in order to allow repeatability throughout the X3D scene. In the example scene, the shape that will have the defined Appearance node applied to it will be a box.

2. Add a Material node as a child of the Appearance node from Step 1. The diffuse value of the Material node should be modified in the event the ImageTexture fails to load on the client web browser, preventing the default color of grey from being applied to the 3D geometry.

3. Add an ImageTexture node as another child to the Appearance node. The ImageTexture node requires a Uniform Resource Locator (URL) in order to access an Image to download for use in the X3D scene. Multiple URLs can be provided in order to provide for maximum redundancy in the scene, starting with file paths that may be found on the local computer first. If the image fails to load or is slow to load, the defined Material color will be displayed until the image loads. Adding multiple URLs does not slow the speed of loading the 3D world.

READ  Brand Identity Designer Salary

url=’ “../Chapter01-TechnicalOverview/earth-topo.png” “../Chapter01-TechnicalOverview/earth-topo.jpg” “../Chapter01-TechnicalOverview/earth-topo-small.gif” “” “” “” ‘/>

4. Reuse the defined Appearance node on other desired geometries in the scene. The difference in the reuse of the ImageTexture defined in Step 3 is that the USE field is employed referencing the DEF name previously defined for the node. The pattern is then reused for other geometries in the scene.

5. Reuse the ImageTexture definition for other geometries in the example scene. The first shape applies the earth-topo ImageTexture definition to a cylinder shape. The second applies the same ImageTexture to a sphere. The authors chose to apply a rotation at the Transform node of the sphere to spin the Earth to see North America.

6. View the scene in an X3D browser.