Skip to content

Commit df7f42e

Browse files
committed
Merge branch 'master' into batch_rendering
# Conflicts: # Assets/TestScenes/HDTest/GlobalIlluminationTest.unity # Assets/TestScenes/HDTest/GlobalIlluminationTest/LightingData.asset # Assets/TestScenes/HDTest/GlobalIlluminationTest/LightingData.asset.meta # Assets/TestScenes/HDTest/HDRI.meta # ProjectSettings/GraphicsSettings.asset # ProjectSettings/ProjectSettings.asset
2 parents 9198085 + e0428d8 commit df7f42e

337 files changed

Lines changed: 13573 additions & 3709 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using UnityEngine;
44
using UnityEngine.Rendering;
55
using UnityEngine.Experimental.Rendering;
6-
using UnityEngine.ScriptableRenderPipeline;
76

87
// Very basic scriptable rendering loop example:
98
// - Use with BasicRenderLoopShader.shader (the loop expects "BasicPass" pass type to exist)
@@ -71,15 +70,15 @@ public static void Render(ScriptableRenderContext context, IEnumerable<Camera> c
7170
var settings = new DrawRendererSettings(cull, camera, new ShaderPassName("BasicPass"));
7271
settings.sorting.flags = SortFlags.CommonOpaque;
7372
settings.inputFilter.SetQueuesOpaque();
74-
context.DrawRenderers(ref settings);
73+
context.DrawRenderers(settings);
7574

7675
// Draw skybox
7776
context.DrawSkybox(camera);
7877

7978
// Draw transparent objects using BasicPass shader pass
8079
settings.sorting.flags = SortFlags.CommonTransparent;
8180
settings.inputFilter.SetQueuesTransparent();
82-
context.DrawRenderers(ref settings);
81+
context.DrawRenderers(settings);
8382

8483
context.Submit();
8584
}

Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
using System;
2-
using System.Collections.Generic;
31
using UnityEngine;
42
using UnityEditor;
53
using UnityEngine.Experimental.Rendering;
64
using NUnit.Framework;
75
using UnityEngine.Rendering;
8-
using UnityEngine.ScriptableRenderPipeline;
96

107
[ExecuteInEditMode]
118
public class RenderLoopTestFixture : RenderPipelineAsset
@@ -56,7 +53,7 @@ public static void Run(TestDelegate renderCallback)
5653
var sceneCamera = Camera.main;
5754
var camObject = sceneCamera.gameObject;
5855

59-
GraphicsSettings.renderPipeline = m_Instance;
56+
GraphicsSettings.renderPipelineAsset = m_Instance;
6057
s_Callback = renderCallback;
6158
Transform t = camObject.transform;
6259

@@ -67,6 +64,6 @@ public static void Run(TestDelegate renderCallback)
6764
SceneView.lastActiveSceneView.LookAtDirect(t.position + t.forward * camDist, t.rotation, size);
6865

6966
sceneCamera.Render();
70-
GraphicsSettings.renderPipeline = null;
67+
GraphicsSettings.renderPipelineAsset = null;
7168
}
7269
}

Assets/Editor/Tests/ShaderGeneratorTests/ShaderGeneratorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
using UnityEngine;
66
using UnityEditor;
77
using UnityEngine.Experimental.Rendering;
8-
using UnityEngine.Experimental.ScriptableRenderLoop;
98
using NUnit.Framework;
9+
using UnityEditor.Experimental.Rendering;
1010

1111
[TestFixture]
1212
public class ShaderGeneratorTests

Assets/ScriptableRenderLoop/AdditionalLightData.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace UnityEngine.Experimental.ScriptableRenderLoop
1+
namespace UnityEngine.Experimental.Rendering
22
{
33
public enum LightArchetype {Punctual, Rectangle, Line};
44

@@ -20,15 +20,15 @@ public static int GetShadowResolution(AdditionalLightData lightData)
2020
return DefaultShadowResolution;
2121
}
2222

23-
[RangeAttribute(0.0F, 100.0F)]
23+
[Range(0.0F, 100.0F)]
2424
private float m_innerSpotPercent = 0.0F;
2525

2626
public float GetInnerSpotPercent01()
2727
{
2828
return Mathf.Clamp(m_innerSpotPercent, 0.0f, 100.0f) / 100.0f;
2929
}
3030

31-
[RangeAttribute(0.0F, 1.0F)]
31+
[Range(0.0F, 1.0F)]
3232
public float shadowDimmer = 1.0f;
3333

3434
public bool affectDiffuse = true;
@@ -37,10 +37,10 @@ public float GetInnerSpotPercent01()
3737
public LightArchetype archetype = LightArchetype.Punctual;
3838
public bool isDoubleSided = false;
3939

40-
[RangeAttribute(0.0f, 20.0f)]
40+
[Range(0.0f, 20.0f)]
4141
public float areaLightLength = 0.0f;
4242

43-
[RangeAttribute(0.0f, 20.0f)]
43+
[Range(0.0f, 20.0f)]
4444
public float areaLightWidth = 0.0f;
4545
}
4646
}

Assets/ScriptableRenderLoop/Editor/MaterialUpgrader.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
using System.Collections;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using UnityEngine;
43
using System;
54

6-
namespace UnityEditor.Experimental.ScriptableRenderLoop
5+
namespace UnityEditor.Experimental.Rendering
76
{
87
public class MaterialUpgrader
98
{

Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/DebugViewMaterial.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using UnityEngine;
2-
3-
namespace UnityEngine.Experimental.ScriptableRenderLoop
1+
namespace UnityEngine.Experimental.Rendering.HDPipeline
42
{
53
namespace Attributes
64
{
@@ -26,7 +24,7 @@ public enum DebugViewVarying
2624
public enum DebugViewGbuffer
2725
{
2826
Depth = DebugViewVarying.VertexColorAlpha + 1,
29-
BakeDiffuseLighting,
27+
BakeDiffuseLightingWithAlbedoPlusEmissive,
3028
}
3129
}
32-
} // namespace UnityEngine.Experimental.ScriptableRenderLoop
30+
}

Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/DebugViewMaterial.cs.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef DEBUGVIEWMATERIAL_CS_HLSL
66
#define DEBUGVIEWMATERIAL_CS_HLSL
77
//
8-
// UnityEngine.Experimental.ScriptableRenderLoop.Attributes.DebugViewVarying: static fields
8+
// UnityEngine.Experimental.Rendering.HDPipeline.Attributes.DebugViewVarying: static fields
99
//
1010
#define DEBUGVIEWVARYING_TEXCOORD0 (1)
1111
#define DEBUGVIEWVARYING_TEXCOORD1 (2)
@@ -18,10 +18,10 @@
1818
#define DEBUGVIEWVARYING_VERTEX_COLOR_ALPHA (9)
1919

2020
//
21-
// UnityEngine.Experimental.ScriptableRenderLoop.Attributes.DebugViewGbuffer: static fields
21+
// UnityEngine.Experimental.Rendering.HDPipeline.Attributes.DebugViewGbuffer: static fields
2222
//
2323
#define DEBUGVIEWGBUFFER_DEPTH (10)
24-
#define DEBUGVIEWGBUFFER_BAKE_DIFFUSE_LIGHTING (11)
24+
#define DEBUGVIEWGBUFFER_BAKE_DIFFUSE_LIGHTING_WITH_ALBEDO_PLUS_EMISSIVE (11)
2525

2626

2727
#endif

Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/Resources/DebugViewMaterialGBuffer.shader

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Shader "Hidden/HDRenderPipeline/DebugViewMaterialGBuffer"
88
Blend SrcAlpha OneMinusSrcAlpha // We will lerp only the values that are valid
99

1010
HLSLPROGRAM
11-
#pragma target 5.0
12-
#pragma only_renderers d3d11 // TEMP: unitl we go futher in dev
11+
#pragma target 4.5
12+
#pragma only_renderers d3d11 ps4 metal // TEMP: unitl we go futher in dev
1313

1414
#pragma vertex Vert
1515
#pragma fragment Frag
@@ -71,9 +71,12 @@ Shader "Hidden/HDRenderPipeline/DebugViewMaterialGBuffer"
7171
float linearDepth = frac(posInput.depthVS * 0.1);
7272
result = linearDepth.xxx;
7373
}
74-
else if (_DebugViewMaterial == DEBUGVIEWGBUFFER_BAKE_DIFFUSE_LIGHTING)
74+
// Caution: This value is not the same than the builtin data bakeDiffuseLighting. It also include emissive and multiply by the albedo
75+
else if (_DebugViewMaterial == DEBUGVIEWGBUFFER_BAKE_DIFFUSE_LIGHTING_WITH_ALBEDO_PLUS_EMISSIVE)
7576
{
76-
result = bakeDiffuseLighting;
77+
// TODO: require a remap
78+
// TODO: we should not gamma correct, but easier to debug for now without correct high range value
79+
result = bakeDiffuseLighting; needLinearToSRGB = true;
7780
}
7881

7982
GetBSDFDataDebug(_DebugViewMaterial, bsdfData, result, needLinearToSRGB);

Assets/ScriptableRenderLoop/HDRenderPipeline/Debug/Resources/DebugViewTiles.shader

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Shader "Hidden/HDRenderPipeline/DebugViewTiles"
99
Blend SrcAlpha OneMinusSrcAlpha
1010

1111
HLSLPROGRAM
12-
#pragma target 5.0
13-
#pragma only_renderers d3d11 // TEMP: unitl we go futher in dev
12+
#pragma target 4.5
13+
#pragma only_renderers d3d11 ps4 metal // TEMP: unitl we go futher in dev
1414

1515
#pragma vertex Vert
1616
#pragma fragment Frag
1717

18-
#define LIGHTLOOP_TILE_PASS 1
19-
#define LIGHTLOOP_TILE_ALL 1
18+
#define LIGHTLOOP_TILE_PASS
19+
#define LIGHTLOOP_TILE_ALL
2020

2121
#pragma multi_compile USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST
2222

@@ -141,9 +141,9 @@ Shader "Hidden/HDRenderPipeline/DebugViewTiles"
141141
float depthMouse = LOAD_TEXTURE2D(_CameraDepthTexture, mousePosInput.unPositionSS).x;
142142
UpdatePositionInput(depthMouse, _InvViewProjMatrix, _ViewProjMatrix, mousePosInput);
143143

144-
int category = (LIGHTCATEGORY_COUNT - 1) - tileCoord.y;
145-
int start;
146-
int count;
144+
uint category = (LIGHTCATEGORY_COUNT - 1) - tileCoord.y;
145+
uint start;
146+
uint count;
147147
GetCountAndStart(mousePosInput, category, start, count);
148148

149149
float4 result2 = float4(.1,.1,.1,.9);
@@ -153,9 +153,9 @@ Shader "Hidden/HDRenderPipeline/DebugViewTiles"
153153
int n = -1;
154154
if(tileCoord.x == 0)
155155
{
156-
n = count;
156+
n = (int)count;
157157
}
158-
else if(lightListIndex >= 0 && lightListIndex < count)
158+
else if(lightListIndex >= 0 && lightListIndex < (int)count)
159159
{
160160
n = FetchIndex(start, lightListIndex);
161161
}
@@ -178,4 +178,4 @@ Shader "Hidden/HDRenderPipeline/DebugViewTiles"
178178
}
179179
}
180180
Fallback Off
181-
}
181+
}

Assets/ScriptableRenderLoop/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
//using EditorGUIUtility=UnityEditor.EditorGUIUtility;
55

6-
namespace UnityEngine.Experimental.ScriptableRenderLoop
6+
namespace UnityEngine.Experimental.Rendering.HDPipeline
77
{
88
[CustomEditor(typeof(HDRenderPipeline))]
99
public class HDRenderPipelineInspector : Editor
@@ -15,8 +15,6 @@ private class Styles
1515

1616
public readonly GUIContent displayOpaqueObjects = new GUIContent("Display Opaque Objects", "Toggle opaque objects rendering on and off.");
1717
public readonly GUIContent displayTransparentObjects = new GUIContent("Display Transparent Objects", "Toggle transparent objects rendering on and off.");
18-
public readonly GUIContent enableTonemap = new GUIContent("Enable Tonemap");
19-
public readonly GUIContent exposure = new GUIContent("Exposure");
2018

2119
public readonly GUIContent useForwardRenderingOnly = new GUIContent("Use Forward Rendering Only");
2220
public readonly GUIContent useDepthPrepass = new GUIContent("Use Depth Prepass");
@@ -169,17 +167,13 @@ private void DebugParametersUI(HDRenderPipeline renderContext)
169167

170168
debugParameters.debugViewMaterial = EditorGUILayout.IntPopup(styles.debugViewMaterial, (int)debugParameters.debugViewMaterial, styles.debugViewMaterialStrings, styles.debugViewMaterialValues);
171169

172-
EditorGUILayout.Space();
173-
debugParameters.enableTonemap = EditorGUILayout.Toggle(styles.enableTonemap, debugParameters.enableTonemap);
174-
debugParameters.exposure = Mathf.Max(Mathf.Min(EditorGUILayout.FloatField(styles.exposure, debugParameters.exposure), k_MaxExposure), -k_MaxExposure);
175-
176170
EditorGUILayout.Space();
177171
debugParameters.displayOpaqueObjects = EditorGUILayout.Toggle(styles.displayOpaqueObjects, debugParameters.displayOpaqueObjects);
178172
debugParameters.displayTransparentObjects = EditorGUILayout.Toggle(styles.displayTransparentObjects, debugParameters.displayTransparentObjects);
179173
debugParameters.useForwardRenderingOnly = EditorGUILayout.Toggle(styles.useForwardRenderingOnly, debugParameters.useForwardRenderingOnly);
180174
debugParameters.useDepthPrepass = EditorGUILayout.Toggle(styles.useDepthPrepass, debugParameters.useDepthPrepass);
181175
debugParameters.useDistortion = EditorGUILayout.Toggle(styles.useDistortion, debugParameters.useDistortion);
182-
176+
183177
if (EditorGUI.EndChangeCheck())
184178
{
185179
EditorUtility.SetDirty(renderContext); // Repaint

0 commit comments

Comments
 (0)