#X3D V3.0 utf8 PROFILE Interchange COMPONENT Texturing:2 COMPONENT Text:1 # This tests various values for MultiTexture.mode and MultiTexture.source. # # Every test applies two textures on a simple quad: pattern.png and squirrel.png. # # The pattern.png is always modulated with primary color. # The squirrel.png is applied using various modes (for each column) # and is mixed with various sources (for each row). # # Row 1: MultiTexture.source says to mix squirrel.png # with previous unit (pattern.png). # # Row 2: MultiTexture.source says to mix squirrel.png with diffuse color. # For browsers that do lighting calculation before texturing # (this applies to all browsers using Gouraud shading) this actually # mixes squirrel.png with the lighting result (whole material + lighting summed). # # Row 3: MultiTexture.source says to mix squirrel.png with constant yellow color. # When rotating the model, you will notice that "row 3" colors stay constant, # while the colors of other rows are affected by the lighting from # the default headlight (so they get darker when viewer from the side). PROTO MyText [ initializeOnly MFString string "" ] { Transform { translation 0 1.5 0 children Shape { appearance Appearance { material Material { diffuseColor 1 1 0 } } geometry Text { string IS string fontStyle FontStyle { size 0.15 } } } } } # ---------------------------------------------------------------------------- # Row 0: column captions. Transform { translation 0 -0.25 0 children [ Transform { translation 0 0 0 children MyText { string [ "modulate" ] } } Transform { translation 1.5 0 0 children MyText { string [ "add 2nd tex" ] } } Transform { translation 3 0 0 children MyText { string [ "replace 2nd tex" ] } } Transform { translation 4.5 0 0 children MyText { string [ "subtract" ] } } Transform { translation 6 0 0 children MyText { string [ "modulate 2x" ] } } Transform { translation 7.5 0 0 children MyText { string [ "modulate 4x" ] } } Transform { translation 9 0 0 children MyText { string [ "add signed" ] } } Transform { translation 10.5 0 0 children MyText { string [ "add signed 2x" ] } } Transform { translation 12 0 0 children MyText { string [ "select arg1" ] } } Transform { translation 13.5 0 0 children MyText { string [ "select arg2" ] } } Transform { translation 15 0 0 children MyText { string [ "off 2nd tex" ] } } ] } # ---------------------------------------------------------------------------- # Row 1: MultiTexture.source says to mix squirrel.png # with previous unit (pattern.png). Transform { translation 0 0 0 children [ Transform { translation -1.5 -1 0 children MyText { string [ "pattern texture" "mixed with" "squirrel texture" ] } } Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 1.5 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADD" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 3 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "REPLACE" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 4.5 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SUBTRACT" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 6 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "MODULATE2X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 7.5 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "MODULATE4X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 9 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADDSIGNED" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 10.5 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADDSIGNED2X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 12 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SELECTARG1" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 13.5 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SELECTARG2" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 15 0 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "OFF" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } # ---------------------------------------------------------------------------- # Row 2: MultiTexture.source says to mix squirrel.png with diffuse color. Transform { translation 0 -2 0 children [ Transform { translation -1.5 -1 0 children MyText { string [ "material diffuse" "mixed with" "squirrel texture" ] } } Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 1.5 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADD" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 3 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "REPLACE" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 4.5 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SUBTRACT" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 6 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "MODULATE2X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 7.5 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "MODULATE4X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 9 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADDSIGNED" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 10.5 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADDSIGNED2X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 12 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SELECTARG1" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 13.5 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SELECTARG2" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 15 -2 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "OFF" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "DIFFUSE" ] } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } # ---------------------------------------------------------------------------- # Row 3: MultiTexture.source says to mix squirrel.png with constant yellow color. Transform { translation 0 -4 0 children [ Transform { translation -1.5 -1 0 children MyText { string [ "constant yellow" "mixed with" "squirrel texture" ] } } Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 1.5 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADD" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 3 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "REPLACE" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 4.5 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SUBTRACT" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 6 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "MODULATE2X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 7.5 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "MODULATE4X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 9 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADDSIGNED" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 10.5 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "ADDSIGNED2X" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 12 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SELECTARG1" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 13.5 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "SELECTARG2" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } Transform { translation 15 -4 0 children [ Shape { appearance Appearance { texture MultiTexture { mode [ "MODULATE" "OFF" ] texture [ ImageTexture { url "data/pattern.png" } ImageTexture { url "data/squirrel.png" } ] source [ "" "FACTOR" ] color 1 1 0 } material Material { } } geometry IndexedFaceSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 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 } } ] } # Viewpoint ------------------------------------------------------------------ # Camera settings "encoded" in the VRML/X3D declaration below : # direction 0 0 -1 # up 0 1 0 # gravityUp 0 1 0 Viewpoint { position 8.2433338165283203 -1.1633334159851074 16.80467414855957 orientation 0 0 1 0 }