Do you want to be able to view GBuffers in the scene view like you used to in BRP? Now you can!
URP Debug Draw Modes
uses Unity 6's new Render Graph framework to add various useful debug draw modes for viewing things like Albedo, Normals, the Depth Buffer, or even raw Gbuffer contents (useful when customizing the gbuffer layout).
It also serves as a useful starting point for making your own debug draw modes for your project-specific debugging needs. Especially useful if you're using a customized gbuffer layout.
Or if you miss BRP's debug draw modes. It's okay, I miss them too. The Rendering Debugger is a decent substitute but it isn't quite as convenient.
-
The first time opening the project the debug draw modes config might not load correctly. It's unclear why. If this happens it will tell you so, and it should work again once you restart.
-
After that, it should just work out of the box. New debug draw modes will appear in the Debug Draw Modes dropdown under
Deferred
-
If you want to use the advanced debug draw modes, for example to view the unfiltered Gbuffers, head to
Edit > Preferences... > URP Debug Draw Modes > Active Categories
and enable theGbuffer
category -
If you want to add your own debug draw modes, you can do so via the Custom Debug Draw Modes config. It's recommended to check out this package as a submodule in your
Packages
folder so it's easy to branch off / fork this repository and customize it to your liking.
- This package depends on the Render Graph framework which was introduced in Unity 6, so this package works for Unity 6 and above.
- This package focuses on visualizing Gbuffer contents so it expects that you're using the Deferred rendering path for your project.
- The Render Graph framework is brand new and so is this package, so things might go wrong. If they do, feel free to let me know and I will do what I can to help fix the issue.
- Config fails to load on first time startup. Unclear why. For now I've added a log message to inform users and prevent exceptions.
- Enabling the debug draw modes for the optional buffers can throw an exception if that buffer is not in use (depends on your project settings whether it is used or not)
- Re-enabling the last used debug draw mode by pressing the bug shaped button is bugged. This seems to be a Unity bug, from what I can tell it expects the last used debug draw mode to be a built-in draw mode, but these days they can also be user-made debug draw modes so it may not return a built-in draw mode and throw an exception. I recommend always using the dropdown instead.
- If you have custom user debug draw modes specified in some way other than this package, they will probably not show up. Unity's functionality for managing debug draw modes is very limited, it's necessary to clear and re-add them sometimes. You should try and move everything into one system (for example, this one).
- Perhaps support multiple configs? That way it's easier to add project-specific configs without having to modify the contents of the package itself.
Go to Edit > Project Settings > Package Manager
. Under 'Scoped Registries' make sure there is an OpenUPM entry.
If you don't have one: click the +
button and enter the following values:
- Name:
OpenUPM
- URL:
https://package.openupm.com
Then under 'Scope(s)' press the +
button and add com.roytheunissen
.
It should look something like this:
All of my packages will now be available to you in the Package Manager in the 'My Registries' section and can be installed from there.
You can check out this repository as a submodule into your project's Packages folder. This is recommended if you intend to contribute to the repository yourself.
NOTE: If you do, it's best to name the folder com.roytheunissen.urp-debug-draw-modes
to avoid a Unity warning about the folder name not matching the package name.
The package is available on the openupm registry. It's recommended to install it via openupm-cli.
openupm add com.roytheunissen.urp-debug-draw-modes
You can also install via git URL by adding this entry in your manifest.json
"com.roytheunissen.urp-debug-draw-modes": "https://github.com/RoyTheunissen/URP-Debug-Draw-Modes.git"
from Window->Package Manager, click on the + sign and Add from git: https://github.com/RoyTheunissen/URP-Debug-Draw-Modes.git