Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 893 Bytes

ShaderForge.md

File metadata and controls

39 lines (30 loc) · 893 Bytes

Use in Shader Forge

Shader Forge Example

ShaderForge Code Node

Steps

Include the CGINC file

Add the Dither Functions.cginc file to the shader in the "Shader Settings" panel

Code Node

Add a code node

Properties

Add the properties scoord as a float2 and alpha as a float

Code

Set the code body to

// screen space position in pixels
float2 spos = (scoord / 2 + float2(0.5, 0.5));

// 0 for clip and 1 for opaque
return ceil(isDithered(spos, alpha));

For Clip Mask

Shader Forge Example

Properties

Add mask as a sampler2D and maskScale as float

Code

Set the code body to

// screen space position in pixels
float2 spos = (scoord / 2 + float2(0.5, 0.5));

// 0 for clip and 1 for opaque
return ceil(isDithered(spos, alpha, mask, maskScale));