|
|
VRML Script Tutorial
Full list
VRML Interactive Tutorial
Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Appearance
Let there be Light
Materials with Colored Lights
Hierarchical Node Structures
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Interpolators
Let the Music Play
Bindable Nodes
Adding Realism to the world
Information about your world
Definition for Auxiliary Nodes
|
|
|
|
PixelTexture Node
This node specifies the location of the image to be used for texturing
the shape, as well as if the image is to be repeated vertically, or horizontally,
along each of the faces of the shape.
Three fields are present in this node:
image which defines the image using pixels.
repeatS which specifies if the image is to be repeated vertically.
repeatT which specifies if the image is to be repeated horizontally.
The first three values of the image field define the width of the
image (in pixels), the height of the image (in pixels), and the number
of bytes used for each pixel. Possible values for the number of bytes are:
1: Grayscale
2: Grayscale with alpha channel for transparency
3: RGB
4: RGB with alpha channel for transparency
All fields are optional, the default values being applied if the field
is not specified. Note: if you do not specify the image field, then
no texturing takes place.
Specifying an image pixel by pixel may seem like hard work, however
some interesting effects can be achieved with little effort. For example
see the following PixelTexture node:
PixelTexture { image 2 1 1 0 255}
Note that the color values for the PixelTexture node range from 0 to 255,
as opposed to 0 to 1 as in the VRML color model used for all the other
nodes.
This node specifies an image with two pixels wide, 1 pixel tall, the first
pixel is black, and the second is white. If this image is applied as a
texture to a face then, because the image is scaled to fit the face, a
gradient should be displayed starting from black on the left side and progressively
turning to white as the right side is reached (note: some browsers do not
yet implement this feature and instead will produce a two color image,
the left half black and the right half white).
This node can also be used to create patterns, although a pattern
editor is probably the best option for this task.
Syntax:
|
PixelTexture { |
image 0 0 0
repeatS TRUE
repeatT TRUE
|
} |
|
Note: for the example on the right the image will be repeated twice in
each direction if the values for repeatS and repeatT are
set ot TRUE. See the node TextureTransform
to see how to set the repetition rate.
|