This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://twitter.com/Cyanilux/status/1396848736022802435 | |
// Requires a specific shader to read the _PerInstanceData buffer at SV_InstanceID | |
// I use a shader made in Shader Graph, See : https://gist.github.com/Cyanilux/4046e7bf3725b8f64761bf6cf54a16eb | |
// Also note, there's no frustum culling involved in this example. Typically a compute shader is used for this. | |
using UnityEngine; | |
public class DrawGrass : MonoBehaviour { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @Cyanilux | |
// Note : Also requires setting up "_TessellationUniform" Float in Blackboard | |
/* | |
Allows you to inject tessellation into SG & URP, but hacky / can be difficult to work with. | |
While this works, it's maybe not as useful as you might think. I believe any vertex displacement would need to be | |
taken out of the graph and moved into the domain function below (since tessellation still runs after vertex shader). | |
I thought about using the VertexDescriptionFunction from the generated code, but sadly that's generated after the injection point | |
so can't be called as it's undeclared at that point. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Render Unlit Opaque objects into CameraNormalsTexture for SSAO Depth Normals mode. | |
If you need Alpha clipping or vertex displacement, you'll need to use Depth mode, | |
or edit the generated shader code to add in the DepthNormals pass instead. | |
This is meant as an alternative if you don't need those. | |
For depthNormalsMat, I'm using a blank PBR/Lit SG with passIndex set to 4 (corresponds to it's DepthNormals pass). | |
*/ | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.Rendering; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
using UnityEditorInternal; | |
using System.IO; | |
public class Tex2DArrayCreator : EditorWindow { | |
private string fileName; | |
private List<Texture2D> textures = new List<Texture2D>(); |
NewerOlder