Packageaway3d.materials.methods
Classpublic class GradientDiffuseMethod
InheritanceGradientDiffuseMethod Inheritance BasicDiffuseMethod Inheritance LightingMethodBase Inheritance ShadingMethodBase Inheritance NamedAssetBase Inheritance flash.events.EventDispatcher

GradientDiffuseMethod is an alternative to BasicDiffuseMethod in which the shading can be modulated with a gradient to introduce color-tinted shading as opposed to the single-channel diffuse strength. This can be used as a crude approximation to subsurface scattering (for instance, the mid-range shading for skin can be tinted red to similate scattered light within the skin attributing to the final colour)



Public Properties
 PropertyDefined By
 InheritedalphaThreshold : Number
The minimum alpha value for which pixels should be drawn.
BasicDiffuseMethod
 InheritedassetFullPath : Array
[read-only]
NamedAssetBase
 InheritedassetNamespace : String
[read-only]
NamedAssetBase
 InheriteddiffuseAlpha : Number
The alpha component of the diffuse reflection.
BasicDiffuseMethod
 InheriteddiffuseColor : uint
The color of the diffuse reflection when not using a texture.
BasicDiffuseMethod
  gradient : Texture2DBase
A texture that contains the light colour based on the angle.
GradientDiffuseMethod
 Inheritedid : String
NamedAssetBase
 Inheritedname : String
NamedAssetBase
 InheritedoriginalName : String
[read-only] The original name used for this asset in the resource (e.g.
NamedAssetBase
 Inheritedpasses : Vector.<MaterialPassBase>
[read-only] Any passes required that render to a texture used by this method.
ShadingMethodBase
 Inheritedtexture : Texture2DBase
The bitmapData to use to define the diffuse reflection color per texel.
BasicDiffuseMethod
 Inherited_totalLightColorReg : ShaderRegisterElement
BasicDiffuseMethod
Protected Properties
 PropertyDefined By
 Inherited_alphaThreshold : Number = 0
BasicDiffuseMethod
 Inherited_diffuseInputRegister : ShaderRegisterElement
BasicDiffuseMethod
 Inherited_isFirstLight : Boolean
BasicDiffuseMethod
 Inherited_passes : Vector.<MaterialPassBase>
ShadingMethodBase
 Inherited_shadowRegister : ShaderRegisterElement
BasicDiffuseMethod
 Inherited_sharedRegisters : ShaderRegisterData
ShadingMethodBase
 Inherited_useTexture : Boolean
BasicDiffuseMethod
Public Methods
 MethodDefined By
  
Creates a new GradientDiffuseMethod object.
GradientDiffuseMethod
 Inherited
assetPathEquals(name:String, ns:String):Boolean
NamedAssetBase
 Inherited
[override] Copies the state from a ShadingMethodBase object into the current object.
BasicDiffuseMethod
 Inherited
dispose():void
[override] Cleans up any resources used by the current object.
BasicDiffuseMethod
 Inherited
generateMip(stage3DProxy:Stage3DProxy):void
Forces the creation of the texture.
BasicDiffuseMethod
 Inherited
resetAssetPath(name:String, ns:String = null, overrideOriginal:Boolean = true):void
NamedAssetBase
Protected Methods
 MethodDefined By
  
[override] Generate the code that applies the calculated shadow to the diffuse light
GradientDiffuseMethod
 Inherited
getTex2DSampleCode(vo:MethodVO, targetReg:ShaderRegisterElement, inputReg:ShaderRegisterElement, texture:TextureProxyBase, uvReg:ShaderRegisterElement = null, forceWrap:String = null):String
A helper method that generates standard code for sampling from a texture using the normal uv coordinates.
ShadingMethodBase
 Inherited
A helper method that generates standard code for sampling from a cube texture.
ShadingMethodBase
 Inherited
Marks the shader program as invalid, so it will be recompiled before the next render.
ShadingMethodBase
Public Constants
 ConstantDefined By
 InheritedDEFAULT_NAMESPACE : String = default
[static]
NamedAssetBase
Property Detail
gradientproperty
gradient:Texture2DBase

A texture that contains the light colour based on the angle. This can be used to change the light colour due to subsurface scattering when the surface faces away from the light.


Implementation
    public function get gradient():Texture2DBase
    public function set gradient(value:Texture2DBase):void
Constructor Detail
GradientDiffuseMethod()Constructor
public function GradientDiffuseMethod(gradient:Texture2DBase)

Creates a new GradientDiffuseMethod object.

Parameters
gradient:Texture2DBase — A texture that contains the light colour based on the angle. This can be used to change the light colour due to subsurface scattering when the surface faces away from the light.
Method Detail
activate()method
override arcane function activate(vo:MethodVO, stage3DProxy:Stage3DProxy):void

Parameters

vo:MethodVO
 
stage3DProxy:Stage3DProxy

applyShadow()method 
override protected function applyShadow(vo:MethodVO, regCache:ShaderRegisterCache):String

Generate the code that applies the calculated shadow to the diffuse light

Parameters

vo:MethodVO — The MethodVO object for which the compilation is currently happening.
 
regCache:ShaderRegisterCache — The register cache the compiler is currently using for the register management.

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

getFragmentCodePerLight()method 
override arcane function getFragmentCodePerLight(vo:MethodVO, lightDirReg:ShaderRegisterElement, lightColReg:ShaderRegisterElement, regCache:ShaderRegisterCache):String

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

Parameters

vo:MethodVO — The MethodVO object containing the method data for the currently compiled material pass.
 
lightDirReg:ShaderRegisterElement — The register containing the light direction vector.
 
lightColReg:ShaderRegisterElement — The register containing the light colour.
 
regCache:ShaderRegisterCache — The register cache used during the compilation.

Returns
String
getFragmentPreLightingCode()method 
override arcane function getFragmentPreLightingCode(vo:MethodVO, regCache:ShaderRegisterCache):String

Parameters

vo:MethodVO
 
regCache:ShaderRegisterCache

Returns
String