GShader Library
— a shader library that serves as the foundation for creating Deferred Renderer (shading & lighting) shaders, acting as a convenient tool for creating advanced post-processing effects.
- _rt_WPDepth
- _rt_NormalsTangents
- _rt_Velocity
- _rt_ResolvedFullFrameDepth
- _rt_Bump
- _rt_Fog
- Reconstruction of WorldPos, WorldNormals and Tangents from _rt_ResolvedFullFrameDepth.
- Normal smoothing.
- Increasing the bit depth of the depth buffer _rt_ResolvedFullFrameDepth.
- View and projection matrices: View, Proj, ViewProj. For perspective and orthogonal projection.
- Newly discovered texture formats that allow more flexible work with shaders.
- Encoding Normals and Tangents into a single texture, packing WorldPos and Depth, which will fit within the 4-texture limit in screenspace_general.
- Choice of normal reconstruction method[wickedengine.net]: Simple, 3 Tap, Improved, Accurate[atyuwen.github.io].
- Function shaderlib.DrawScreenQuad() with Multiple Render Target support.
- Function shaderlib.DrawVertexScreenQuad() with input data to vertex shader and MRT support. More info here: Example 6[github.com].
- Velocity Buffer.
Normals and Tangents are stored in the render target _rt_NormalsTangents, where:
- .RG — Normals
- .B — Tangents
- .A — Sign: A value of 1 or -1. It will help you with lighting and creating Post-Process Parallax Mapping.
Normals are encoded using Octahedron normal vector encoding [knarkowicz.wordpress.com]
Normal decoding is done via the function:
Tangents are encoded using Diamond Encoding [www.jeremyong.com]
Tangent decoding is done via the function:
WorldPos and Depth are stored in the render target _rt_WPDepth, where:
- .RGB — 1/WorldPos: This means that WorldPos is packed into values <1. To unpack, use float3 worldPos = 1/tex2D(WPDepthBuffer,uv).xyz; in the shader.
- .A — Depth
The depth buffer does not write translucent objects, so you will most likely render shaders in the PreDrawTranslucentRenderables [wiki.facepunch.com] hook.
Meetric [github.com] — WorldPos reconstruction.
notunknowndude— the idea to improve the depth buffer.
puwada — the tip about texture format compatibility and DirectX.
LVutner [github.com] — implementation Velocity Buffer encoding of CryTeck method.
- GShaders discord [discord.gg]
- Beginner’s shader guide [github.com]
- Shader creation basics [github.com]
- GitHub repository [github.com]
- EGSM – here are some shader examples that might be useful [github.com]
SHADERS FOR EVERYONE!!!! i have no idea wtf is going on
P.S. Shader examples are not in the addon. Screenshots show what the GShader library allows you to do.