Current version: 0.45.1 | Current version: 1.30.0
| Current version: 1.55.0.0
| Current version: 0.26.0.0 |
|
|
| Current version: 1.5.4
| Current version: 0.3.0 | Current version: 0.3.0
| Current Version: 1.23.0
|
|
|
» Back To Index
The <texture> node
Function
The texture node allows to map textures (images). It is a method which makes it possible to increase
objects' realism in the 3d scene. A 2d texture is a usual image (*.bmp, *.jpg, *.png, etc...) which
is applied to the faces of the 3d objects (polygonal meshes mainly).
General syntax
<texture
name=""
filename=""
pixel_format="RGB"
filtering_mode="LINEAR"
s3tc="FALSE"
num_mipmaps="13"
anisotropy="1.0"
addressing_mode="WRAP"
function_type="MODULATE"
play_avi="TRUE"
create_opacity_map="FALSE"
create_binary_alpha_map="FALSE"
create_constant_alpha_map="FALSE"
constant_alpha_map_value="0.5"
gen_coord_mode="NONE"
type="TEXTURE_2D"
use_fbo_for_rtt="FALSE"
fbo_attachment_point="FBO_COLOR_ATTACHMENT0"
check_crc32="0"
vertical_flip="FALSE"
horizontal_flip="FALSE"
use_texture_matrix="FALSE"
perlin_noise="FALSE"
checker_pattern="FALSE" >
<cube_map
face="XPOS"
filename=""
uv_map_op="NO_SWAP" />
<perlin_noise_params
min_color_r="0.0"
min_color_g="0.0"
min_color_b="0.0"
min_color_a="1.0"
max_color_r="1.0"
max_color_g="0.0"
max_color_b="0.0"
max_color_a="1.0"
amplitude="200"
frequency="15" />
<size
width="256"
height="256" />
<spin_value
z="0.0" />
<binary_alpha_map_color
r="0.0"
g="0.0"
b="0.0"
epsilon="0.0" />
<constant_color
r="1.0"
g="1.0"
b="1.0"
a="1.0" />
<filling_color
r="0.0"
g="0.0"
b="0.0"
a="1.0" />
<inject_opacity_map
filename="" />
</texture>
texture element
texture is the xml tag that defines a texture node.
Attributes:
- name - [STR127] - name of the node. This name will make it possible to refer this node throughout
the XML script.
- filename - [STR255] - name of the texture file to be loaded. The access path is relating to the xml file.
- pixel_format - [ENUM] - pixel format (or texel):
- RGB: each pixel of the texture is coded on 3 bytes: 1 byte (1 byte) for each R, G and B component. The value of each component is clamped: [0 - 255] - default value
- BGR: each pixel of the texture is coded on 3 bytes: 1 byte (1 byte) for each B, G and R component. This format should be used to load AVI files. The value of each component is clamped: [0 - 255] - default value
- RGBA: each pixel of the texture is coded on 16 bytes: 4 bytes (1 float) for each component R, G, B and A. This format of pixel is to be used
as soon as one must act on the texture alpha channel (blending, alpha-test...). The value of each component is clamped: [0.0 - 1.0]
- RGBA_32F: defines a floating point texture. Each pixel of the texture is coded on 128 bits: 32 bits (1 float) for each component R, G, B and A.
The value of each component is non clamped: each component is a true 32 bits IEEE 754 floating point number.
Besides, you have to use a pixel shader when rendering using a floating point texture as input. This applies regardless of whether
the output buffer is the usual frame buffer or FBO. On some hardware implementation (nVidia) you have to use NPOTD texture (TEXTURE_RECTANGLE_2D)
to set RGBA_32F format.
- filtering_mode - [ENUM] - filtering mode of the texture:
- NONE: no filtering is applied to the texture. It is the fastest mode. Useful for distant textured objects
- LINEAR: default filtering
- TRILINEAR: filtering mainly used when dealing with large textured surfaces featuring mipmapping
The purpose of filtering is to limit the bad visual effects when texture is stretched or shrinked.
- anisotropy - [REAL] - value of the anisotropic filtering factor.
A value of 1.0 corresponds to isotropic filtering (default filtering ) - default value: 1.0
Remark: The max value of the anisotropic filtering coefficient depends on the graphics controller.
The following values are common: 4.0, 8.0 or 16.0. The HardwareInfos tool, delivered with Hyperion, gives this value.
- addressing_mode - [ENUM] - specifies the behavior of the texture on its edge and how the texture is
repeated when the tiling factor (uv_tiling) applied to the vertices is greater than 1.0:
- WRAP: texture is repeated in the 2 direction U and V - default value
- MIRROR: texture is repeated in the 2 direction U and V with mirror effect
- CLAMP: texture is not repeated any more and the edges of texture are not taken into account
- function_type - [ENUM] - texture function.
This texture function specifies how the texture is mixed up with the entry color in the 3d pipeline of the
graphics controller.
The entry color can be either the vertices color, or the previous texture in the case of multitexturing.
texture_function describes the operation carried out on the 2 entries of a texture unit:
The following values are accepted:
- MODULATE: texture is multiplied by the entry color: Output = A0 * A1 - default value
- REPLACE: texture is not influenced by the entry color: Output = A0
- ADD: texture is added with the entry color: Output = A0 + A1
- ADD_SIGNED: texture is half-added with the entry color: Output = A0 + A1 - 0.5
- SUB: texture is substracted from the entry color: Output = A0 - A1
- INTERPOLATE_CONSTANT: the final color is the result of the interpolation between the texture and the color resulting from the previous texture unit: Output = (A0 * A2) + (A1 * (1.0 - A2)).
Here A2 is a constant color which must be specified by <constant_color>
- INTERPOLATE_TEXTURE_ALPHA: the final color is the result of the interpolation between the current texture and the texture that is on the previous texture unit:
Output = (A0 * A2) + (A1 * (1.0 - A2)). Here A2 is a variable color which must be specified by <inject_opacity_map>
- gen_coord_mode - [ENUM] - specifies the way in which the texture coordinates (U and v) are generated for each vertex of a 3d object:
- NONE: U and v coordinates are left just as it is with the initialization of the 3d object. default value
- SPHERE_ENV_MAP: U and v coordinates are automatically generated by the 3d engine to create a spherical mapping effect.
This kind of mapping allows to simulate objects that seem to reflect the environment
- CUBE_ENV_MAP: U and v coordinates are automatically generated by the 3d engine to create a cubic mapping effect. This kind of mapping allows to
simulate objects reflecting the environment.
This type of mapping will be much more realistic than the SPHERE_ENV_MAP mode, but is also greedier in term of GPU resources (presence and update of cubic-map)
- type - [ENUM] - type of texture:
- TEXTURE_1D: texture 1D with normalized addressing (texture coordinates ranging from 0.0 to 1.0).
- TEXTURE_2D: texture 2D with normalized addressing (texture coordinates ranging from 0.0 to 1.0) - Default value.
- TEXTURE_RECTANGLE_2D: texture 2D (NPOTD) with non-normalized addressing (texture coordinates ranging from 0.0 to image max_size)
Caution: this Attention, this kind of texture is not supported by all graphics cards models. use the HardwareInfos tool to test your graphics card compatibility.
- TEXTURE_CUBE_MAP. cubemap type texture. This type of selection automatically initializes gen_coord_mode with CUBE_ENV_MAP.
- use_fbo_for_rtt - [BOOLEAN] - enables (TRUE) or disables (FALSE) the use of this texture with the default FBO (Frame Buffer Object).
Use this boolean when you plan to use this texture as reflexion texture - default value: FALSE
- fbo_attachment_point - [ENUM] - specify the attachment point in the FBO.
- FBO_COLOR_ATTACHMENT0: color buffer 0.
- FBO_COLOR_ATTACHMENT1: color buffer 1.
- FBO_COLOR_ATTACHMENT2: color buffer 2.
- FBO_COLOR_ATTACHMENT3: color buffer 3.
- perlin_noise - [BOOLEAN] - enables (TRUE) or disables (FALSE) the use of the Perlin noise to fill texture - default value: FALSE
- check_crc32 - [INTEGER] - allows to perform a crc32 type integrity test on the texture.
This kind of test is useful to control if the right file has been loaded.
That makes it therefore impossible to falsify a Hyperion scene delivered in a binary format : even if the
description code of the scene is in binary format, textures and other 3d objects are always accessible
in the ususal files type. Anybody could then appropriate a project by falsifying some textures or models.
The crc32 code of a file can be obtained using the Hyperion_CRC32.exe utility - default value: 0
- vertical_flip - [BOOLEAN] - if set to TRUE, allows to vertically turn over the texture - default value: FALSE
- horizontal_flip - [BOOLEAN] - if set to TRUE, allows to hozizontally turn over the texture - default value: FALSE
- use_texture_matrix - [BOOLEAN] - enables (TRUE) or disables (FALSE) the use of the texture transformation matrix.
The texture matrix hardware allows to perform, with a very small CPU usage, complex textures transformations.
The value of the texture rotation is defined by the pin_value attribute - default value: FALSE
- checker_pattern - [BOOLEAN] - enables (TRUE) or disables (FALSE) the use of a chequered pattern to fill the texture - default value: FALSE
- create_opacity_map - [BOOLEAN] - enables (TRUE) or disables (FALSE) the creation of an opacity-map during the texture loading - default value: FALSE
An opacity-map is a texture in which the value of the alpha channel is the arithmetic mean of
the three R, G and B channels. This makes it possible to have an alpha value which varies according to the
rgb color.
- create_binary_alpha_map - [BOOLEAN] - enables (TRUE) or disables (FALSE) the creation of a binary
alpha-map during the texture loading - default value: FALSE
A binary alpha-map is a texture in which the value of the alpha channel equals 1.0 or 0.0.
The choice of the correct value depends on the comparison between the rgb color of a texel and the color
specified with the binary_alpha_map_color element.
- create_constant_alpha_map - [BOOLEAN] - enables (TRUE) or disables (FALSE) the creation of a constant
alpha-map during the texture loading - default value: FALSE
A constant alpha-map is a texture in which the value of the alpha channel is equal to the value specified
by the constant_alpha_map_value attribute.
- constant_alpha_map_value - [CLAMPED_REAL] - alpha value ranging between 0.0 and 1.0 for the creation of
a constant alpha-map - default value: 0.5
- s3tc - [BOOLEAN] - enables (TRUE) or disables (FALSE) the creation of a compressed texture according to
the S3TC (DXT1 or DXT5) compression diagram - default value: FALSE
The texture will be compressed in the DXT1 format if the pixel format is RGB.
The texture will be compressed in the DXT5 format if the pixel format is RGBA.
- num_mipmaps - [INTEGER] - makes it possible to specify the number of mipmaps to be created during the
texture loading. In this case, filtering_mode must be set to "TRILINEAR " and the value of the anisotropic
filtering set with the anisotropy attribute. A value of 0 disables the mipmapping - default value: 13
- play_avi - [BOOLEAN] - enables (TRUE) or disables (FALSE) the playing of an AVi animated texture - default value: TRUE
cube_map element
cube_map allows to load a cube map using textures representing the 6 faces of the cubemap.
Attributes:
- face - [ENUM] - face of the cubemap:
- XPOS (or right)
- XNEG (or left)
- YPOS (or top)
- YNEG (or bottom)
- ZPOS (or front)
- ZNEG (or back)
- filename - [STR255] - location of the texture file of the cubemap face. The path is relating to the xml script.
- uv_map_op - [ENUM] - specifies the operation to be performed on the texture coordinates in order to correct the texture direction:
- NO_SWAP: operation without effect: leave the textures coordinates unchanged - default value
- SWAP_U: inverts the U coordinates: texture is reversed in relation to to the axis of the Y.
- SWAP_V: inverts the V coordinates: texture is reversed in relation to to the x axis.
- SWAP_UV: inverts the U and V coordinates: texture is reversed in relation to to the Y and X axis.
size element
size makes it possible to specify the texture dimensions. This instruction is to be used when the texture is procedural, i.e.
when it is generated by Hyperion:
- mirror texture
- cube map texture
- texture featuring Perlin noise or a chequered pattern
Attributes:
- width - [INTEGER] - texture width in pixels - default value: 256
- height - [INTEGER] - texture height in pixels - default value: 256
perlin_noise_params element
perlin_noise_params initializes the Perlin noise generator for texture filling.
Attributes:
min_color_r - [CLAMPED_REAL] - minimum value of the Perlin noise red color component - default value: 0.0
min_color_g - [CLAMPED_REAL] - minimum value of the Perlin noise green color component - default value: 0.0
min_color_b - [CLAMPED_REAL] - minimum value of the Perlin noise blue color component- default value: 0.0
min_color_a - [CLAMPED_REAL] - minimum value of the Perlin noise alpha color component - default value: 0.0
max_color_r - [CLAMPED_REAL] - maximum value of the Perlin noise red color component - default value: 1.0
max_color_g - [CLAMPED_REAL] - maximum value of the Perlin noise green color component - default value: 0.0
max_color_b - [CLAMPED_REAL] - maximum value of the Perlin noise blue color component - default value: 0.0
max_color_a - [CLAMPED_REAL] - maximum value of the Perlin noise alpha color component - default value: 1.0
amplitude - [CLAMPED_REAL] - amplitude of the Perlin noise generator - default value: 200
frequency - [CLAMPED_REAL] - noise frequency value - default value: 15
binary_alpha_map_color element
binary_alpha_map_color specifies the parameters for the generation of binary alpha-map. Binary alpha-maps
are textures with zones of total transparency. For the binary alpha map creation to be effective, it is
necessary to set the create_binary_alpha_map attribute of the texture node to "TRUE ".
Attributes:
r - [CLAMPED_REAL] - red component of the transparency color. Float value ranging between 0.0 and 1.0 - default value: 0.0
g - [CLAMPED_REAL] - green component of the transparency color. Float value ranging between 0.0 and 1.0 - default value: 0.0
b - [CLAMPED_REAL] - blue component of the transparency color. Float value ranging between 0.0 and 1.0 - default value: 0.0
epsilon - [CLAMPED_REAL] - specifies the tolerance around the transparency color for creating binary alpha-maps.
This allows to consider a variable zone around the transparency color - default value: 0.0
Example
<texture create_binary_alpha_map="TRUE ">
<binary_alpha_map_color r="1.0" g="0.0" b="0.0" epsilon="0.2" />
</texture>
Here the transparency color is fixed to pure red. In the example above, any pixel having one
color ranging between:
R [0.8 - 1.0]
G [0.0 - 0.2]
B [0.0 - 0.2]
will be considered transparent.
Remarks
Texture dimensions must be multiple of a power of 2:
- 16
- 32
- 64
- 128
- 256
- 512
- 1024
- 2048
spin_value element
spin_value initializes a rotation matrix of the texture around the Z axis. Allows to rotate a texture on itself.
Attributes:
z - [REAL] - generates a rotation matrix around the Z axis considering a rotation angle - default value: 0.0
Example
<spin_value ang_z="0.1" />
filling_color element
filling_colorp allows to fill the texture with a constant color.
Attributes:
- r - [CLAMPED_REAL] - red component of the color. Float value ranging between 0.0 and 1.0 - default value: 0.0
- g - [CLAMPED_REAL] - green component of the color. Float value ranging between 0.0 et 1.0 - default value: 0.0
- b - [CLAMPED_REAL] - blue component of the color. Float value ranging between 0.0 and 1.0 - default value: 0.0
- b - [CLAMPED_REAL] - alpha component of the color. Float value ranging between 0.0 and 1.0 - default value: 1.0
constant_color element
constant_color specifies the value of the color which will be used with the INTERPOLATE_CONSTANT texture function.
Attributes:
- r - [CLAMPED_REAL] - red component of the color. Float value ranging between 0.0 and 1.0 - default value: 1.0
- g - [CLAMPED_REAL] - green component of the color. Float value ranging between 0.0 et 1.0 - default value: 1.0
- b - [CLAMPED_REAL] - blue component of the color. Float value ranging between 0.0 and 1.0 - default value: 1.0
- b - [CLAMPED_REAL] - alpha component of the color. Float value ranging between 0.0 and 1.0 - default value: 1.0
inject_opacity_map element
inject_opacity_map makes it possible to inject an opacity texture in the alpha channel of the current texture.
inject_opacity_map is mainly used with the
INTERPOLATE_TEXTURE_ALPHA texture function but
can also be used with blending or alpha test.
Attributes:
- r - [CLAMPED_REAL] - red component of the color. Float value ranging between 0.0 and 1.0 - default value: 1.0
- g - [CLAMPED_REAL] - green component of the color. Float value ranging between 0.0 et 1.0 - default value: 1.0
- b - [CLAMPED_REAL] - blue component of the color. Float value ranging between 0.0 and 1.0 - default value: 1.0
- b - [CLAMPED_REAL] - alpha component of the color. Float value ranging between 0.0 and 1.0 - default value: 1.0
|
|
| |