#X3D V3.0 utf8 PROFILE Interchange COMPONENT Texturing:2 COMPONENT Text:1 # Test of MultiTexture.mode values "BLENDxxx" PROTO MyText [ initializeOnly MFString string "" ] { Transform { translation 0.6 0.2 0 children Shape { appearance Appearance { material Material { diffuseColor 1 1 0 } } geometry Text { string IS string fontStyle FontStyle { size 0.2 } } } } } Transform { translation 0 0 0 children [ Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/squirrel.png" } ImageTexture { url "data/pattern.png" } ] mode [ "REPLACE" "BLENDDIFFUSEALPHA" ] } material Material { transparency 0.5 } } geometry DEF MyQuad IndexedFaceSet { coord Coordinate { point [ -0.5 -0.5 0, 0.5 -0.5 0, 0.5 0.5 0, -0.5 0.5 0 ] } coordIndex [ 0 1 2 3 ] texCoord TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1, 0 0, 1 0, 1 1, 0 1, ] } solid FALSE } } MyText { string [ "BLENDDIFFUSEALPHA" "Blends 2 textures using Material.transparency." "In this case: 0.5 * squirrel + 0.5 * pattern" ] } ] } Transform { translation 0 -1.1 0 children [ Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/squirrel.png" } ImageTexture { url "data/pattern.png" } ] mode [ "REPLACE" "BLENDTEXTUREALPHA" ] } material Material { } } geometry USE MyQuad } MyText { string [ "BLENDTEXTUREALPHA" "Blends 2 textures using current texture alpha." "In this case: should be equal to just pattern texture" "(as it is opaque, alpha = 1 everywhere)" ] } ] } Transform { translation 0 -2.2 0 children [ Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/squirrel.png" } ImageTexture { url "data/pattern.png" } ] mode [ "REPLACE" "BLENDFACTORALPHA" ] alpha 0.2 } material Material { } } geometry USE MyQuad } MyText { string [ "BLENDFACTORALPHA" "Blends 2 textures using MultiTexture.alpha." "In this case: 0.2 * pattern + 0.8 * squirrel" ] } ] } Transform { translation 0 -3.3 0 children [ Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/squirrel.png" } ImageTexture { url "data/pattern.png" } ] mode [ "REPLACE" "BLENDCURRENTALPHA" ] } material Material { } } geometry USE MyQuad } MyText { string [ "BLENDCURRENTALPHA" "Blends 2 textures using previous texture alpha." "(Yes, the name is misleading, better name would be BLENDPREVIOUSALPHA.)" "In this case: should be equal to just pattern texture" "(as squirrel texture is opaque, alpha = 1 everywhere)" ] } ] } # Viewpoint ------------------------------------------------------------------ # Camera settings "encoded" in the VRML/X3D declaration below : # direction 0 0 -1 # up 0 1 0 # gravityUp 0 1 0 Viewpoint { position 2.690000057220459 -1.7133332490921021 7.204444408416748 orientation 0 0 1 0 }