Packageaway3d.materials.methods
Classpublic class SubsurfaceScatteringDiffuseMethod
InheritanceSubsurfaceScatteringDiffuseMethod Inheritance WrapDiffuseMethod Inheritance BasicDiffuseMethod Inheritance LightingMethodBase Inheritance ShadingMethodBase

SubsurfaceScatteringDiffuseMethod provides a depth map-based diffuse shading method that mimics the scattering of light inside translucent surfaces. It allows light to shine through an object and to soften the diffuse shading. It can be used for candle wax, ice, skin, ...

Public Properties
 PropertyDefined by
 InheritedalphaThreshold : Number
WrapDiffuseMethod
 InheritedbitmapData : BitmapData
The bitmapData to use to define the diffuse reflection color per texel.
WrapDiffuseMethod
 InheriteddiffuseAlpha : Number
The alpha component of the diffuse reflection.
WrapDiffuseMethod
 InheriteddiffuseColor : uint
The color of the diffuse reflection when not using a texture.
WrapDiffuseMethod
 Inheritedpasses : Vector
Any passes required that render to a texture used by this method.
ShadingMethodBase
  scatterColor : uint
The colour the light becomes inside the object.
SubsurfaceScatteringDiffuseMethod
  scattering : Number
The amount by which the light scatters.
SubsurfaceScatteringDiffuseMethod
 InheritedshadowRegister : ShaderRegisterElement
WrapDiffuseMethod
 Inherited_totalLightColorReg : ShaderRegisterElement
BasicDiffuseMethod
  translucency : Number
The translucency of the object.
SubsurfaceScatteringDiffuseMethod
 InheritedviewDirVaryingReg : ShaderRegisterElement
WrapDiffuseMethod
Protected Properties
 PropertyDefined by
 Inherited_diffuseInputIndex : int
BasicDiffuseMethod
 Inherited_diffuseInputRegister : ShaderRegisterElement
BasicDiffuseMethod
 Inherited_globalPosVertexReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_mipmap : Boolean = true
ShadingMethodBase
 Inherited_needsGlobalPos : Boolean
ShadingMethodBase
 Inherited_needsNormals : Boolean
ShadingMethodBase
 Inherited_needsProjection : Boolean
ShadingMethodBase
 Inherited_needsUV : Boolean
ShadingMethodBase
 Inherited_needsView : Boolean
ShadingMethodBase
 Inherited_normalFragmentReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_numLights : int
ShadingMethodBase
 Inherited_passes : Vector
ShadingMethodBase
 Inherited_projectionReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_repeat : Boolean
ShadingMethodBase
 Inherited_shadowRegister : ShaderRegisterElement
BasicDiffuseMethod
 Inherited_smooth : Boolean = true
ShadingMethodBase
 Inherited_useTexture : Boolean
BasicDiffuseMethod
 Inherited_uvFragmentReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_viewDirFragmentReg : ShaderRegisterElement
ShadingMethodBase
 Inherited_viewDirVaryingReg : ShaderRegisterElement
ShadingMethodBase
Public Methods
 MethodDefined by
  
SubsurfaceScatteringDiffuseMethod
(depthMapSize:int = 512, depthMapOffset:Number = 15)
Creates a new SubsurfaceScatteringDiffuseMethod object.
SubsurfaceScatteringDiffuseMethod
 Inherited
Copies the state from a BasicDiffuseMethod object into the current object.
BasicDiffuseMethod
 Inherited
dispose(deep:Boolean):void
Cleans up any resources used by the current object.
WrapDiffuseMethod
 Inherited
Marks the texture for update next on the next render.
WrapDiffuseMethod
Protected Methods
 MethodDefined by
 Inherited
A helper method that generates standard code for sampling from a texture using the normal uv coordinates.
ShadingMethodBase
 Inherited
Marks the shader program as invalid, so it will be recompiled before the next render.
ShadingMethodBase
Property detail
scatterColorproperty
scatterColor:uint  [read-write]

The colour the light becomes inside the object.

Implementation
    public function get scatterColor():uint
    public function set scatterColor(value:uint):void
scatteringproperty 
scattering:Number  [read-write]

The amount by which the light scatters. It can be used to set the translucent surface's thickness. Use low values for skin.

Implementation
    public function get scattering():Number
    public function set scattering(value:Number):void
translucencyproperty 
translucency:Number  [read-write]

The translucency of the object.

Implementation
    public function get translucency():Number
    public function set translucency(value:Number):void
Constructor detail
SubsurfaceScatteringDiffuseMethod()constructor
public function SubsurfaceScatteringDiffuseMethod(depthMapSize:int = 512, depthMapOffset:Number = 15)Parameters
depthMapSize:int (default = 512) — The size of the depth map used.
 
depthMapOffset:Number (default = 15) — The amount by which the rendered object will be inflated, to prevent depth map rounding errors.
Init Parameters
Method detail
activate()method
arcane override function activate(context:Context3D, contextIndex:uint):void

Sets the render state for this method.

Parameters
context:Context3D — The Context3D currently used for rendering.
 
contextIndex:uint
deactivate()method 
arcane override function deactivate(context:Context3D):void

Parameters
context:Context3D
getFragmentAGALPreLightingCode()method 
arcane override function getFragmentAGALPreLightingCode(regCache:ShaderRegisterCache):String

Get the fragment shader code that will be needed before any per-light code is added.

Parameters
regCache:ShaderRegisterCache — The register cache used during the compilation.

Returns
String
getFragmentCodePerLight()method 
arcane override function getFragmentCodePerLight(lightIndex:int, lightDirReg:ShaderRegisterElement, lightColReg:ShaderRegisterElement, regCache:ShaderRegisterCache):String

Get the fragment shader code that will generate the code relevant to a single light.

Parameters
lightIndex:int — The register cache used during the compilation.
 
lightDirReg:ShaderRegisterElement
 
lightColReg:ShaderRegisterElement
 
regCache:ShaderRegisterCache

Returns
String
getFragmentPostLightingCode()method 
arcane override function getFragmentPostLightingCode(regCache:ShaderRegisterCache, targetReg:ShaderRegisterElement):String

Get the fragment shader code that should be added after all per-light code. Usually composits everything to the target register.

Parameters
regCache:ShaderRegisterCache — The register cache used during the compilation.
 
targetReg:ShaderRegisterElement

Returns
String
getVertexCode()method 
arcane override function getVertexCode(regCache:ShaderRegisterCache):String

Get the vertex shader code for this method.

Parameters
regCache:ShaderRegisterCache — The register cache used during the compilation.

Returns
String
reset()method 
arcane override function reset():void

setRenderState()method 
arcane override function setRenderState(renderable:IRenderable, context:Context3D, contextIndex:uint, camera:Camera3D, lights:Vector):void Parameters
renderable:IRenderable
 
context:Context3D
 
contextIndex:uint
 
camera:Camera3D
 
lights:Vector
Wiki link

Code examples

Comments