Giter VIP home page Giter VIP logo

urp_grassgeometryshader's Introduction

URP_GrassGeometryShader

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

  • For URP only
  • Supports Main Light Lighting & Shadows (both receiving and casting)
  • Grass blades sway slightly. WindStrength to adjust speed (but doesn't really look great at higher values)
  • Some optional grass blade detail based on camera distance
  • Includes tessellation (Uniform only)

urp_grassgeometryshader's People

Contributors

cyanilux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

urp_grassgeometryshader's Issues

VR Compatibility - single pass instanced?

Hi. The example works nicely in VR with multipass. I'm trying to get it to display with stereo instancing/single-pass instanced using this guide - https://docs.unity3d.com/Manual/SinglePassInstancing.html

However, no success at the moment.
In the grass.hlsl file I've inserted some lines

struct Varyings {
	//float4 positionOS   : SV_POSITION;
	float3 positionWS	: TEXCOORD1;
	float3 positionVS	: TEXCOORD2;
	float3 normal		: TEXCOORD3;
	float4 tangent		: TEXCOORD4;
	float2 texcoord		: TEXCOORD0;
	UNITY_VERTEX_INPUT_INSTANCE_ID // insert
};

and

Varyings vert (Attributes input) {
	Varyings output = (Varyings)0;

	// added code
	UNITY_SETUP_INSTANCE_ID(input);
#if defined(UNITY_COMPILER_HLSL)
#define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0;
#else
#define UNITY_INITIALIZE_OUTPUT(type,name)
#endif
	UNITY_INITIALIZE_OUTPUT(Varyings, output); //Insert
	UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); //Insert
	// added code end
...

Not sure exactly what needs to be added but any assistance appreciated.

DepthBuffer?

Hi. I use DepthBuffer for some post-processing effects and as far as I understand current shader implementation does not fully write anything there, although in the shader itself I see a "DepthOnly" pass:

image
image

Is there any way to fix that?

Mobile question

Any way to make this optimized for mobile devices? It runs but the framerate drops drastically

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.