Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add FPSSample v0.3.0 HDRP Diff
  • Loading branch information
0lento committed Feb 28, 2019
1 parent 869844a commit 9ac752e
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 29 deletions.
Expand Up @@ -37,6 +37,10 @@ public float[] cascadeShadowBorders
}
}

// sample-game begin: global tweak for shadow distance
public static float shadowDistanceMultiplier = 1.0f;
// sample-game end

[Tooltip("Maximum shadow distance for all light types.")]
public NoInterpMinFloatParameter maxShadowDistance = new NoInterpMinFloatParameter(500.0f, 0.0f);

Expand Down
Expand Up @@ -439,6 +439,10 @@ Shader "HDRenderPipeline/LayeredLit"
// Define
//-------------------------------------------------------------------------------------

#ifdef LIGHTMAP_ON
#define DIRLIGHTMAP_COMBINED
#endif

// Use surface gradient normal mapping as it handle correctly triplanar normal mapping and multiple UVSet
#define SURFACE_GRADIENT
// This shader support vertex modification
Expand Down Expand Up @@ -548,9 +552,10 @@ Shader "HDRenderPipeline/LayeredLit"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT
#pragma multi_compile _ LIGHT_LAYERS
Expand Down Expand Up @@ -728,9 +733,10 @@ Shader "HDRenderPipeline/LayeredLit"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT

Expand Down
Expand Up @@ -450,6 +450,10 @@ Shader "HDRenderPipeline/LayeredLitTessellation"
// Define
//-------------------------------------------------------------------------------------

#ifdef LIGHTMAP_ON
#define DIRLIGHTMAP_COMBINED
#endif

#define TESSELLATION_ON
// Use surface gradient normal mapping as it handle correctly triplanar normal mapping and multiple UVSet
#define SURFACE_GRADIENT
Expand Down Expand Up @@ -569,9 +573,10 @@ Shader "HDRenderPipeline/LayeredLitTessellation"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT
#pragma multi_compile _ LIGHT_LAYERS
Expand Down Expand Up @@ -766,9 +771,10 @@ Shader "HDRenderPipeline/LayeredLitTessellation"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT

Expand Down
Expand Up @@ -275,6 +275,10 @@ Shader "HDRenderPipeline/Lit"
// Define
//-------------------------------------------------------------------------------------

#ifdef LIGHTMAP_ON
#define DIRLIGHTMAP_COMBINED
#endif

// Use surface gradient normal mapping as it handle correctly triplanar normal mapping and multiple UVSet
#define SURFACE_GRADIENT
// This shader support vertex modification
Expand Down Expand Up @@ -368,9 +372,10 @@ Shader "HDRenderPipeline/Lit"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT
#pragma multi_compile _ LIGHT_LAYERS
Expand Down Expand Up @@ -588,9 +593,10 @@ Shader "HDRenderPipeline/Lit"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT

Expand Down Expand Up @@ -654,9 +660,10 @@ Shader "HDRenderPipeline/Lit"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT

Expand Down
Expand Up @@ -284,6 +284,10 @@ Shader "HDRenderPipeline/LitTessellation"
// Define
//-------------------------------------------------------------------------------------

#ifdef LIGHTMAP_ON
#define DIRLIGHTMAP_COMBINED
#endif

#define TESSELLATION_ON

// Use surface gradient normal mapping as it handle correctly triplanar normal mapping and multiple UVSet
Expand Down Expand Up @@ -387,9 +391,10 @@ Shader "HDRenderPipeline/LitTessellation"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT
#pragma multi_compile _ LIGHT_LAYERS
Expand Down Expand Up @@ -628,9 +633,10 @@ Shader "HDRenderPipeline/LitTessellation"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT

Expand Down Expand Up @@ -697,9 +703,10 @@ Shader "HDRenderPipeline/LitTessellation"

#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
//#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ SHADOWS_SHADOWMASK
//#pragma multi_compile _ SHADOWS_SHADOWMASK
#define SHADOWS_SHADOWMASK
// Setup DECALS_OFF so the shader stripper can remove variants
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT

Expand Down
Expand Up @@ -12,6 +12,12 @@ public class HDRenderPipeline : RenderPipeline
{
const string k_OldQualityShadowKey = "HDRP:oldQualityShadows";

// SampleGame Change begin
public delegate void RenderCallback(HDCamera hdCamera, CommandBuffer cmd);
public RenderCallback DebugLayer2DCallback;
public RenderCallback DebugLayer3DCallback;
// SampleGame Change end

enum ForwardPass
{
Opaque,
Expand Down Expand Up @@ -776,6 +782,10 @@ public void ConfigureKeywords(bool enableBakeShadowMask, HDCamera hdCamera, Comm
CoreUtils.SetKeyword(cmd, "WRITE_MSAA_DEPTH", hdCamera.frameSettings.enableMSAA);
}

// sample-game: begin: occlusion threshold
public static float s_OcclusionThreshold;
// sample-game: end

CullResults m_CullResults;
ReflectionProbeCullResults m_ReflectionProbeCullResults;
public override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
Expand Down Expand Up @@ -1026,6 +1036,10 @@ public override void Render(ScriptableRenderContext renderContext, Camera[] came

using (new ProfilingSample(cmd, "CullResults.Cull", CustomSamplerId.CullResultsCull.GetSampler()))
{
// sample-game: begin: occlusion threshold
cullingParams.accurateOcclusionThreshold = s_OcclusionThreshold;
// sample-game: end

CullResults.Cull(ref cullingParams, renderContext, ref m_CullResults);
}

Expand Down Expand Up @@ -1387,6 +1401,11 @@ public override void Render(ScriptableRenderContext renderContext, Camera[] came
// Render pre refraction objects
RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.PreRefraction);

// SampleGame Change BEGIN
if (DebugLayer3DCallback != null)
DebugLayer3DCallback(hdCamera, cmd);
// SampleGame Change END

if (hdCamera.frameSettings.enableRoughRefraction)
{
// First resolution of the color buffer for the color pyramid
Expand Down Expand Up @@ -1489,6 +1508,11 @@ public override void Render(ScriptableRenderContext renderContext, Camera[] came
// Caution: RenderDebug need to take into account that we have flip the screen (so anything capture before the flip will be flipped)
RenderDebug(hdCamera, cmd, m_CullResults);

// SampleGame Change BEGIN
if (DebugLayer2DCallback != null)
DebugLayer2DCallback(hdCamera, cmd);
// SampleGame Change END

#if UNITY_EDITOR
// We need to make sure the viewport is correctly set for the editor rendering. It might have been changed by debug overlay rendering just before.
cmd.SetViewport(new Rect(0.0f, 0.0f, hdCamera.actualWidth, hdCamera.actualHeight));
Expand Down
Expand Up @@ -9,7 +9,7 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: DefaultHDTerrainMaterial
m_Shader: {fileID: 4800000, guid: eb607f5e8fc16e140b732f33d26c8c31, type: 3}
m_ShaderKeywords: _TERRAIN_INSTANCED_PERPIXEL_NORMAL
m_ShaderKeywords: _TERRAIN_BLEND_HEIGHT _TERRAIN_INSTANCED_PERPIXEL_NORMAL
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
Expand All @@ -27,10 +27,11 @@ Material:
m_Floats:
- _CullMode: 2
- _EditorExpendedAreas: 0
- _EnableHeightBlend: 0
- _EnableHeightBlend: 1
- _EnableInstancedPerPixelNormal: 1
- _EnableMotionVectorForVertexAnimation: 0
- _HeightTransition: 0
- _HeightTransition: 0.168
- _ReceivesSSR: 1
- _StencilRef: 2
- _StencilRefMV: 128
- _StencilWriteMask: 7
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ac752e

Please sign in to comment.