Component:PBS DisplaceMetallic: Difference between revisions

From Resonite Wiki
Automated: update 'HighPriorityIntegration' description
Automated: update 'StencilComparison' description,'StencilOperation' description,'StencilID' description,'StencilWriteMask' description,'StencilReadMask' description,'RenderQueue' description,'BlendMode' description,'Sidedness' description,'ZWrite' description,'ZTest' description,'OffsetFactor' description,'OffsetUnits' description,
 
Line 39: Line 39:
|AlphaHandling|AlphaHandling|
|AlphaHandling|AlphaHandling|
|AlphaClip|Float|
|AlphaClip|Float|
|OffsetFactor|Float|
|OffsetFactor|Float|{{Template:Material_OffsetFactor_Desc}}
|OffsetUnits|Float|
|OffsetUnits|Float|{{Template:Material_OffsetUnits_Desc}}
|RenderQueue|Int|
|RenderQueue|Int|{{Template:Material_RenderQueue_Desc}}
|Metallic|Float|
|Metallic|Float|
|Smoothness|Float|
|Smoothness|Float|

Latest revision as of 00:01, 14 November 2024


This article or section is a Stub. You can help the Resonite Wiki by expanding it.


Component image 
PBS Displace Metallic component as seen in the Scene Inspector


Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
HighPriorityIntegration Bool If true, integrating this asset (e.g. processing procedural assets) gets higher priority than assets with this flag off. An example is user laser procedural meshes.
TextureScale Float2
TextureOffset Float2
AlbedoColor ColorX
AlbedoTexture ITexture2D
EmissiveColor ColorX
EmissiveMap ITexture2D
NormalMap ITexture2D
NormalScale Float
OcclusionMap ITexture2D
VertexDisplaceMap ITexture2D
VertexDisplaceMagnitude Float
VertexDisplaceBias Float
VertexDisplaceMapScale Float2
VertexDisplaceMapOffset Float2
UVDisplaceMap ITexture2D
UVDisplaceMagnitude Float
UVDisplaceBias Float
UVDisplaceMapScale Float2
UVDisplaceMapOffset Float2
WorldspaceVertexOffsetMap ITexture2D
WorldspaceOffsetMagnitude Float2
WorldspaceVertexOffsetMapScale Float2
WorldspaceVertexOffsetMapOffset Float2
WorldspaceOffsetPerVertex Bool
Culling Culling
AlphaHandling AlphaHandling
AlphaClip Float
OffsetFactor Float how much this material should be pushed forwards or backwards on the depth buffer factor wise
OffsetUnits Float how much this material should be pushed forwards or backwards on the depth buffer unit wise
RenderQueue Int changes at which point a material renders on the render stack
Metallic Float
Smoothness Float
MetallicMap ITexture2D
_regular Shader
_transparent Shader

Usage

The PBS Displace Metallic shader can displace the vertices of a mesh in the direction of the vertex's normal via the VertexDisplaceMap settings and the WorldSpaceVertexOffsetMap.

VertexDisplaceMap

The texture is an intensity map, so it goes from 0 (black) to 1 (white). Every vertex in the mesh is displaced along its normal by the same factor according to the following formula:

V'n ← Vn + Nn x [ T'(x,y) x M + B ]

where:

  • V'n is the displaced position of vertex n.
  • Vn is the original position of vertex n.
  • Nn is the normal vector for vertex n.
  • T(x,y) is the texture map, where x and y are in the range [-1,1], and T(x,y) is in the range [0,1].
  • T'(x,y) is the texture map after it has been scaled by VertexDisplaceMapScale and offset by VertexDisplaceMapOffset.
  • M is the VertexDisplacementMagnitude.
  • B is the VertexDisplaceBias.
  • x and y are 0 (but see WorldSpaceVertexOffsetMap below).

It is important to realize that (x,y) is simply the position in the texture that the swing of each vertex is based off of. It has nothing to do with the positions of the vertices.

Thus:

  • T, along with VertexDisplaceMapScale and VertexDisplaceMapOffset, affects the "swing" of the vertex about its original position, in the range [0,1], along the direction of the vertex's normal.
  • N is the direction and base amplitude of the "swing" of the vertex about its original position.
  • M amplifies the effect of the swing.
  • B affects the centerpoint of the vertex's swing. Set it to -M/2 for equal swing if you expect to cover T(x,y) such that you'll see its full range.

WorldSpaceVertexOffsetMap

Because the material may be applied to multiple instances of an object at different world locations, it would look strange if all the instances were displaced in exactly the same way. The WorldSpaceVertexOffsetMap adds an additional modification to the displacements of the vertices of an object at a given world position. In addition, this map allows each vertex to be affected by a different position in the VertexDisplaceMap, rather than just the (0,0) point.

The texture map for WorldSpaceVertexOffsetMap is an RGB color map.

If the vertex is at global position X,Z (the Y position is ignored), then, after the texture scale and offset are applied, the texture's value is R, G, B (each within the range [0,1]). These values have the following effect on the displacement:

  • The R channel is the offset added to x for the VertexDisplaceMap formula above.
  • The G channel is the offset added to y for the VertexDisplaceMap formula above.

Examples

Froox shows how the displace maps affect how the leaves in palm trees are affected. Note that he is using a constantly bouncing LERP from 0 to 1 to simulate the effect of wind.

EmbedVideo is missing a required parameter.

Related Components