m 989onan moved page GrayscaleMaterial to Component:GrayscaleMaterial: Misspelled title: whyyyyyyyyyyy!??!?!? |
missing info actually. don't put stub in fields leave them empty |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
<translate> | <translate> | ||
<!--T:1--> | <!--T:1--> | ||
{{Infobox Component | {{Infobox Component | ||
|Image=GrayscaleMaterialComponent.png | |Image=GrayscaleMaterialComponent.png | ||
|Name=GrayscaleMaterial | |Name=GrayscaleMaterial | ||
}} | }} | ||
The '''GrayscaleMaterial''' component is a material that allows the mapping of grayscale values from 0 to 1 to any other value. This is analogous to the [https://docs.blender.org/manual/en/latest/render/shader_nodes/converter/color_ramp.html Color Ramp] node in Blender. A common misconception is that this can only produce black and white values, however that is only the default gradient, and a user-provided '''Gradient''' texture allows for various colored effects. | |||
GrayscaleMaterial is a material that allows the mapping of grayscale values from 0 to 1 to any other value. This is analogous to the [https://docs.blender.org/manual/en/latest/render/shader_nodes/converter/color_ramp.html Color Ramp] node in Blender. A common misconception is that this can only produce black and white values, however that is only the default gradient, and a user-provided '''Gradient''' texture allows for various colored effects. | |||
<!--T:3--> | <!--T:3--> | ||
== Usage == | == Usage == | ||
{{Table ComponentFields | {{Table ComponentFields | ||
|HighPriorityIntegration|Bool| {{ | |HighPriorityIntegration|Bool|{{Asset HighPriorityIntegration Field}} | ||
|Rect|Rect| | |Rect|Rect| | ||
|RectClip|Bool| | |RectClip|Bool| | ||
|ColorMask|ColorMask|The color channels to affect | |ColorMask|ColorMask|The color channels to affect | ||
|StencilComparison|StencilComparison| {{ | |StencilComparison|StencilComparison|{{Template:Material_StencilComparison_Desc}} | ||
|StencilOperation|StencilOperation| {{ | |StencilOperation|StencilOperation|{{Template:Material_StencilOperation_Desc}} | ||
|StencilID|Byte| {{ | |StencilID|Byte|{{Template:Material_StencilID_Desc}} | ||
|StencilWriteMask|Byte| {{ | |StencilWriteMask|Byte|{{Template:Material_StencilWriteMask_Desc}} | ||
|StencilReadMask|Byte| {{ | |StencilReadMask|Byte|{{Template:Material_StencilReadMask_Desc}} | ||
|RenderQueue|Int| {{ | |RenderQueue|Int|{{Template:Material_RenderQueue_Desc}} | ||
|_shader|{{RootFieldType|AssetRef`1|[[Type:Shader|Shader]]}}|TypeAdv10=true| | |_shader|{{RootFieldType|AssetRef`1|[[Type:Shader|Shader]]}}|TypeAdv10=true| internal. | ||
|RatioRed|Float|The proportion of red to use for grayscale computation | |RatioRed|Float|The proportion of red to use for grayscale computation | ||
|RatioGreen|Float|The proportion of green to use for grayscale computation | |RatioGreen|Float|The proportion of green to use for grayscale computation | ||
Line 32: | Line 27: | ||
|Lerp|Float|How much to passthrough of the original (0) or use the filter (1) | |Lerp|Float|How much to passthrough of the original (0) or use the filter (1) | ||
|Gradient|{{RootFieldType|AssetRef`1|[[Type:ITexture2D|ITexture2D]]}}|TypeAdv15=true|A texture which maps black values on its far left and white values on its far right | |Gradient|{{RootFieldType|AssetRef`1|[[Type:ITexture2D|ITexture2D]]}}|TypeAdv15=true|A texture which maps black values on its far left and white values on its far right | ||
|BlendMode|BlendMode| {{ | |BlendMode|BlendMode|{{Template:Material_BlendMode_Desc}} | ||
|Sidedness|Sidedness| {{ | |Sidedness|Sidedness|{{Template:Material_Sidedness_Desc}} | ||
|ZWrite|ZWrite| {{ | |ZWrite|ZWrite|{{Template:Material_ZWrite_Desc}} | ||
|ZTest|ZTest| {{ | |ZTest|ZTest|{{Template:Material_ZTest_Desc}} | ||
}} | }} | ||
Line 61: | Line 56: | ||
== Related Components == | == Related Components == | ||
</translate> | </translate> | ||
[[Category:ComponentStubs]] | |||
[[Category:Components{{#translation:}}|Grayscale Material]] | [[Category:Components{{#translation:}}|Grayscale Material]] | ||
[[Category:Components:Assets:Materials:Filters{{#translation:}}|Grayscale Material]] | [[Category:Components:Assets:Materials:Filters{{#translation:}}|Grayscale Material]] | ||
[[Category:Materials:Filters{{#translation:}}|Grayscale Material]] | [[Category:Materials:Filters{{#translation:}}|Grayscale Material]] | ||
[[Category:Materials{{#translation:}}|Grayscale Material]] | [[Category:Materials{{#translation:}}|Grayscale Material]] |
Latest revision as of 20:22, 19 November 2024
The GrayscaleMaterial component is a material that allows the mapping of grayscale values from 0 to 1 to any other value. This is analogous to the Color Ramp node in Blender. A common misconception is that this can only produce black and white values, however that is only the default gradient, and a user-provided Gradient texture allows for various colored effects.
Usage
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. |
Rect
|
Rect | |
RectClip
|
Bool | |
ColorMask
|
ColorMask | The color channels to affect |
StencilComparison
|
StencilComparison | See Type:StencilComparison for an in depth explanation on what this does. |
StencilOperation
|
StencilOperation | See Type:StencilOperation for an in depth explanation on what this does. |
StencilID
|
Byte | The Stencil ID of this material. This is sometimes written to the frame buffer's Stencil mask, or used to determine whether this material should render for a particular pixel. |
StencilWriteMask
|
Byte | does a Bitwise AND with this number for every pixel in the frame buffer this is rendering on top of when this object is drawn, after reading from the buffer. |
StencilReadMask
|
Byte | is bitwise ANDed with the Stencil in the frame buffer before the test compares them. |
RenderQueue
|
Int | changes at which point a material renders on the render stack |
_shader
|
Shader | internal. |
RatioRed
|
Float | The proportion of red to use for grayscale computation |
RatioGreen
|
Float | The proportion of green to use for grayscale computation |
RatioBlue
|
Float | The proportion of blue to use for grayscale computation |
Lerp
|
Float | How much to passthrough of the original (0) or use the filter (1) |
Gradient
|
ITexture2D | A texture which maps black values on its far left and white values on its far right |
BlendMode
|
BlendMode | How to blend this material's colors vs what it rendered on top of. |
Sidedness
|
Sidedness | Render on both sides of the mesh, front, or back. |
ZWrite
|
ZWrite | whether this material should respect the distance it is from the camera. |
ZTest
|
ZTest | Determines whether this object should render when it is in front of or behind other objects that respect depth from the camera |
Behavior
This material acts as a filter which applies on top of other materials.
It first computes a grayscale value for all pixels that overlap with the filter which is computed through a weighted combination of Red, Green, and Blue values that can be directly controlled through the respective ratio inputs.
A user-provided Gradient texture defines how these values are then remapped. The leftmost part of this texture defines what color will correspond to Black (0) and the rightmost part of this texture defines the color that maps to White (1). It is important to set the WrapModeU of this texture to Clamp or else it will bleed values from either side of the texture.
The Lerp field allows you to transition between having the filter off (0) and fully on (1).
Examples