Shader Precompiler

An asset by CrushingJosch
The page banner background of a mountain and forest
Shader Precompiler hero image

Quick Information

0 ratings
Shader Precompiler icon image
CrushingJosch
Shader Precompiler

A small utility to precompile shaders in order to avoid game stuttering when objects first come into sight, and their shaders get lazily compiled.

Supported Engine Version
3.3
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
3 years ago
Git URL
Issue URL

ShaderPrecompiler

A small utility to precompile shader in order to avoid game stuttering when objects first come into sight, and their shaders get lazily compiled.

Just add the ShaderPrecompiler-Node in the viewframe of your active game camera. The script will recursively walk the scene tree and add a quad-mesh for each found material on a MeshInstance with a copy of that material, thus forcing compilation of the shader.

Then, for a few frames (5 by default), all these are rotated randomly and illuminated by an omni- and a spotlight. After that, the node frees itself and all its created mesh children. Also, a signal is emitted that can be used to notify other nodes that the shaders are now compiled.

To hide the generated objects for the time of these frames, place the Node behind a wall, or below a floor. It just needs to be within the camera frustum but not actually visible. Alternatively: Implement a loading screen or something that then gets hidden (e.g., using the built-in signal)

For objects that need to be pre-compiled but are not (yet) in the scene-tree, just add them to the Node itself, as shown on the screenshot. README Manually added object

Enjoy!

A small utility to precompile shaders in order to avoid game stuttering when objects first come into sight, and their shaders get lazily compiled.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Shader Precompiler icon image
CrushingJosch
Shader Precompiler

A small utility to precompile shaders in order to avoid game stuttering when objects first come into sight, and their shaders get lazily compiled.

Supported Engine Version
3.3
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
3 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers