Map Your Texture
Node
TextureCoordinate • Attributes
Description
A logo that has been mapped to a square IndexedFaceSet node using a TextureCoordinate and a six-sided polygon using a TextureCoordinateGenerator in "COORD-EYE" mode.
VRIGNETTE Notes
As you create more and more complex shapes, mapping textures becomes a job for applications such as Blender.
Other Nodes
TextureTransform, TextureCoordinateGenerator, ImageTexture
Example
Rotate the vrignette to view the geometry.
Code
<x3d> <scene> <!-- World Info --> <worldInfo title="X3D TextureCoordinate Example"> </worldInfo> <!-- Navigation Info --> <navigationInfo headlight="true"> </navigationInfo> <!-- Avatar Viewpoint --> <viewpoint position="0.0 5.0 30.0" centerOfRotation="0.0 0.0 0.0"> </viewpoint> <!-- Shapes --> <transform translation="-3.0 10.0 -3.0"> <shape> <appearance> <material diffuseColor="0.0 0.0 0.75" specularColor="0.20 0.20 0.20" shininess="0.15"> </material> <imageTexture url="logo.jpeg" repeatS="false" repeatT="true"> </imageTexture> <textureTransform translation="0.10 0.40"> </textureTransform> </appearance> <indexedFaceSet solid="false" coordIndex="0 1 2 3 4 5 0"> <coordinate point="-5.0 5.0 0.0, -7.5 2.5 0.0, -5.0 0.0 0.0, 5.0 0.0 0.0, 7.5 2.5 0.0, 5.0 5.0 0.0"> </coordinate> <textureCoordinateGenerator mode="COORD-EYE"> </textureCoordinateGenerator> </indexedFaceSet> </shape> </transform> <transform translation="3.0 -3.0 3.0"> <shape> <appearance> <material diffuseColor="0.0 0.0 0.75" specularColor="0.20 0.20 0.20" shininess="0.15"> </material> <imageTexture url="logo.jpeg" repeatS="false" repeatT="false"> </imageTexture> </appearance> <indexedFaceSet solid="false" coordIndex="0 1 2 3 0"> <coordinate point="-5.0 0.0 0.0, 5.0 0.0 0.0, 5.0 10.0 0.0, -5.0 10.0 0.0"> </coordinate> <textureCoordinate point="0.0 0.0, 1.0 0.0, 1.0 1.0, 0.0 1.0, 0.0 0.0"> </textureCoordinate> </indexedFaceSet> </shape> </transform> <!-- Scene Background --> <background skyColor="0.20 0.20 0.20" groundColor="0.20 0.20 0.20"> </background> </scene> </x3d>