NovaShader
Multi-functional shader for the Particle System that supports Universal Render Pipeline (URP) of Unity.
Install / Use
/learn @CyberAgentGameEntertainment/NovaShaderREADME
NOVA Shader: Uber shader for Particle System
Docs (English, 日本語) | Samples (English, 日本語) | Demo (English, 日本語)
NOVA Shader is a multi-functional shader for the Particle System that supports Universal Render Pipeline (URP). General-purpose functions commonly used in visual effects are implemented so you can create high-quality effects efficiently.
<p align="center"> <img width="70%" src="https://user-images.githubusercontent.com/47441314/144193003-53bcaa8a-b9a2-4b79-a1de-aa7b001abdaa.gif" alt="Sample1"> </p> <p align="center"> <img width="70%" src="https://user-images.githubusercontent.com/47441314/144192957-64e63c4a-3644-4a08-8134-dcbeb85d5493.gif" alt="Sample2"><br> <font color="grey">Author: </font><a href="https://twitter.com/Ugokashiya">@Ugokashiya</a> </p>It implements some distinctive features like Flow Map, Flip-Book (sequential texture animation), Dissolve, Fade, Rotation, Animated Tint Map, Emission, Distortion, and so on.
<p align="center"> <img width="70%" src="https://user-images.githubusercontent.com/47441314/143531706-7f0230bb-4e4f-41de-9dbf-1586f295225c.gif" alt="Features"><br> <font color="grey">Features</a> </p>For more information, please refer to the following documents, Samples and Demo.
Table of Contents
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <details> <summary>Details</summary>- Setup
- Usage
- Uber Unlit Shader
- Uber Lit Shader
- Distortion Shader
- Uber Unlit/Lit shaders( for uGUI )
- Abort Shadow Caster
- Use with the Custom Vertex Streams
- Use Mesh GPU Instancing
- Automatic set up the Custom Vertex Streams.
- Remove Unused Parameter References
- Reducing Memory Usage with Optimized Shaders
- Editor APIs Reference
- Licenses
Setup
Requirements
This library is compatible with the following environments.
- Unity 2022.3 LTS or higher
- Universal Render Pipeline
- Shader Model 3.5
Note that Shader Model 4.5 is required to use Mesh GPU Instancing. And also, if you want to use Mirror Sampling, your hardware needs to support Inline Sampler States. And if you are using 3D Texture or 2D Texture Array, the compression format must support them.
And this document assumes that you have already set up the Universal Render Pipeline. For more information about the Universal Render Pipeline, please refer to the Unity Manual
Install
To install the software, follow the steps below.
- Open the Package Manager from
Window > Package Manager "+" button > Add package from git URL- Enter the following
- https://github.com/CyberAgentGameEntertainment/NovaShader.git?path=/Assets/Nova
Or, open Packages/manifest.json and add the following to the dependencies block.
{
"dependencies": {
"jp.co.cyberagent.nova": "https://github.com/CyberAgentGameEntertainment/NovaShader.git?path=/Assets/Nova"
}
}
If you want to set the target version, write as follows.
- https://github.com/CyberAgentGameEntertainment/NovaShader.git?path=/Assets/Nova#1.0.0
Note that if you get a message like No 'git' executable was found. Please install Git on your system and restart Unity, you will need to set up Git on your machine.
To update the version, rewrite the version as described above.
If you don't want to specify a version, you can also update the version by editing the hash of this library in the package-lock.json file.
{
"dependencies": {
"jp.co.cyberagent.nova": {
"version": "https://github.com/CyberAgentGameEntertainment/NovaShader.git?path=/Assets/Nova",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "..."
}
}
}
Usage
Add Renderer Feature
First, set up the Renderer Feature to apply Distortion. Click Add Renderer Feature > Screen Space Distortion from the bottom of the Inspector of the ForwardRendererData asset.
<p align="center"> <img width="60%" src="https://user-images.githubusercontent.com/47441314/195064231-02e0798d-bc3a-4bb2-b2fb-d9d28f65cd1a.png" alt="Add Screen Space Distortion"><br> <font color="grey">Add Screen Space Distortion</font> </p>Confirm that Screen Space Distortion has been added as shown below.
<p align="center"> <img width="60%" src="https://user-images.githubusercontent.com/47441314/195064556-c9192bbc-7a82-4726-98dc-ef3a878d7b63.png" alt="Screen Space Distortion"><br> <font color="grey">Screen Space Distortion</font> </p>Note
This setting is not necessary if you do not use the Distortion Shader.
Activate Depth Texture
Next, activate Depth Texture to use the Soft Particles or Depth Fade features. Check Depth Texture in the UniversalRenderPipelineAsset Inspector.
<p align="center"> <img width="60%" src="https://user-images.githubusercontent.com/47441314/195065590-29935b9a-5088-46c3-9cd9-50f496aa1c6e.png" alt="Depth Texture"><br> <font color="grey">Depth Texture</font> </p>Depth Texture setting is also found in each Camera, so set it as necessary.
Note
This setting is not necessary if neither Soft Particles nor Depth Fade is used.
Create and assign the Material
Next, create a material with the Nova shader. Create a material and set the shader to Nova/Particles/UberUnlit and assign a texture to the Base Map.
<p align="center"> <img width="60%" src="https://user-images.githubusercontent.com/47441314/195066541-45cc854f-86ed-4b9d-b1db-7ebf3b9c6306.png" alt="Material"><br> <font color="grey">Material</font> </p>After creating a Particle System and assigning this material, you will see particles with the specified texture.
<p align="center"> <img width="60%" src="https://user-images.githubusercontent.com/47441314/195067160-2235ee34-3fcd-47a0-b6e2-8b1595aeb994.png" alt="Particle"><br> <font color="grey">Particle</font> </p>For more information on each shader and each function, see the sections below.
Uber Unlit Shader
The Uber Unlit shader is a multifunctional shader with no lighting applied. Use this shader for particles that do not need lighting, such as glowing effects.
To use this shader, assign the Nova/Particles/UberUnlit shader to your material. The following is the description of each property that can be set from the Inspector.
Render Settings
The Render Settings control how the Material is rendered.
<p align="center"> <img width="60%" src="Documentation~/Images/unlit_rendersettings_01.png" alt="Render Settings"><br> <font color="grey">Render Settings</font> </p> <table width="100%"> <thead> <tr><td colspan="3"><b>Property Name</b></td><td><b>Description</b></td></tr> </thead> <tbody> <tr><td colspan="3"><b>Render Type</b></td><td> <p> You can specify the type of rendering from the following options. </p> <p> <ul> <li>Opaque</li