Skip to content

Commit

Permalink
add grab pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed Feb 4, 2019
1 parent 8af89af commit bd7f6fe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
Expand Up @@ -102,6 +102,10 @@ inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o)

ENDCG

@if UseGrabPass : false
GrabPass {}
@endif

Pass
{
Tags { "LightMode" = "ForwardBase" }
Expand Down
Expand Up @@ -96,6 +96,10 @@ inline void PostEffect(RaymarchInfo ray, inout PostEffectOutput o)

ENDCG

@if UseGrabPass : false
GrabPass {}
@endif

Pass
{
Tags { "LightMode" = "ForwardBase" }
Expand Down
2 changes: 2 additions & 0 deletions Assets/uRaymarching/Shaders/Include/Raymarching.cginc
Expand Up @@ -50,6 +50,7 @@ inline void InitRaymarchFullScreen(out RaymarchInfo ray, float4 projPos)
{
UNITY_INITIALIZE_OUTPUT(RaymarchInfo, ray);
ray.rayDir = GetCameraDirection(projPos);
ray.projPos = projPos;
#if defined(USING_STEREO_MATRICES)
float3 cameraPos = unity_StereoWorldSpaceCameraPos[unity_StereoEyeIndex];
cameraPos += float3(1., 0, 0) * unity_StereoEyeIndex;
Expand All @@ -64,6 +65,7 @@ inline void InitRaymarchObject(out RaymarchInfo ray, float4 projPos, float3 worl
{
UNITY_INITIALIZE_OUTPUT(RaymarchInfo, ray);
ray.rayDir = normalize(worldPos - GetCameraPosition());
ray.projPos = projPos;
ray.startPos = worldPos;
ray.polyNormal = worldNormal;
ray.maxDistance = GetCameraFarClip();
Expand Down
1 change: 1 addition & 0 deletions Assets/uRaymarching/Shaders/Include/Structs.cginc
Expand Up @@ -18,6 +18,7 @@ struct RaymarchInfo
float3 startPos;
float3 rayDir;
float3 polyNormal;
float4 projPos;
float minDistance;
float maxDistance;
int maxLoop;
Expand Down

0 comments on commit bd7f6fe

Please sign in to comment.