Optional
parameters: WaterFlowMaterialParametersWhether it's possible to override the material with Scene#overrideMaterial or not.
true
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.
false
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.
false
Represents the alpha value of the constant blend color.
This property has only an effect when using custom blending with ConstantAlpha
or OneMinusConstantAlpha
.
0
Represents the RGB values of the constant blend color.
This property has only an effect when using custom blending with ConstantColor
or OneMinusConstantColor
.
(0,0,0)
Defines the blending destination factor.
OneMinusSrcAlphaFactor
Defines the blending destination alpha factor.
null
Defines the blending equation.
AddEquation
Defines the blending equation of the alpha channel.
null
Defines the blending source factor.
SrcAlphaFactor
Defines the blending source alpha factor.
null
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.
NormalBlending
Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union.
false
Defines whether to clip shadows according to the clipping planes specified on this material.
false
Defines whether this material supports clipping; true
to let the renderer
pass the clippingPlanes uniform.
false
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
.
null
Whether to render the material's color.
This can be used in conjunction with Object3D#renderOder to create invisible objects that occlude other objects.
true
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.
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
Defines the depth function.
LessEqualDepth
Whether to have depth test enabled when rendering this material. When the depth test is disabled, the depth write will also be implicitly disabled.
true
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.
true
Whether to apply dithering to the color to remove the appearance of banding.
false
This object allows to enable certain WebGL 2 extensions.
true
to use vertex shader clippingtrue
to use vertex shader multi_draw / enable gl_DrawIDDefine whether the material color is affected by global fog settings; true
to pass fog uniforms to the shader.
false
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.
false
Fragment shader GLSL code. This is the actual code for the shader.
Defines the GLSL version of custom shader code.
null
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.
undefined
Readonly
isThis flag can be used for type testing.
true
Readonly
isThis flag can be used for type testing.
true
Defines whether this material uses lighting; true
to pass uniform data
related to lighting to this shader.
false
Controls line thickness or lines.
WebGL and WebGPU ignore this setting and always render line primitives with a width of one pixel.
1
The name of the material.
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.
1
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.
false
Specifies a scale factor that is used to create a variable depth offset for each polygon.
0
Is multiplied by an implementation-specific value to create a constant depth offset.
0
Override the renderer's default precision for this material.
null
Whether to premultiply the alpha (transparency) value.
false
Defines which side of faces cast shadows. If null
, the side casting shadows
is determined as follows:
FrontSide
, the back side cast shadows.BackSide
, the front side cast shadows.DoubleSide
, both sides cast shadows.null
Defines which side of faces will be rendered - front, back or both.
FrontSide
Which stencil operation to perform when the comparison function returns false
.
KeepStencilOp
The stencil comparison function to use.
AlwaysStencilFunc
The bit mask to use when comparing against the stencil buffer.
0xff
The value to use when performing stencil comparisons or stencil operations.
0
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
.
false
The bit mask to use when writing to the stencil buffer.
0xff
Which stencil operation to perform when the comparison function returns
true
but the depth test fails.
KeepStencilOp
Which stencil operation to perform when the comparison function returns
true
and the depth test passes.
KeepStencilOp
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.
true
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.
false
Readonly
typeThe type property is used for detecting the object type in context of serialization/deserialization.
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.
An array holding uniforms groups for configuring UBOs.
Can be used to force a uniform update while changing uniforms in Object3D#onBeforeRender.
false
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.
Readonly
uuidThe UUID of the material.
Readonly
versionThis starts at 0
and counts how many times Material#needsUpdate is set to true
.
0
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.
false
Vertex shader GLSL code. This is the actual code for the shader.
Defines whether 3D objects using this material are visible.
true
Renders the geometry as a wireframe.
false
Controls the thickness of the wireframe.
WebGL and WebGPU ignore this property and always render 1 pixel wide lines.
1
透明度
WaterFlowMaterial
Sets the alpha value to be used when running an alpha test. The material will not be rendered if the opacity is lower than this value.
0
颜色
WaterFlowMaterial
颜色强度
WaterFlowMaterial
流向强度
WaterFlowMaterial
Setting this property to true
indicates the engine the material
needs to be recompiled.
false
水流变换速度
WaterFlowMaterial
UV缩放X方向
WaterFlowMaterial
UV缩放Y方向
WaterFlowMaterial
设置水波偏移
WaterFlowMaterial
设置水波分辨率
WaterFlowMaterial
设置水波大小
WaterFlowMaterial
设置水波流速
WaterFlowMaterial
设置水波叠加数量
WaterFlowMaterial
Adds a listener to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Returns a new material with copied values from this instance.
A clone of this instance.
Copies the values of the given material to this instance.
The material to copy.
A reference to this instance.
In case Material#onBeforeCompile is used, this callback can be used to identify
values of settings used in onBeforeCompile()
, so three.js can reuse a cached
shader or recompile the shader for this material as needed.
This method can only be used when rendering with WebGLRenderer.
The custom program cache key.
Checks if listener is added to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
An optional callback that is executed immediately before the shader program is compiled. This function is called with the shader source code as a parameter. Useful for the modification of built-in materials.
This method can only be used when rendering with WebGLRenderer. The
recommended approach when customizing materials is to use WebGPURenderer
with the new
Node Material system and [TSL]https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language.
A reference to the renderer.
An optional callback that is executed immediately before the material is used to render a 3D object.
This method can only be used when rendering with WebGLRenderer.
The renderer.
The scene.
The camera that is used to render the scene.
The 3D object's geometry.
The 3D object.
The geometry group data.
Removes a listener from an event type.
The type of the listener that gets removed.
The listener function that gets removed.
水流效果材质
Export
Date
2023.12.13
Author
xwb