From 299cf8ff32cfc255ed06873592f8247d45acb137 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Tue, 25 Jul 2023 12:35:36 +0200 Subject: [PATCH] libgarbage: support instancing --- Assets/raymarched/lib/libgarbage.cginc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assets/raymarched/lib/libgarbage.cginc b/Assets/raymarched/lib/libgarbage.cginc index dff2c74..23b114e 100644 --- a/Assets/raymarched/lib/libgarbage.cginc +++ b/Assets/raymarched/lib/libgarbage.cginc @@ -82,12 +82,14 @@ START_RAYS_IN_SPHERE // TODO: implement struct AppData { float4 vertex : POSITION; + UNITY_VERTEX_INPUT_INSTANCE_ID }; struct V2F { float4 vertex : SV_POSITION; float3 cam_pos : TEXCOORD0; float3 hit_pos : TEXCOORD1; + UNITY_VERTEX_OUTPUT_STEREO }; struct FragOut { @@ -139,6 +141,9 @@ Ray cast_ray(float3 p, float3 d, float startDist = 0); V2F vert (AppData v) { V2F o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_OUTPUT(V2F, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); o.vertex = UnityObjectToClipPos(v.vertex); #ifdef USE_WORLD_SPACE o.cam_pos = _WorldSpaceCameraPos;