Interface SmogFlowMaterialParameters

烟雾材质参数

Export

SmogFlowMaterialParameters

Hierarchy

  • ShaderMaterialParameters
    • SmogFlowMaterialParameters

Properties

allowOverride?: boolean

Whether it's possible to override the material with Scene#overrideMaterial or not.

Default

true
alpha?: number

整体透明度,可选,默认0.5

Memberof

SmogFlowMaterialParameters

alphaHash?: boolean

Enables alpha hashed transparency, an alternative to Material#transparent or Material#alphaTest. The material will not be rendered if opacity is lower than a random threshold. Randomization introduces some grain or noise, but approximates alpha blending without the associated problems of sorting. Using TAA can reduce the resulting noise.

Default

false
alphaTest: number
alphaToCoverage?: boolean

Whether alpha to coverage should be enabled or not. Can only be used with MSAA-enabled contexts (meaning when the renderer was created with antialias parameter set to true). Enabling this will smooth aliasing on clip plane edges and alphaTest-clipped edges.

Default

false
blendAlpha?: number

Represents the alpha value of the constant blend color.

This property has only an effect when using custom blending with ConstantAlpha or OneMinusConstantAlpha.

Default

0
blendColor?: ColorRepresentation

Represents the RGB values of the constant blend color.

This property has only an effect when using custom blending with ConstantColor or OneMinusConstantColor.

Default

(0,0,0)
blendDst?: BlendingDstFactor

Defines the blending destination factor.

Default

OneMinusSrcAlphaFactor
blendDstAlpha?: BlendingDstFactor

Defines the blending destination alpha factor.

Default

null
blendEquation?: BlendingEquation

Defines the blending equation.

Default

AddEquation
blendEquationAlpha?: BlendingEquation

Defines the blending equation of the alpha channel.

Default

null
blendSrc?: BlendingSrcFactor

Defines the blending source factor.

Default

SrcAlphaFactor
blendSrcAlpha?: BlendingSrcFactor

Defines the blending source alpha factor.

Default

null
blending?: Blending

Defines the blending type of the material.

It must be set to CustomBlending if custom blending properties like Material#blendSrc, Material#blendDst or Material#blendEquation should have any effect.

Default

NormalBlending
clipIntersection?: boolean

Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union.

Default

false
clipShadows?: boolean

Defines whether to clip shadows according to the clipping planes specified on this material.

Default

false
clipping?: boolean

Defines whether this material supports clipping; true to let the renderer pass the clippingPlanes uniform.

Default

false
clippingPlanes?: Plane[]

User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered). This requires WebGLRenderer#localClippingEnabled to be true.

Default

null
color?: ColorRepresentation

水颜色,可选,默认0x39f1fe

Memberof

SmogFlowMaterialParameters

colorIntensity?: number

烟雾颜色强度,可选,默认1

Memberof

SmogFlowMaterialParameters

colorWrite?: boolean

Whether to render the material's color.

This can be used in conjunction with Object3D#renderOder to create invisible objects that occlude other objects.

Default

true
defaultAttributeValues?: {
    color: [number, number, number];
    uv: [number, number];
    uv1: [number, number];
}

When the rendered geometry doesn't include these attributes but the material does, these default values will be passed to the shaders. This avoids errors when buffer data is missing.

  • color: [ 1, 1, 1 ]
  • uv: [ 0, 0 ]
  • uv1: [ 0, 0 ]

Type declaration

  • color: [number, number, number]
  • uv: [number, number]
  • uv1: [number, number]
defines?: {
    [key: string]: any;
}

Defines custom constants using #define directives within the GLSL code for both the vertex shader and the fragment shader; each key/value pair yields another directive.

defines: {
FOO: 15,
BAR: true
}

Yields the lines:

#define FOO 15
#define BAR true

Type declaration

  • [key: string]: any
depthFunc?: DepthModes

Defines the depth function.

Default

LessEqualDepth
depthTest?: boolean

Whether to have depth test enabled when rendering this material. When the depth test is disabled, the depth write will also be implicitly disabled.

Default

true
depthWrite?: boolean

Whether rendering this material has any effect on the depth buffer.

When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.

Default

true
dithering?: boolean

Whether to apply dithering to the color to remove the appearance of banding.

Default

false
emptiness?: number

稀疏度,可选,默认0.1

Memberof

SmogFlowMaterialParameters

extensions?: {
    clipCullDistance: boolean;
    multiDraw: boolean;
}

This object allows to enable certain WebGL 2 extensions.

  • clipCullDistance: set to true to use vertex shader clipping
  • multiDraw: set to true to use vertex shader multi_draw / enable gl_DrawID

Type declaration

  • clipCullDistance: boolean
  • multiDraw: boolean
fbmWeight?: number[] | Vector4

形状合成权重系数,可选,默认 new Vector4( 0.5, 0.25, 0.125, 0.0625 )

Memberof

SmogFlowMaterialParameters

fog?: boolean

Define whether the material color is affected by global fog settings; true to pass fog uniforms to the shader.

Default

false
forceSinglePass?: boolean

Whether double-sided, transparent objects should be rendered with a single pass or not.

The engine renders double-sided, transparent objects with two draw calls (back faces first, then front faces) to mitigate transparency artifacts. There are scenarios however where this approach produces no quality gains but still doubles draw calls e.g. when rendering flat vegetation like grass sprites. In these cases, set the forceSinglePass flag to true to disable the two pass rendering to avoid performance issues.

Default

false
fragmentShader?: string

Fragment shader GLSL code. This is the actual code for the shader.

glslVersion?: GLSLVersion

Defines the GLSL version of custom shader code.

Default

null
index0AttributeName?: string

If set, this calls [gl.bindAttribLocation]https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation to bind a generic vertex index to an attribute variable.

Default

undefined
lights?: boolean

Defines whether this material uses lighting; true to pass uniform data related to lighting to this shader.

Default

false
linewidth?: number

Controls line thickness or lines.

WebGL and WebGPU ignore this setting and always render line primitives with a width of one pixel.

Default

1
moveSpeed?: number

移动速度,可选,默认1

Memberof

SmogFlowMaterialParameters

name?: string

The name of the material.

opacity?: number

Defines how transparent the material is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque.

If the Material#transparent is not set to true, the material will remain fully opaque and this value will only affect its color.

Default

1
polygonOffset?: boolean

Whether to use polygon offset or not. When enabled, each fragment's depth value will be offset after it is interpolated from the depth values of the appropriate vertices. The offset is added before the depth test is performed and before the value is written into the depth buffer.

Can be useful for rendering hidden-line images, for applying decals to surfaces, and for rendering solids with highlighted edges.

Default

false
polygonOffsetFactor?: number

Specifies a scale factor that is used to create a variable depth offset for each polygon.

Default

0
polygonOffsetUnits?: number

Is multiplied by an implementation-specific value to create a constant depth offset.

Default

0
precision?: "highp" | "mediump" | "lowp"

Override the renderer's default precision for this material.

Default

null
premultipliedAlpha?: boolean

Whether to premultiply the alpha (transparency) value.

Default

false
shadowSide?: Side

Defines which side of faces cast shadows. If null, the side casting shadows is determined as follows:

  • When Material#side is set to FrontSide, the back side cast shadows.
  • When Material#side is set to BackSide, the front side cast shadows.
  • When Material#side is set to DoubleSide, both sides cast shadows.

Default

null
sharpness?: number

锐利度,可选,默认0.5

Memberof

SmogFlowMaterialParameters

side?: Side

Defines which side of faces will be rendered - front, back or both.

Default

FrontSide
stencilFail?: StencilOp

Which stencil operation to perform when the comparison function returns false.

Default

KeepStencilOp
stencilFunc?: StencilFunc

The stencil comparison function to use.

Default

AlwaysStencilFunc
stencilFuncMask?: number

The bit mask to use when comparing against the stencil buffer.

Default

0xff
stencilRef?: number

The value to use when performing stencil comparisons or stencil operations.

Default

0
stencilWrite?: boolean

Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be true.

Default

false
stencilWriteMask?: number

The bit mask to use when writing to the stencil buffer.

Default

0xff
stencilZFail?: StencilOp

Which stencil operation to perform when the comparison function returns true but the depth test fails.

Default

KeepStencilOp
stencilZPass?: StencilOp

Which stencil operation to perform when the comparison function returns true and the depth test passes.

Default

KeepStencilOp
timeSpeed?: number

扰动速度,可选,默认1

Memberof

SmogFlowMaterialParameters

toneMapped?: boolean

Defines whether this material is tone mapped according to the renderer's tone mapping setting.

It is ignored when rendering to a render target or using post processing or when using WebGPURenderer. In all these cases, all materials are honored by tone mapping.

Default

true
transparent?: boolean

Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects.

When set to true, the extent to which the material is transparent is controlled by Material#opacity.

Default

false
uniforms?: {
    [uniform: string]: IUniform;
}

An object of the form:

{
"uniform1": { value: 1.0 },
"uniform2": { value: 2 }
}

specifying the uniforms to be passed to the shader code; keys are uniform names, values are definitions of the form

{
value: 1.0
}

where value is the value of the uniform. Names must match the name of the uniform, as defined in the GLSL code. Note that uniforms are refreshed on every frame, so updating the value of the uniform will immediately update the value available to the GLSL code.

Type declaration

  • [uniform: string]: IUniform
uniformsGroups?: UniformsGroup[]

An array holding uniforms groups for configuring UBOs.

uniformsNeedUpdate?: boolean

Can be used to force a uniform update while changing uniforms in Object3D#onBeforeRender.

Default

false
userData?: Record<string, any>

An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.

uvSampleWeight?: number[] | Vector4

纹理采样权重系数,可选,默认 new Vector4( 1.0, 1.5, 2.0, 2.5 )

Memberof

SmogFlowMaterialParameters

uvScaleX?: number

纹理x方向缩放系数,可选,默认1

Memberof

SmogFlowMaterialParameters

uvScaleY?: number

纹理y方向缩放系数,可选,默认1

Memberof

SmogFlowMaterialParameters

vertexColors?: boolean

If set to true, vertex colors should be used.

The engine supports RGB and RGBA vertex colors depending on whether a three (RGB) or four (RGBA) component color buffer attribute is used.

Default

false
vertexShader?: string

Vertex shader GLSL code. This is the actual code for the shader.

visible?: boolean

Defines whether 3D objects using this material are visible.

Default

true
wireframe?: boolean

Renders the geometry as a wireframe.

Default

false
wireframeLinewidth?: number

Controls the thickness of the wireframe.

WebGL and WebGPU ignore this property and always render 1 pixel wide lines.

Default

1