-
Notifications
You must be signed in to change notification settings - Fork 40
The show() Function
The show() variable allows you to quickly visualize what a variable is across the screen.
- Call the show() command, with your visualization variable as the argument
- Enable debugging mode in the options screen (Options > Debug)
- Set "Debug Shader View" to match the shader you're working in (Options > Debug)
The show() command functions by assigning your variable to a global variable, which is returned at the end of the file. Because of this, if show() appears more than once in a single file, the final occurance is likely to overwrite the any others. For this reason, you must remember to remove the any calls to show() when you're done with them.
If you wanted to visualize the reflections in composite2.fsh:
- Place
show(reflection);at the point in the code where you want to show the reflections - Turn
Debug ModeONin the debug options screen (Options > Debug) - Set
Debug Shader Viewto2in the debug options screen (Options > Debug)
Your variable is assigned to Debug in the working shader.
At the end of the working shader, "/lib/Debug.glsl" is called.
In order to get Debug through the shading pipeline and onto the screen without being affected, special operations must be performed in all fragment shaders following the working shader if these proceeding shaders overwrite the buffer that the debug variable is inside. If a shader does not overrite the debug buffer, then it can be discarded.
Basically, "/lib/Debug.glsl" handles the re-routing of the debug variable through the shading pipeline.