It is possible to extend Unity’s rendering pipeline with so called “command buffers”.
A command buffer holds list of renderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
See in Glossary commands (“set render target, draw mesh, …”), and can be
set to execute at various points during cameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary rendering.
For example, you could render some additional objects into deferred shadingA rendering path that places no limit on the number of lights that can affect a GameObject. All lights are evaluated per-pixel, which means that they all interact correctly with normal maps and so on. Additionally, all lights can have cookies and shadows. More info
See in Glossary
G-buffer after all regular objects are done.
A high-level overview of how cameras render sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary in Unity is shown below. At each point
marked with a green dot, you can add command buffers to execute your commands.
See CommandBuffer scripting class and CameraEvent enum for more details.
Command buffers can also be used as a replacement for, or in conjunction with image effects.
Sample project demonstrating some of the techniques possible with command buffers: RenderingCommandBuffers.zip.
This scene shows a “blurry refraction” technique.
After opaque objects and skyboxA special type of Material used to represent skies. Usually six-sided. More info
See in Glossary is rendered, current image is copied into a temporary
render target, blurred and set up a global shader property. ShaderA small script that contains the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. More info
See in Glossary on the glass
object then samples that blurred image, with UV coordinates offset based on a normal map
to simulate refraction.
This is similar to what shader GrabPass does does, except you can do more custom things (in this case, blurring).
This scene shows an implementation of “custom deferred lights”: sphere-shaped lights, and tube-shaped lights.
After regular deferred shading light pass is done, a sphere is drawn for each custom light, with a shader that computes illumination and adds it to the lighting buffer.
This scene shows a basic implementation of “deferred decals”.
The idea is: after G-buffer is done, draw each “shape” of the decal (a box) and modify the G-buffer contents. This is very similar to how lights are done in deferred shading, except instead of accumulating the lighting we modify the G-buffer textures.
Each decal is implemented as a box here, and affects any geometry inside the box volume.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thanks for helping to make the Unity documentation better!