Matfx

From DeltaWiki
Jump to navigation Jump to search
Matfx
Build

971

Version

4.1

Environment Mapping (shiny effect)
Environment Mapping (reflective effect)
Dual Textures (on top cube) and Bump Mapping

The matfx command, also known as material effect, applies a flexible variety of effects to the textures of an object. Available effects are environmental mapping, bump mapping and dual texturing. These effects are only visible on polygons with textures and require valid texture coordinates.

Types

Environmental mapping

An environmental map is an overlay texture which appears to wrap around the surface of an object depending on the angle or position of the user's camera. Example uses include adding a "sheen" to round shiny objects and simulating light scattering on a translucent object.

Bump mapping

Bump mapping, like texture mapping, is a technique to add more realism to synthetic images without adding a lot of geometry. Texture mapping adds realism by attaching images to geometric surfaces. Bump mapping adds per-pixel surface relief shading, increasing the apparent complexity of the surface by perturbing the surface normal. Surfaces that have a patterned roughness are good candidates for bump mapping. Examples include oranges, strawberries, stucco, wood, etc.

Dual texturing

Dual texture effects are overlayed textures using blending techniques. Blending is a mechanism for combining color already in the framebuffer with the color of the incoming primitive. The result of this combination is then stored back in the framebuffer. Blending is frequently used to simulate translucent physical materials. One example is rendering the smoked glass windshield of a car. The driver and interior are still visible, but they are obscured by the dark color of the smoked glass.

Green Screen

The Green Screen effect filters green color of a texture and replaces the affected pixels either by a background image or by transparency - using coef as a threshold value in range of 0.01 to 1.0 giving the color tolerance to pure green, and the optional tex option for a background image.


Usage

matfx [type=type] [tex=tex] [coef=coef] [tag=tag] [blend=blend] [name=name] [global]

type

The type argument is an integer value that can be either in the range from 0 to 4 or in the range from 10 to 14. If no type option is specified, type 1 is used as default.

  • 0 ... no material effect / switch off all material effects
  • 1 ... environment mapping using camera matrix as projection viewpoint
  • 2 ... bump mapping using camera matrix as projection viewpoint
  • 3 ... environment and bump mapping using camera matrix as projection viewpoint
  • 4 ... dual texturing using camera matrix as projection viewpoint
  • 5 ... green screen
  • 10 ... no material effect - same as 0
  • 11 ... environment mapping using the directional light matrix as projection viewpoint
  • 12 ... bump mapping using the directional light matrix as projection viewpoint
  • 13 ... environment and bump mapping using the directional light matrix as projection viewpoint
  • 14 ... dual texturing using the directional light matrix as projection viewpoint

tex

The tex argument specifies an optional texture to use for the selected material effect. It can be either an environment map, a bump map or an onverlayed texture, depending on the used type. The texture must be found in the textures subfolder of the worlds object path. The keyword self used as texture name will use the material's original texture, if any, for the material effect. If self is chosen and the object has no texture specified, no effect will be generated. If the tex argument is not given, the default texture in the subfolder of the browser's installation directory (/default/textures/gloss.png) is used.

coef

The coef argument sets the coefficient for the used effect, which means the strength of the effect. It can have a value between 0.05 and 1.0. The default coefficient is 0.333.

tag

The tag argument specifies the tag number of the surface to render on. Any tag that exists on the used object can be used, including tags of jointed avatars. A value of 0 (zero), also the default value, means to apply the material effect onto all surfaces of the geometry.

blend

The blend argument is only used for dual texturing. It defines the blending mode. It sets the source and destination blend function used in blended transparency and antialiasing operations. The source function specifies the factor that is multiplied by the source color; this value is added to the product of the destination factor and the destination color. The source is the underlaying texture and the destination is the overlayed texture. Possible values are:

  • 0 ... no blending / switches the effect off
  • 1 ... blend zero - no blending on either source or destination
  • 2 ... blend one - full range of either source or destination
  • 3 ... blend source color - use the source color
  • 4 ... blend source inverse color - use the negative color of the source
  • 5 ... blend source alpha - use the source as alpha channel
  • 6 ... blend source inverse alpha - use the negative of the source as alpha channel
  • 7 ... blend destination alpha - use the negative of the destination as alpha channel
  • 8 ... blend destination inverse alpha - use the negative of the destination as alpha channel
  • 9 ... blend destination color - use the color of the destination
  • 10 ... blend destination inverse color - use the negative color of the destination
  • 11 ... blend source alpha saturation - use the saturation of the source as alpha channel

The value for the blend argument is given in a string, in the format 6:8, where the first value is the blending source function and the second value is the blending destination function. The default is 5:6, source alpha : source inverse alpha. If you are interested in further details, look at here.

name

The name argument can be used for remote control, applying the matfx command onto the named object within view of the same owner.

global

The global argument will cause triggers to initiate the command for all users have the object in view. Without it, the command will be triggered exclusively for the user who activates the trigger (bump, activate, adone). By default, commands are not global.

Notes

Material effects use the geometry's texture coordinates and its vertex normals to calculate the visible effect from camera view or from directional light influence. If an effect does not appear correctly on one object but it looks fine on another, the object's geometry is most likely not allowing the assumed effect. In any case, the reached effect can be amazing.

Dual textures are not supported in Software Rendering mode.

Examples

create matfx type=3 tex=gold

This creates a quite realistic gold surface, using bump mapping in combination with a shiny effect produced with environment mapping.

create matfx type=2 coef=1 tex=self

This produces a string bump map with its own texture.

create matfx tex=flare1 tag=200

This creates a reflective effect onto a picture surface.

create media url=<my greenscreen video>, matfx type=5 coef=0.15

This creates a green-screen filter with transparent background.


Object Scripting

Building2.jpg

Triggers: CreateBumpActivateAdoneAtCollideSdoneEnter ZoneExit Zone

Commands: AddforceAddtorqueAlpharefAnimateAstartAstopCameraColliderColltagColorCoronaEnviExamineFrameGroupLightLinkLockMatfxMediaMidiMoveNameNoiseOpacityPictureRotateSayScale SeqShadowShearSignSkewSkyboxSolidSoundTagTeleport / TeleportxTextureTimerURLVelocityVisibleWarpWeb nl:Commando:Matfx