Godot Shader Variable Visualiser
A downloadable shader
You can't use the script debugger or print statements in shaders, so I made this shader tool to debug shader variable values, by rendering them as numbers on the screen (or whatever the shader is rendering to).
How to use
As shown in the demo shaders, you need to
#include "debug_number.gdshaderinc"
and then you can use the
`am_ndbg_display_float`
function in your shaders. It has the signature:
bool am_ndbg_display_float(float number, vec2 uv, int leading_digits, int fractional_digits, int base)
- `number` is the number to display
- `uv` are the UV coordinates, within the display area
- `leading_digits` is the number of digits to display *before* the decimal separator (including any minus sign)
- `fractional_digits` is the number of digits to display *after* the decimal separator
- `base` is the base to display in, either 10 or 16
The function returns a bool, so you should use it to choose between two colours:
bool pixel = am_ndbg_display_float(...); COLOR = pixel ? color_text : color_background;
Updated | 11 hours ago |
Published | 2 days ago |
Status | Released |
Category | Assets |
Author | Asymptotic Manifolds |
Made with | Godot |
Tags | debug, Godot, Shaders |
Code license | MIT License |
Leave a comment
Log in with itch.io to leave a comment.