日本語ドキュメント(Japanese Documents Available)
Replacement for GrabPass in Unity's Universal Render Pipeline (URP).
- You can get the camera's color texture at the following timings.
- After drawing opaque objects
- After drawing transparent objects
- Then you can use it in your shader.
- In contrast to URP's _CameraOpaqueTexture, you can also get the color texture after drawing semi-transparent objects.
Universal RP 10.2.0 or higher.
Unity2020.2.3f1 or higher.
VR is not supported.
- Follow the manual below to set up the URP.
- https://docs.unity3d.com/Packages/[email protected]/manual/InstallingAndConfiguringURP.html
- Open the Package Manager from Window > Package Manager
- "+" button > Add package from git URL
- Enter the following
Or, open Packages/manifest.json and add the following to the dependencies block.
{
"dependencies": {
"com.harumak.urpgrabpass": "https://github.com/Haruma-K/URPGrabPass.git?path=/Assets/URPGrabPass"
}
}
If you want to set the target version, specify it like follow.
- Add the Grab Pass Renderer Feature from the inspector of the Forward Renderer Data.
- Change the properties of the Renderer Feature if necessary.
Property Name | Description |
---|---|
Name | Name of the Renderer Feature. |
Timing | When to get and use the camera's color texture. |
Grabbed Texture Name | Name of the grabbed texture when it is used in the shader. |
Shader Light Modes | LightModes for shaders that use the texture. |
Sorting Criteria | How to sort objects during rendering. |
- Write the shader that uses the texture.
- The shader must have the LightMode specified in the Renderer Feature.
- You can get the texture by the name specified in the Renderer Feature.
- Sample: https://github.com/Haruma-K/URPGrabPass/blob/master/Assets/Demo/Shaders/shader_demo_usegrabbedtexture.shader
- Assign this shader to the material to render it.
- Objects with this material will be rendered immediately after the texture is grabbed.
- Clone this repository.
- Open the following scene.
This software is released under the MIT License.
You are free to use it within the scope of the license.
However, the following copyright and license notices are required for use.