• Stars
    star
    565
  • Rank 78,418 (Top 2 %)
  • Language
    C#
  • License
    MIT License
  • Created about 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Blit Render Feature for Universal RP's Forward Renderer. Set specific source/destination via camera source, ID string or RenderTexture asset. Also options for _InverseView matrix and _CameraNormalsTexture generation.

Blit Renderer Feature

  • Used to apply fullscreen image effects to camera (or other source/destination) using a shader/material.
  • Tested with 2021.2.5f1 / URP v12.1.2. Should still work with older versions, otherwise see branches for 2019-2021.1 version.
  • Note : Unity/URP 2022.2+ now has a Fullscreen Graph and built-in Fullscreen Pass Renderer Feature which essentially replaces this feature when blitting using camera targets. (But if you want more injection points and different destinations see the 2022.1 branch)
  • This version uses CommandBuffer.Blit so will not work in Single-Pass Instanced VR. Try using cmd-DrawMesh version instead.

Setup:

  • Install via Package Manager β†’ Add package via git URL :
    • https://github.com/Cyanilux/URP_BlitRenderFeature.git
  • Alternatively, download and put the folder in your Assets

Usage :

  • Adds "Blit" option to Renderer Features list on Forward/Universal asset (and 2D Renderer if in 2021.2+)
  • The shader/material used should sample _MainTex to obtain source. Will work with Shader Graphs too (as long as you set the texture Reference in the Blackboard / Node Settings)
  • Feature allows specific access to selecting the source and destination targets (via Camera, TextureID or Render Texture object)
  • Some usage examples :
    • Could be used with Camera for both source/destination to apply an shader/material as an image effect / post process
    • Could be used to copy the camera source to a TextureID. Similar to what the Opaque Texture / Scene Color does. (When TextureID is used in destination it automatically creates a Temporary Render Texture, and should also set it as a global texture so it can be obtained in shaders rendered later. May want to avoid using IDs that already exist)
    • Could be used with Render Texture object source (rendered by a second camera) and Camera destination to apply it to the Main Camera

Additional Features :

  • Option to set an _InverseView matrix (cameraToWorldMatrix), for shaders that might need it to handle calculations from screen space to world. For example, reconstructing world position from depth, see : https://twitter.com/Cyanilux/status/1269353975058501636
  • (2020.2/v10+) Enabling generation of DepthNormals (_CameraNormalsTexture)

Author / Sources :

More Repositories

1

URP_ShaderGraphCustomLighting

Some custom lighting functions/sub-graphs for Shader Graph, Universal Render Pipeline
HLSL
524
star
2

URP_ShaderCodeTemplates

A few shader code templates/examples for Unity, Universal Render Pipeline (URP v10 / Unity 2020.3). ShaderLab & HLSL.
ShaderLab
267
star
3

ShaderGraphVariables

Adds 'Register Variable' and 'Get Variable' nodes to Shader Graph, allowing you to link sections of a graph without connection wires. <3
C#
251
star
4

URP_WatercolourShaders

A few experiments with watercolour-like shader effects made using Shader Graph. Unity 2020.1.2f1, URP 8.2.0
C#
180
star
5

BakeShader

Unity editor tool for baking shaders to textures. Texture2D, Texture3D, Flipbook, or MeshRenderer (uses model UV)
C#
163
star
6

URP_RetroCRTShader

A shader graph which replicates some retro tv/monitor effects. CRT (cathode-ray tube) warping, scanlines, static, distortion, etc.
C#
141
star
7

Cards

A few scripts which controls interactions for a hand of cards. Card model, shadergraph and example setup included.
C#
128
star
8

ShaderGraphToPNG

Screenshots a Shader Graph in multiple sections, stitches them together and saves the result as a PNG
C#
117
star
9

ToDo

Unity in-editor to-do list, attached as a component and uses a custom inspector based on ReorderableList. Also see branches for ScriptableObject / cross-scene reference version.
C#
81
star
10

URP_GrassGeometryShader

Example of a Grass Geometry Shader for Unity, Universal Render Pipeline. Based on https://github.com/IronWarrior/UnityGrassGeometryShader
HLSL
63
star
11

cyanilux.github.io

Tutorial/blog site, generated using Hugo
HTML
2
star