ParallelGraphics
Home  »  Developer Zone  »  Products  »  Cortona3D Viewer  »  VRML Extensions  »  AdvancedAppearance
Up to VRML Extensions

AdvancedAppearance 

Animated GIF 

BumpMap 

Collision Detection 

CompositeTexture 

CortonaExtrusion 

CubeEnvironment 

DirectX 9.0 Shaders 

Drag & Drop 

EventUtilities 

Flash animations 

FlashMovie 

FontStyle 

Inline Extension 

Interpolator Nodes 

GradientBackground 

Keyboard Input 

Layers and 2D Nodes 

MipMap 

NavigationInfo 

NURBS 

OrderedGroup 

Panel and HTMLText 

QuickTime 

SFVec2f Interpolator 

SphereEnvironment 

Splines 

Three-Dimensional Text 

TextureTransform3 

TransformSensor 

ViewportSensor 

ZGroup 


Subscribe to Newsletter
 


Google Searchsite search:

 

%(domain)s %(domain)s
Install Cortona3D Viewer

Outline3D


AdvancedAppearance

The AdvancedAppearance node enables you to use advanced texturing techniques such as multiple texturing.

Node description
AdvancedAppearance { 
   exposedField   SFNode	material		NULL 
   exposedField   MFNode	textures		[] 
   exposedField   MFString	mappingTypes	[] 
   exposedField   MFFloat	weights		[]	# [0, inf)
   exposedField   SFFloat	materialBlending	0	# [0, 1] 
   exposedField   MFNode	textureTransforms	[]
   exposedField   MFString	backgroundFactor	[]
   exposedField   MFString	foregroundFactor	[]
}
 
material
The material field, if specified, contains a Material node.

 
textures
The textures field specifies a set of 2D textures for multi-texturing. The texture field, if specified, contains one of the various types of texture nodes (ImageTexture, MovieTexture, or PixelTexture). If the texture node is NULL or the texture field is unspecified, the object that references this Appearance is not textured.

 
mappingTypes
The mappingTypes field defines a texture map type. The possible types are:
"SIMPLE" - ordinary mapping that all VRML browsers support,
"ENVIRONMENT" - this simulates the reflecting surfaces.

When there are several textures with the "SIMPLE" map type, it is possible to define individual mapping for each texture by using several sets of texture indexes in the texCoordIndex field of the geometry node. The texCoordIndex field may contain N * L indexes, where N is the number of textures with the "SIMPLE" map type, L - the number of indexes in the coordIndex field.
For textures with the "ENVIRONMENT" map type texture indexes are not used.

 
weights
The weights field specifies a set of weights that are required to mix different textures. In Cortona 4.0 this field is ignored and the backgroundFactor and foregroundFactor fields are used for mixing textures.

 
materialBlending
The materialBlending field specifies how to combine textures and materials on associated geometry. The value of materialBlending ranges from 0 to 1. If you don't specify any textures (the textures field is empty) or material (material is NULL), no combination happens. The weights required for mixing can be computed as:
if(textures.count == 0)
      Wmaterial = 1;	// a material is used
else if(material == NULL)
      Wmaterial = 0;	// textures are used
else 			// textures and material are combined
      Wmaterial = materialBlending.
 
textureTransforms
The textureTransforms field specifies a set of 2D transformations that are applied to different textures that are specified in the textures field. The field, if specified, contains a list of TextureTransform nodes. Descriptions of the TextureTransform node are provided in the VRML97 specification (see 6.49, TextureTransform).

 
BackgroundFactor, foreGroundFactor
The backgroundFactor and foreGroundFactor fields specify the sets of factors required to mix textures.

Multi-texturing is implemented by the multi-pass rendering. On each pass the successive texture from the textures node is mixed with the color resulting from the previous pass according to the following formula:
CMT(i) = CB * FB(i) + CF * FF(i), where
	CMT(i)	- the color resulting from the given pass,
	i	- the texture number in the textures node (the pass number),
	CB	- the pixel color resulting from the previous pass (CMT(i - 1)),
		  or back color (the frame-buffer contents before rendering)
		  for the first pass,
	CF	- the pixel color of the texture with the number i,
	FB(i)	- the factor defined in the backgroundFactor field,
	FF(i)	- the factor defined in the foregroundFactor field.
All colors are considered to have four components (RGBA). If there is no alpha channel (for example, the texture or back color has no alpha), the alpha value is considered to be 1 (entirely nontransparent color) i.e. the alpha channel takes part in all calculations equally with the other color components. The backgroundFactor and foreGroundFactor fields can take on the following values:

ValueFactor
DEFAULTdefault
ZERO0
ONE1
FORE_COLORCF
INV_FORE_COLOR1 - CF
FORE_ALPHAAF
INV_FORE_ALPHA1 - AF
BACK_COLORCB
INV_BACK_COLOR1 - CB
BACK_ALPHAAB
INV_BACK_ALPHA1 - AB

AF - the alpha value resulting from the given pass,
AB - the alpha value resulting from the previous pass or from the back color. (If there is no alpha channel AB = 1).

Only GeForce adapters support the last two values. So for the rest display adapters the "BACK_ALPHA" value is equivalent to "ONE", and "INV_BACK_ALPHA" is equivalent to "ZERO".

If the values in the backgroundFactor and foreGroundFactor fields are not defined or set to "DEFAULT", they are determined by default according to the texture type (see the table below). The value of CF also depends on the texture type. If the material is defined (lighting on), the intensity textures are modulating by the diffuse color of the material. If all textures have alpha channels, the material transparency is ignored i.e. it is considered to be 0, and alpha from the textures is used. But if there is at least one texture without alpha the material transparency modulates the alpha channel of all textures.

Texture typebackgroundFactor
by default
foregroundFactor
by default
CF
lighting on
CF
lighting off
Intensity "ZERO" "ONE" DM * CT CT
Intensity + Alpha "INV_FORE_ALPHA" "FORE_ALPHA" DM * CT CT
RGB "ZERO" "ONE" CT CT
RGB + Alpha "INV_FORE_ALPHA" "FORE_ALPHA" CT CT

CT - is the color of the texture (all components are equal for intensity textures)
DM - is the diffuse color of the material (the Material.diffuseColor field).
For compatibility with the standard specification, the following is implemented: if all textures have alpha channels, the material transparency is ignored i.e. it is considered to be 0, and the alpha from the textures is used. But if there is at least one texture without alpha the material transparency modulates the alpha channel of all textures. The AF value is calculated according to the formula:
 AF = AT * (1 - TM), where
	AT    - the alpha value of the texture 
			(for 1- and 3-component textures AT = 1)      
	TM    - the Material.transparency field value 
			(or 0 if all textures have the alpha channel)      

The color obtained after multi-texturing CMT is processed in the following way:
 
Lighting off
The resulting color is calculated by the formula:
C = BM * EM + (1 - BM) * CMT, where
C - is the resulting color of the pixel,
BM - is the coefficient of the material blending (the materialBlending field),
EM - is the emissive color of the material (the Material.emissiveColor field).

 
Lighting on
The resulting color of the pixel is calculated by the standard formula of the VRML lighting model where a diffuse factor (ODrgb) is set to the following color:
ODrgb = BM * DM + (1 - BM) * CMT

The resulting color Ñ is combined with the color resulting from the previous pass (which is equal to CMT) and with the transparency of Material (the Material.transparency field) according to the following formula:

(1 - TM) * C + TM * CMT




Examples
scene size: 692bytes
resources size: 4.9KB
archive size: 5.7KB
view online download
scene size: 7.9KB
resources size: 28KB
archive size: 30KB
view online download

Last updated: Sat, 04 Jul 2009
© 2000-2009 ParallelGraphics. All rights reserved. Terms of use.