Packageaway3d.materials
Classpublic class GlassMaterial
InheritanceGlassMaterial Inheritance away3d.materials.SinglePassShaderMaterial

BitmapData material which creates reflections based on a cube map. The reflection strength changes based on the refraction of the material and its environment, as well as the angle of view. This can be used to create water-like reflections.

Public Properties
 PropertyDefined by
  dispersionB : Number
The scale of dispersion for the blue channel.
GlassMaterial
  dispersionG : Number
The scale of dispersion for the green channel.
GlassMaterial
  dispersionR : Number
The scale of dispersion for the red channel.
GlassMaterial
  envMapAlpha : Number
The opacity of the environment map, ie: how reflective the surface is.
GlassMaterial
  exponent : Number
The exponent of the calculated fresnel term.
GlassMaterial
  glassColor : uint
GlassMaterial
  innerRefraction : Number
The refractive index of the inner medium (ie the material itself)
GlassMaterial
  outerRefraction : Number
The refractive index of the outer medium (where the view ray starts)
GlassMaterial
Public Methods
 MethodDefined by
  
GlassMaterial
(normalMap:BitmapData, envMap:BitmapData, targetModel:Mesh, chromaticDispersion:Boolean = false, init:Object = null)
Creates a new GlassMaterial object.
GlassMaterial
Protected Methods
 MethodDefined by
  
updatePixelShader(source:Object3D, view:View3D):void
GlassMaterial
Property detail
dispersionBproperty
dispersionB:Number  [read-write]

The scale of dispersion for the blue channel. For best results, use value close to but lower than 1.

Implementation
    public function get dispersionB():Number
    public function set dispersionB(value:Number):void
dispersionGproperty 
dispersionG:Number  [read-write]

The scale of dispersion for the green channel. For best results, use value close to but lower than 1.

Implementation
    public function get dispersionG():Number
    public function set dispersionG(value:Number):void
dispersionRproperty 
dispersionR:Number  [read-write]

The scale of dispersion for the red channel. For best results, use value close to but lower than 1.

Implementation
    public function get dispersionR():Number
    public function set dispersionR(value:Number):void
envMapAlphaproperty 
envMapAlpha:Number  [read-write]

The opacity of the environment map, ie: how reflective the surface is. 1 is a perfect mirror.

Implementation
    public function get envMapAlpha():Number
    public function set envMapAlpha(value:Number):void
exponentproperty 
exponent:Number  [read-write]

The exponent of the calculated fresnel term. Lower values will only show reflections at steeper view angles.

Implementation
    public function get exponent():Number
    public function set exponent(value:Number):void
glassColorproperty 
glassColor:uint  [read-write]Implementation
    public function get glassColor():uint
    public function set glassColor(value:uint):void
innerRefractionproperty 
innerRefraction:Number  [read-write]

The refractive index of the inner medium (ie the material itself)

Implementation
    public function get innerRefraction():Number
    public function set innerRefraction(value:Number):void
outerRefractionproperty 
outerRefraction:Number  [read-write]

The refractive index of the outer medium (where the view ray starts)

Implementation
    public function get outerRefraction():Number
    public function set outerRefraction(value:Number):void
Constructor detail
GlassMaterial()constructor
public function GlassMaterial(normalMap:BitmapData, envMap:BitmapData, targetModel:Mesh, chromaticDispersion:Boolean = false, init:Object = null)Parameters
normalMap:BitmapData — An object-space normal map
 
envMap:BitmapData — The spherical environment map used for reflections
 
targetModel:Mesh — The target mesh for which this shader is applied
 
chromaticDispersion:Boolean (default = false) — An initialisation object
 
init:Object (default = null)
Init Parameters
 envMapAlpha:Number (default = 1)
 outerRefraction:Number (default = 1.0008)
 innerRefraction:Number (default = 1.330)
 dispersionR:Number (default = 1)
 dispersionG:Number (default = .95)
 dispersionB:Number (default = .9)
 exponent:Number (default = 5)
 glassColor:Int (default = 0xffffff)
Method detail
updatePixelShader()method
protected override function updatePixelShader(source:Object3D, view:View3D):void Parameters
source:Object3D
 
view:View3D
Wiki link
Click to go to the wiki page for 'away3d.materials.GlassMaterial'

Code examples

Comments