浏览代码

Merge remote-tracking branch 'refs/remotes/origin/master' into Support-forward-SSS

# Conflicts:
#	ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs

#	ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
/main
sebastienlagarde 7 年前
当前提交
f142c657
共有 31 个文件被更改,包括 856 次插入1379 次删除
  1. 999
      ImageTemplates/LightweightPipeline/Scenes/007_LitShaderMaps.unity.png
  2. 8
      ImageTemplates/LightweightPipeline/Scenes/007_LitShaderMaps.unity.png.meta
  3. 14
      ScriptableRenderPipeline/HDRenderPipeline/Camera/HDCamera.cs
  4. 1
      ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs
  5. 1
      ScriptableRenderPipeline/HDRenderPipeline/Debug/RenderingDebug.cs
  6. 1
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.Styles.cs
  7. 3
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
  8. 94
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  9. 77
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
  10. 8
      ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetEditor.cs
  11. 258
      ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightCameraEditor.cs
  12. 262
      ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightLightEditor.cs
  13. 64
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardGUI.cs
  14. 47
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardParticlesShaderGUI.cs
  15. 30
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardSimpleLightingGUI.cs
  16. 78
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightUnlitGUI.cs
  17. 5
      ScriptableRenderPipeline/LightweightPipeline/Editor/StandardToLightweightMaterialUpgrader.cs.meta
  18. 6
      ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs
  19. 39
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCore.cginc
  20. 3
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightInput.cginc
  21. 79
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPassLit.cginc
  22. 33
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandard.shader
  23. 71
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader
  24. 6
      ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs
  25. 33
      Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps.unity
  26. 5
      Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps/007_LitShaderMaps_UnlitMatTexture_08.mat
  27. 3
      Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps/007_LitShaderMaps_UnlitMat_07.mat
  28. 5
      Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps/LightingData.asset
  29. 2
      Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps/LightingData.asset.meta
  30. 0
      /ScriptableRenderPipeline/LightweightPipeline/Data
  31. 0
      /ScriptableRenderPipeline/LightweightPipeline/Data.meta

999
ImageTemplates/LightweightPipeline/Scenes/007_LitShaderMaps.unity.png
文件差异内容过多而无法显示
查看文件

8
ImageTemplates/LightweightPipeline/Scenes/007_LitShaderMaps.unity.png.meta


fileFormatVersion: 2
guid: e086420c18dc7be409fbca698aa2f035
timeCreated: 1504172927
licenseType: Pro
serializedVersion: 4
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1

spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
- buildTarget: DefaultTexturePlatform
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

14
ScriptableRenderPipeline/HDRenderPipeline/Camera/HDCamera.cs


// avoid one-frame jumps/hiccups with temporal effects (motion blur, TAA...)
public bool isFirstFrame { get; private set; }
public bool useForwardOnly { get; private set; }
public bool stereoEnabled { get; private set; }
public Vector4 invProjParam
{
// Ref: An Efficient Depth Linearization Method for Oblique View Frustums, Eq. 6.

Reset();
}
public void Update(PostProcessLayer postProcessLayer)
public void Update(PostProcessLayer postProcessLayer, GlobalRenderingSettings globalRenderingSettings, bool stereoActive)
{
// If TAA is enabled projMatrix will hold a jittered projection matrix. The original,
// non-jittered projection matrix can be accessed via nonJitteredProjMatrix.

frustumPlaneEquations[5] = new Vector4(-camera.transform.forward.x, -camera.transform.forward.y, -camera.transform.forward.z, Vector3.Dot(camera.transform.forward, relPos) + camera.farClipPlane);
m_LastFrameActive = Time.frameCount;
stereoEnabled = stereoActive && (camera.stereoTargetEye == StereoTargetEyeMask.Both);
useForwardOnly = globalRenderingSettings.ShouldUseForwardRenderingOnly() || stereoEnabled;
}
public void Reset()

stereoEnabled = false;
useForwardOnly = false;
public static HDCamera Get(Camera camera, PostProcessLayer postProcessLayer)
public static HDCamera Get(Camera camera, PostProcessLayer postProcessLayer, GlobalRenderingSettings globalRenderingSettings, bool stereoActive)
{
HDCamera hdcam;

s_Cameras.Add(camera, hdcam);
}
hdcam.Update(postProcessLayer);
hdcam.Update(postProcessLayer, globalRenderingSettings, stereoActive);
return hdcam;
}

1
ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs


DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Atmospheric Scattering",() => renderingDebugSettings.enableAtmosphericScattering, (value) => renderingDebugSettings.enableAtmosphericScattering = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Distortion",() => renderingDebugSettings.enableDistortion, (value) => renderingDebugSettings.enableDistortion = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Subsurface Scattering",() => renderingDebugSettings.enableSSSAndTransmission, (value) => renderingDebugSettings.enableSSSAndTransmission = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Allow Stereo Rendering",() => renderingDebugSettings.allowStereo, (value) => renderingDebugSettings.allowStereo = (bool)value);
DebugMenuManager.instance.AddDebugItem<int>("Rendering", kFullScreenDebugMode, () => (int)fullScreenDebugMode, (value) => fullScreenDebugMode = (FullScreenDebugMode)value, DebugItemFlag.None, new DebugItemHandlerIntEnum(DebugDisplaySettings.renderingFullScreenDebugStrings, DebugDisplaySettings.renderingFullScreenDebugValues));
}

1
ScriptableRenderPipeline/HDRenderPipeline/Debug/RenderingDebug.cs


public bool enableGaussianPyramid = true;
public bool enableSSSAndTransmission = true;
public bool enableAtmosphericScattering = true;
public bool allowStereo = true;
}
}

1
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.Styles.cs


public readonly GUIContent enableComputeMaterialVariants = new GUIContent("Compute Material Variants");
public readonly GUIContent enableFptlForForwardOpaque = new GUIContent("Fptl for forward opaque");
public readonly GUIContent enableBigTilePrepass = new GUIContent("Big tile prepass");
public readonly GUIContent enableAsyncCompute = new GUIContent("Enable Async Compute");
}
static Styles s_Styles;

3
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs


SerializedProperty m_enableComputeMaterialVariants;
SerializedProperty m_enableFptlForForwardOpaque;
SerializedProperty m_enableBigTilePrepass;
SerializedProperty m_enableAsyncCompute;
// Rendering Settings
SerializedProperty m_RenderingUseForwardOnly;

m_enableComputeMaterialVariants = properties.Find(x => x.tileSettings.enableComputeMaterialVariants);
m_enableFptlForForwardOpaque = properties.Find(x => x.tileSettings.enableFptlForForwardOpaque);
m_enableBigTilePrepass = properties.Find(x => x.tileSettings.enableBigTilePrepass);
m_enableAsyncCompute = properties.Find(x => x.tileSettings.enableAsyncCompute);
// Shadow settings
m_ShadowAtlasWidth = properties.Find(x => x.shadowInitParams.shadowAtlasWidth);

EditorGUILayout.PropertyField(m_enableComputeMaterialVariants, s_Styles.enableComputeMaterialVariants);
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(m_enableAsyncCompute, s_Styles.enableAsyncCompute);
}
if (EditorGUI.EndChangeCheck())

94
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


m_IBLFilterGGX = new IBLFilterGGX(asset.renderPipelineResources);
m_LightLoop.Build(asset.renderPipelineResources, asset.globalRenderingSettings, asset.tileSettings, asset.globalTextureSettings, asset.shadowInitParams, m_ShadowSettings, m_IBLFilterGGX);
m_LightLoop.Build(asset.renderPipelineResources, asset.tileSettings, asset.globalTextureSettings, asset.shadowInitParams, m_ShadowSettings, m_IBLFilterGGX);
m_SkyManager.Build(asset.renderPipelineResources, m_IBLFilterGGX);
m_SkyManager.skySettings = skySettingsToUse;

DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Compute Lighting", () => m_Asset.tileSettings.enableComputeLightEvaluation, (value) => m_Asset.tileSettings.enableComputeLightEvaluation = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Light Classification", () => m_Asset.tileSettings.enableComputeLightVariants, (value) => m_Asset.tileSettings.enableComputeLightVariants = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Material Classification", () => m_Asset.tileSettings.enableComputeMaterialVariants, (value) => m_Asset.tileSettings.enableComputeMaterialVariants = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Async Compute", () => m_Asset.tileSettings.enableAsyncCompute, (value) => m_Asset.tileSettings.enableAsyncCompute = (bool)value, DebugItemFlag.RuntimeOnly);
}
void InitializeDebugMaterials()

m_FrameCount = Time.frameCount;
}
var stereoActive = UnityEngine.XR.XRSettings.isDeviceActive && m_DebugDisplaySettings.renderingDebugSettings.allowStereo;
foreach (var camera in cameras)
{
// This is the main command buffer used for the frame.

CullResults.Cull(ref cullingParams, renderContext,ref m_CullResults);
}
var postProcessLayer = camera.GetComponent<PostProcessLayer>();
var hdCamera = HDCamera.Get(camera, postProcessLayer, m_Asset.globalRenderingSettings, stereoActive);
m_LightLoop.UpdateRenderingPathState(hdCamera.useForwardOnly);
var postProcessLayer = camera.GetComponent<PostProcessLayer>();
var hdCamera = HDCamera.Get(camera, postProcessLayer);
PushGlobalParams(hdCamera, cmd, sssSettings);
// TODO: Find a correct place to bind these material textures

InitAndClearBuffer(hdCamera, enableBakeShadowMask, cmd);
RenderDepthPrepass(m_CullResults, camera, renderContext, cmd);
RenderDepthPrepass(m_CullResults, hdCamera, renderContext, cmd);
RenderGBuffer(m_CullResults, camera, renderContext, cmd);
RenderGBuffer(m_CullResults, hdCamera, renderContext, cmd);
// In both forward and deferred, everything opaque should have been rendered at this point so we can safely copy the depth buffer for later processing.
CopyDepthBufferIfNeeded(cmd);

RenderSSAO(cmd, camera, renderContext, postProcessLayer);
}
bool enableAsyncCompute = m_LightLoop.IsAsyncEnabled();
GPUFence buildGPULightListsCompleteFence = new GPUFence();
if (enableAsyncCompute)
{
GPUFence startFence = cmd.CreateGPUFence();
renderContext.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
cmd = CommandBufferPool.Get("");
buildGPULightListsCompleteFence = m_LightLoop.BuildGPULightListsAsyncBegin(camera, renderContext, m_CameraDepthStencilBufferRT, GetStencilTexture(), startFence);
}
using (new ProfilingSample(cmd, "Render shadows", GetSampler(CustomSamplerId.RenderShadows)))
{
m_LightLoop.RenderShadows(renderContext, cmd, m_CullResults);

PushFullScreenDebugTexture(cmd, m_DeferredShadowBuffer, hdCamera.camera, renderContext, FullScreenDebugMode.DeferredShadows);
}
using (new ProfilingSample(cmd, "Build Light list", GetSampler(CustomSamplerId.BuildLightList)))
// TODO: Move this code inside LightLoop
if (m_LightLoop.GetFeatureVariantsEnabled())
// TODO: Move this code inside LightLoop
if (m_LightLoop.GetFeatureVariantsEnabled())
// For material classification we use compute shader and so can't read into the stencil, so prepare it.
using (new ProfilingSample(cmd, "Clear and copy stencil texture", GetSampler(CustomSamplerId.ClearAndCopyStencilTexture)))
// For material classification we use compute shader and so can't read into the stencil, so prepare it.
using (new ProfilingSample(cmd, "Clear and copy stencil texture", GetSampler(CustomSamplerId.ClearAndCopyStencilTexture)))
{
CoreUtils.SetRenderTarget(cmd, m_CameraStencilBufferCopyRT, ClearFlag.Color, CoreUtils.clearColorAllBlack);
CoreUtils.SetRenderTarget(cmd, m_CameraStencilBufferCopyRT, ClearFlag.Color, CoreUtils.clearColorAllBlack);
cmd.SetRandomWriteTarget(1, GetHTile());
// In the material classification shader we will simply test is we are no lighting
// Use ShaderPassID 1 => "Pass 1 - Write 1 if value different from stencilRef to output"
CoreUtils.DrawFullScreen(cmd, m_CopyStencilForNoLighting, m_CameraStencilBufferCopyRT, m_CameraDepthStencilBufferRT, null, 1);
cmd.ClearRandomWriteTargets();
}
cmd.SetRandomWriteTarget(1, GetHTile());
// In the material classification shader we will simply test is we are no lighting
// Use ShaderPassID 1 => "Pass 1 - Write 1 if value different from stencilRef to output"
CoreUtils.DrawFullScreen(cmd, m_CopyStencilForNoLighting, m_CameraStencilBufferCopyRT, m_CameraDepthStencilBufferRT, null, 1);
cmd.ClearRandomWriteTargets();
}
m_LightLoop.BuildGPULightLists(camera, cmd, m_CameraDepthStencilBufferRT, m_CameraStencilBufferCopyRT);
if (enableAsyncCompute)
{
m_LightLoop.BuildGPULightListAsyncEnd(camera, cmd, buildGPULightListsCompleteFence);
}
else
{
using (new ProfilingSample(cmd, "Build Light list", GetSampler(CustomSamplerId.BuildLightList)))
{
m_LightLoop.BuildGPULightLists(camera, cmd, m_CameraDepthStencilBufferRT, GetStencilTexture());
}
}
// Caution: We require sun light here as some sky use the sun light to render, mean UpdateSkyEnvironment

RenderDeferredLighting(hdCamera, cmd);
RenderForward(m_CullResults, camera, renderContext, cmd, ForwardPass.Opaque);
RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.Opaque);
RenderForwardError(m_CullResults, camera, renderContext, cmd, ForwardPass.Opaque);
// SSS pass here handle both SSS material from deferred and forward

// Render pre refraction objects
RenderForward(m_CullResults, camera, renderContext, cmd, ForwardPass.PreRefraction);
RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.PreRefraction);
RenderForward(m_CullResults, camera, renderContext, cmd, ForwardPass.Transparent);
RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.Transparent);
RenderForwardError(m_CullResults, camera, renderContext, cmd, ForwardPass.Transparent);
PushFullScreenDebugTexture(cmd, m_CameraColorBuffer, camera, renderContext, FullScreenDebugMode.NanTracker);

// Forward only renderer: We always render everything
// Deferred renderer: We render a depth prepass only if engine request it. We can decide if we render everything or only opaque alpha tested object.
// Forward opaque with deferred renderer (DepthForwardOnly pass): We always render everything
void RenderDepthPrepass(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd)
void RenderDepthPrepass(CullResults cull, HDCamera hdCamera, ScriptableRenderContext renderContext, CommandBuffer cmd)
{
// In case of deferred renderer, we can have forward opaque material. These materials need to be render in the depth buffer to correctly build the light list.
// And they will tag the stencil to not be lit during the deferred lighting pass.

// It must also have a "DepthForwardOnly" and no "DepthOnly" pass as forward material (either deferred or forward only rendering) have always a depth pass.
// In case of forward only rendering we have a depth prepass. In case of deferred renderer, it is optional
bool addFullDepthPrepass = m_Asset.globalRenderingSettings.ShouldUseForwardRenderingOnly() || m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering;
bool addAlphaTestedOnly = !m_Asset.globalRenderingSettings.ShouldUseForwardRenderingOnly() && m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering && m_Asset.globalRenderingSettings.renderAlphaTestOnlyInDeferredPrepass;
bool addFullDepthPrepass = hdCamera.useForwardOnly || m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering;
bool addAlphaTestedOnly = !hdCamera.useForwardOnly && m_Asset.globalRenderingSettings.useDepthPrepassWithDeferredRendering && m_Asset.globalRenderingSettings.renderAlphaTestOnlyInDeferredPrepass;
var camera = hdCamera.camera;
using (new ProfilingSample(cmd, addAlphaTestedOnly ? "Depth Prepass alpha test" : "Depth Prepass", GetSampler(CustomSamplerId.DepthPrepass)))
{

// RenderGBuffer do the gbuffer pass. This is solely call with deferred. If we use a depth prepass, then the depth prepass will perform the alpha testing for opaque apha tested and we don't need to do it anymore
// during Gbuffer pass. This is handled in the shader and the depth test (equal and no depth write) is done here.
void RenderGBuffer(CullResults cull, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd)
void RenderGBuffer(CullResults cull, HDCamera hdCamera, ScriptableRenderContext renderContext, CommandBuffer cmd)
if (m_Asset.globalRenderingSettings.ShouldUseForwardRenderingOnly())
if (hdCamera.useForwardOnly)
var camera = hdCamera.camera;
using (new ProfilingSample(cmd, m_CurrentDebugDisplaySettings.IsDebugDisplayEnabled() ? "GBufferDebugDisplay" : "GBuffer", GetSampler(CustomSamplerId.GBuffer)))
{

void RenderDeferredLighting(HDCamera hdCamera, CommandBuffer cmd)
{
if (m_Asset.globalRenderingSettings.ShouldUseForwardRenderingOnly())
if (hdCamera.useForwardOnly)
return;
m_MRTCache2[0] = m_CameraColorBufferRT;

}
// Render forward is use for both transparent and opaque objects. In case of deferred we can still render opaque object in forward.
void RenderForward(CullResults cullResults, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, ForwardPass pass)
void RenderForward(CullResults cullResults, HDCamera hdCamera, ScriptableRenderContext renderContext, CommandBuffer cmd, ForwardPass pass)
{
// Guidelines: In deferred by default there is no opaque in forward. However it is possible to force an opaque material to render in forward
// by using the pass "ForwardOnly". In this case the .shader should not have "Forward" but only a "ForwardOnly" pass.

using (new ProfilingSample(cmd, profileName, GetSampler(CustomSamplerId.ForwardPassName)))
{
var camera = hdCamera.camera;
m_LightLoop.RenderForward(camera, cmd, pass == ForwardPass.Opaque);
if (pass == ForwardPass.Opaque)

m_ForwardAndForwardOnlyPassNames[1] = HDShaderPassNames.s_ForwardName;
}
var passNames = m_Asset.globalRenderingSettings.ShouldUseForwardRenderingOnly() ? m_ForwardAndForwardOnlyPassNames : m_ForwardOnlyPassNames;
var passNames = hdCamera.useForwardOnly ? m_ForwardAndForwardOnlyPassNames : m_ForwardOnlyPassNames;
// Forward opaque material always have a prepass (whether or not we use deferred, whether or not there is option like alpha test only) so we pass the right depth state here.
RenderOpaqueRenderList(cullResults, camera, renderContext, cmd, passNames, m_currentRendererConfigurationBakedLighting, null, m_DepthStateOpaqueWithPrepass);
}

cmd.GetTemporaryRT(m_DepthPyramidBuffer, m_DepthPyramidBufferDesc, FilterMode.Trilinear);
// End
if (!m_Asset.globalRenderingSettings.ShouldUseForwardRenderingOnly())
if (!camera.useForwardOnly)
{
m_GbufferManager.InitGBuffers(w, h, m_DeferredMaterial, enableBakeShadowMask, cmd);
m_SSSBufferManager.InitGBuffers(w, h, m_GbufferManager, cmd);

}
// Clear GBuffers
if (!m_Asset.globalRenderingSettings.ShouldUseForwardRenderingOnly())
if (!camera.useForwardOnly)
{
using (new ProfilingSample(cmd, "Clear GBuffer", GetSampler(CustomSamplerId.ClearGBuffer)))
{

77
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs


// clustered light list specific buffers and data begin
public bool enableBigTilePrepass;
public bool enableAsyncCompute;
public enum TileClusterDebug : int
{
None,

enableFptlForForwardOpaque = true;
enableBigTilePrepass = true;
enableAsyncCompute = false;
}
}

}
public void Build( RenderPipelineResources renderPipelineResources,
GlobalRenderingSettings renderingSettings,
// Deferred opaque are always using Fptl. Forward opaque can use Fptl or Cluster, transparent use cluster.
// When MSAA is enabled we disable Fptl as it become expensive compare to cluster
// In HD, MSAA is only supported for forward only rendering, no MSAA in deferred mode (for code complexity reasons)
// If Deferred, enable Fptl. If we are forward renderer only and not using Fptl for forward opaque, disable Fptl
m_isForwardRenderingOnly = renderingSettings.ShouldUseForwardRenderingOnly();
m_isFptlEnabled = !m_isForwardRenderingOnly || tileSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
m_isFptlEnabledForForwardOpaque = tileSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
m_Resources = renderPipelineResources;
m_LightLoopSettings = tileSettings;

s_GenAABBKernel = buildScreenAABBShader.FindKernel("ScreenBoundsAABB");
if (GetFeatureVariantsEnabled())
{
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_LightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile_FeatureFlags" : "TileLightListGen_FeatureFlags");
}
else
{
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_LightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile" : "TileLightListGen");
}
s_AABBBoundsBuffer = new ComputeBuffer(2 * k_MaxLightsOnScreen, 3 * sizeof(float));
s_ConvexBoundsBuffer = new ComputeBuffer(k_MaxLightsOnScreen, System.Runtime.InteropServices.Marshal.SizeOf(typeof(SFiniteLightBound)));
s_LightVolumeDataBuffer = new ComputeBuffer(k_MaxLightsOnScreen, System.Runtime.InteropServices.Marshal.SizeOf(typeof(LightVolumeData)));

light.bakingOutput.occlusionMaskChannel != -1; // We need to have an occlusion mask channel assign, else we have no shadow mask
}
public void UpdateRenderingPathState(bool useForwardRenderingOnly)
{
// Deferred opaque are always using Fptl. Forward opaque can use Fptl or Cluster, transparent use cluster.
// When MSAA is enabled we disable Fptl as it become expensive compare to cluster
// In HD, MSAA is only supported for forward only rendering, no MSAA in deferred mode (for code complexity reasons)
// If Deferred, enable Fptl. If we are forward renderer only and not using Fptl for forward opaque, disable Fptl
m_isForwardRenderingOnly = useForwardRenderingOnly;
m_isFptlEnabled = !m_isForwardRenderingOnly || tileSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
m_isFptlEnabledForForwardOpaque = tileSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
if (GetFeatureVariantsEnabled())
{
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_LightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile_FeatureFlags" : "TileLightListGen_FeatureFlags");
}
else
{
s_GenListPerTileKernel = buildPerTileLightListShader.FindKernel(m_LightLoopSettings.enableBigTilePrepass ? "TileLightListGen_SrcBigTile" : "TileLightListGen");
}
}
// Return true if BakedShadowMask are enabled
public bool PrepareLightsForGPU(CommandBuffer cmd, ShadowSettings shadowSettings, CullResults cullResults, Camera camera)
{

cmd.DispatchCompute(buildPerVoxelLightListShader, s_GenListPerVoxelKernel, numTilesX, numTilesY, 1);
}
public void BuildGPULightLists(Camera camera, CommandBuffer cmd, RenderTargetIdentifier cameraDepthBufferRT, RenderTargetIdentifier stencilTextureRT)
public bool IsAsyncEnabled()
{
return m_LightLoopSettings.enableAsyncCompute;
}
public void BuildGPULightListsCommon(Camera camera, CommandBuffer cmd, RenderTargetIdentifier cameraDepthBufferRT, RenderTargetIdentifier stencilTextureRT)
{
cmd.BeginSample("Build Light List");

var projscr = temp * proj;
var invProjscr = projscr.inverse;
bool isOrthographic = camera.orthographic;
cmd.SetRenderTarget(BuiltinRenderTextureType.None);
// generate screen-space AABBs (used for both fptl and clustered).
if (m_lightCount != 0)

}
cmd.EndSample("Build Light List");
}
public void BuildGPULightLists(Camera camera, CommandBuffer cmd, RenderTargetIdentifier cameraDepthBufferRT, RenderTargetIdentifier stencilTextureRT)
{
cmd.SetRenderTarget(BuiltinRenderTextureType.None);
BuildGPULightListsCommon(camera, cmd, cameraDepthBufferRT, stencilTextureRT);
PushGlobalParams(camera, cmd);
}
public GPUFence BuildGPULightListsAsyncBegin(Camera camera, ScriptableRenderContext renderContext, RenderTargetIdentifier cameraDepthBufferRT, RenderTargetIdentifier stencilTextureRT, GPUFence startFence)
{
var cmd = CommandBufferPool.Get("Build light list");
cmd.WaitOnGPUFence(startFence);
BuildGPULightListsCommon(camera, cmd, cameraDepthBufferRT, stencilTextureRT);
GPUFence completeFence = cmd.CreateGPUFence();
renderContext.ExecuteCommandBufferAsync(cmd, ComputeQueueType.Background);
CommandBufferPool.Release(cmd);
return completeFence;
}
public void BuildGPULightListAsyncEnd(Camera camera, CommandBuffer cmd, GPUFence doneFence)
{
cmd.WaitOnGPUFence(doneFence);
PushGlobalParams(camera, cmd);
}

8
ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetEditor.cs


public static GUIContent enableVertexLightLabel = new GUIContent("Enable Vertex Light",
"If enabled, shades additional lights exceeding maxAdditionalPixelLights per-vertex up to the maximum of 8 lights.");
public static GUIContent enableSoftParticles = new GUIContent("Enable Soft Particles", "By enabled this the pipeline will generate depth texture necessary for SoftParticles");
public static GUIContent requireCameraDepthTexture = new GUIContent("Camera Depth Texture", "If enabled the the pipeline will generate depth texture necessary for some effects like soft particles.");
public static GUIContent shadowType = new GUIContent("Shadow Type",
"Single directional shadow supported. SOFT_SHADOWS applies shadow filtering.");

private SerializedProperty m_RenderScale;
private SerializedProperty m_MaxPixelLights;
private SerializedProperty m_SupportsVertexLightProp;
private SerializedProperty m_SupportSoftParticlesProp;
private SerializedProperty m_RequireCameraDepthTextureProp;
private SerializedProperty m_ShadowTypeProp;
private SerializedProperty m_ShadowNearPlaneOffsetProp;
private SerializedProperty m_ShadowDistanceProp;

m_RenderScale = serializedObject.FindProperty("m_RenderScale");
m_MaxPixelLights = serializedObject.FindProperty("m_MaxPixelLights");
m_SupportsVertexLightProp = serializedObject.FindProperty("m_SupportsVertexLight");
m_SupportSoftParticlesProp = serializedObject.FindProperty("m_SupportSoftParticles");
m_RequireCameraDepthTextureProp = serializedObject.FindProperty("m_RequireCameraDepthTexture");
m_ShadowTypeProp = serializedObject.FindProperty("m_ShadowType");
m_ShadowNearPlaneOffsetProp = serializedObject.FindProperty("m_ShadowNearPlaneOffset");
m_ShadowDistanceProp = serializedObject.FindProperty("m_ShadowDistance");

m_MaxPixelLights.intValue = EditorGUILayout.IntSlider(m_MaxPixelLights.intValue, 0, kMaxSupportedPixelLights);
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(m_SupportsVertexLightProp, Styles.enableVertexLightLabel);
EditorGUILayout.PropertyField(m_SupportSoftParticlesProp, Styles.enableSoftParticles);
EditorGUILayout.PropertyField(m_RequireCameraDepthTextureProp, Styles.requireCameraDepthTexture);
EditorGUILayout.PropertyField(m_MSAA, Styles.msaaContent);
EditorGUI.indentLevel--;

258
ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightCameraEditor.cs


using UnityEditor.AnimatedValues;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Scripting;
using UnityEditor.Modules;
using UnityEngine.Rendering.PostProcessing;
public class LightweightameraEditor : Editor
public class LightweightameraEditor : CameraEditor
{
public class Styles
{

public readonly GUIContent clipingPlanesLabel = new GUIContent("Clipping Planes", "Distances from the camera to start and stop rendering.");
public readonly GUIContent nearPlaneLabel = new GUIContent("Near", "The closest point relative to the camera that drawing will occur.");
public readonly GUIContent farPlaneLabel = new GUIContent("Far", "The furthest point relative to the camera that drawing will occur.");
public readonly string mssaDisabledWarning = "Anti Aliasing is disabled in Lightweight Pipeline settings.";
};
private static readonly int[] kRenderingPathValues = {0};

public SerializedProperty clearFlags { get; private set; }
public SerializedProperty backgroundColor { get; private set; }
public SerializedProperty normalizedViewPortRect { get; private set; }
public SerializedProperty fieldOfView { get; private set; }
public SerializedProperty orthographic { get; private set; }
public SerializedProperty orthographicSize { get; private set; }
public SerializedProperty depth { get; private set; }
public SerializedProperty cullingMask { get; private set; }
public SerializedProperty renderingPath { get; private set; }
public SerializedProperty occlusionCulling { get; private set; }
public SerializedProperty targetTexture { get; private set; }
public SerializedProperty HDR { get; private set; }
public SerializedProperty allowMSAA { get; private set; }
public SerializedProperty allowDynamicResolution { get; private set; }
public SerializedProperty stereoConvergence { get; private set; }
public SerializedProperty stereoSeparation { get; private set; }
public SerializedProperty nearClippingPlane { get; private set; }
public SerializedProperty farClippingPlane { get; private set; }
#if ENABLE_MULTIPLE_DISPLAYS
public SerializedProperty targetDisplay { get; private set; }
#endif
public SerializedProperty targetEye { get; private set; }
private bool IsSameClearFlags { get { return !clearFlags.hasMultipleDifferentValues; } }
private bool IsSameOrthographic { get { return !orthographic.hasMultipleDifferentValues; } }
private bool IsSameClearFlags { get { return !settings.clearFlags.hasMultipleDifferentValues; } }
private bool IsSameOrthographic { get { return !settings.orthographic.hasMultipleDifferentValues; } }
readonly AnimBool showBGColorAnim = new AnimBool();
readonly AnimBool showOrthoAnim = new AnimBool();

{
SetAnimationTarget(showBGColorAnim, initialize, IsSameClearFlags && (camera.clearFlags == CameraClearFlags.SolidColor || camera.clearFlags == CameraClearFlags.Skybox));
SetAnimationTarget(showOrthoAnim, initialize, IsSameOrthographic && camera.orthographic);
SetAnimationTarget(showTargetEyeAnim, initialize, targetEye.intValue != (int)StereoTargetEyeMask.Both || PlayerSettings.virtualRealitySupported);
SetAnimationTarget(showTargetEyeAnim, initialize, settings.targetEye.intValue != (int)StereoTargetEyeMask.Both || PlayerSettings.virtualRealitySupported);
private static readonly GUIContent[] kTargetEyes =
{
new GUIContent("Both"),
new GUIContent("Left"),
new GUIContent("Right"),
new GUIContent("None (Main Display)"),
};
private static readonly int[] kTargetEyeValues =
{
(int) StereoTargetEyeMask.Both, (int) StereoTargetEyeMask.Left,
(int) StereoTargetEyeMask.Right, (int) StereoTargetEyeMask.None
};
void OnEnable()
public new void OnEnable()
clearFlags = serializedObject.FindProperty("m_ClearFlags");
backgroundColor = serializedObject.FindProperty("m_BackGroundColor");
normalizedViewPortRect = serializedObject.FindProperty("m_NormalizedViewPortRect");
nearClippingPlane = serializedObject.FindProperty("near clip plane");
farClippingPlane = serializedObject.FindProperty("far clip plane");
fieldOfView = serializedObject.FindProperty("field of view");
orthographic = serializedObject.FindProperty("orthographic");
orthographicSize = serializedObject.FindProperty("orthographic size");
depth = serializedObject.FindProperty("m_Depth");
cullingMask = serializedObject.FindProperty("m_CullingMask");
occlusionCulling = serializedObject.FindProperty("m_OcclusionCulling");
targetTexture = serializedObject.FindProperty("m_TargetTexture");
HDR = serializedObject.FindProperty("m_HDR");
allowMSAA = serializedObject.FindProperty("m_AllowMSAA");
allowDynamicResolution = serializedObject.FindProperty("m_AllowDynamicResolution");
stereoConvergence = serializedObject.FindProperty("m_StereoConvergence");
stereoSeparation = serializedObject.FindProperty("m_StereoSeparation");
#if ENABLE_MULTIPLE_DISPLAYS
targetDisplay = serializedObject.FindProperty("m_TargetDisplay");
#endif
targetEye = serializedObject.FindProperty("m_TargetEye");
settings.OnEnable();
void OnDisable()
public void OnDisable()
{
showBGColorAnim.valueChanged.RemoveListener(Repaint);
showOrthoAnim.valueChanged.RemoveListener(Repaint);

}
public void DrawClearFlags()
{
EditorGUILayout.PropertyField(clearFlags,
new GUIContent(
"Clear Flags","What to display in empty areas of this Camera's view.\n\nChoose Skybox to display a skybox in empty areas, defaulting to a background color if no skybox is found.\n\nChoose Solid Color to display a background color in empty areas.\n\nChoose Depth Only to display nothing in empty areas.\n\nChoose Don't Clear to display whatever was displayed in the previous frame in empty areas."));
}
public void DrawBackgroundColor()
{
EditorGUILayout.PropertyField(backgroundColor,
new GUIContent("Background", "The Camera clears the screen to this color before rendering."));
}
public void DrawCullingMask()
{
EditorGUILayout.PropertyField(cullingMask);
}
public void DrawProjection()
{
ProjectionType projectionType = orthographic.boolValue
? ProjectionType.Orthographic
: ProjectionType.Perspective;
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = orthographic.hasMultipleDifferentValues;
projectionType =
(ProjectionType)
EditorGUILayout.EnumPopup(
new GUIContent(
"Projection", "How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective."),
projectionType);
EditorGUI.showMixedValue = false;
if (EditorGUI.EndChangeCheck())
orthographic.boolValue = (projectionType == ProjectionType.Orthographic);
if (!orthographic.hasMultipleDifferentValues)
{
if (projectionType == ProjectionType.Orthographic)
EditorGUILayout.PropertyField(orthographicSize, new GUIContent("Size"));
else
EditorGUILayout.Slider(fieldOfView, 1f, 179f,
new GUIContent(
"Field of View", "The width of the Camera’s view angle, measured in degrees along the local Y axis."));
}
}
public void DrawClippingPlanes()
{
EditorGUILayout.LabelField(s_Styles.clipingPlanesLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(nearClippingPlane, s_Styles.nearPlaneLabel);
EditorGUILayout.PropertyField(farClippingPlane, s_Styles.farPlaneLabel);
EditorGUI.indentLevel--;
}
public void DrawNormalizedViewPorts()
{
EditorGUILayout.PropertyField(normalizedViewPortRect,
new GUIContent("Viewport Rect", "Four values that indicate where on the screen this camera view will be drawn. Measured in Viewport Coordinates (values 0–1)."));
}
public void DrawDepth()
{
EditorGUILayout.PropertyField(depth);
}
public void DrawRenderingPath()
private void DrawRenderingPath()
{
using (new EditorGUI.DisabledScope(true))
{

EditorGUILayout.HelpBox(s_Styles.renderingPathInfo.text, MessageType.Info);
}
public void DrawTargetTexture()
private void DrawTargetTexture()
EditorGUILayout.PropertyField(targetTexture);
// show warning if we have deferred but manual MSAA set
// only do this if the m_TargetTexture has the same values across all target cameras
EditorGUILayout.PropertyField(settings.targetTexture);
// TODO: Add fix to change target texture msaa
if (!targetTexture.hasMultipleDifferentValues)
if (!settings.targetTexture.hasMultipleDifferentValues)
var texture = targetTexture.objectReferenceValue as RenderTexture;
var texture = settings.targetTexture.objectReferenceValue as RenderTexture;
int pipelineSamplesCount = lightweightPipeline.MSAASampleCount;
if (texture && texture.antiAliasing > pipelineSamplesCount)

: "has MSAA disabled";
pipelineMSAACaps += " due to Soft Particles being enabled in the pipeline asset";
if (GUILayout.Button(s_Styles.fixNow))
lightweightPipeline.MSAASampleCount = texture.antiAliasing;
public void DrawOcclusionCulling()
{
EditorGUILayout.PropertyField(occlusionCulling);
}
public void DrawHDR()
{
EditorGUILayout.PropertyField(HDR, new GUIContent("Allow HDR"));
}
public void DrawMSAA()
{
EditorGUILayout.PropertyField(allowMSAA);
}
public void DrawDynamicResolution()
private void DrawMSAA()
EditorGUILayout.PropertyField(allowDynamicResolution);
}
public void DrawVR()
{
if (PlayerSettings.virtualRealitySupported)
EditorGUILayout.PropertyField(settings.allowMSAA);
if (settings.allowMSAA.boolValue && lightweightPipeline.MSAASampleCount <= 1)
EditorGUILayout.PropertyField(stereoSeparation);
EditorGUILayout.PropertyField(stereoConvergence);
EditorGUILayout.HelpBox(s_Styles.mssaDisabledWarning, MessageType.Warning);
if (GUILayout.Button(s_Styles.fixNow))
lightweightPipeline.MSAASampleCount = 4;
// Not supported ATM
// public void DrawMultiDisplay()
// {
//#if ENABLE_MULTIPLE_DISPLAYS
// if (ModuleManager.ShouldShowMultiDisplayOption())
// {
// int prevDisplay = targetDisplay.intValue;
// EditorGUILayout.Space();
// EditorGUILayout.IntPopup(targetDisplay, DisplayUtility.GetDisplayNames(),
// DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"));
// if (prevDisplay != targetDisplay.intValue)
// GameView.RepaintAll();
// }
//#endif
// }
public void DrawTargetEye()
{
EditorGUILayout.IntPopup(targetEye, kTargetEyes, kTargetEyeValues, new GUIContent("Target Eye"));
}
enum ProjectionType
{
Perspective,
Orthographic
};
serializedObject.Update();
settings.Update();
DrawClearFlags();
settings.DrawClearFlags();
if (group.visible) DrawBackgroundColor();
if (group.visible) settings.DrawBackgroundColor();
DrawCullingMask();
settings.DrawCullingMask();
DrawProjection();
DrawClippingPlanes();
DrawNormalizedViewPorts();
settings.DrawProjection();
settings.DrawClippingPlanes();
settings.DrawNormalizedViewPort();
DrawDepth();
settings.DrawDepth();
DrawOcclusionCulling();
DrawHDR();
DrawVR();
settings.DrawOcclusionCulling();
settings.DrawHDR();
DrawMSAA();
settings.DrawVR();
settings.DrawMultiDisplay();
if (group.visible) DrawTargetEye();
if (group.visible) settings.DrawTargetEye();
serializedObject.ApplyModifiedProperties();
settings.ApplyModifiedProperties();
}
}
}

262
ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightLightEditor.cs


using UnityEngine;
using UnityEngine.Experimental.Rendering.LightweightPipeline;
// TODO: Once we can target 2018.1 we can remove many duplicated properties in this class
namespace UnityEditor.Experimental.Rendering.LightweightPipeline
{
[CanEditMultipleObjects]

SerializedProperty typeProp;
SerializedProperty rangeProp;
SerializedProperty spotAngleProp;
SerializedProperty cookieSizeProp;
SerializedProperty colorProp;
SerializedProperty intensityProp;
SerializedProperty bounceIntensityProp;
SerializedProperty cookieProp;
SerializedProperty shadowsTypeProp;
SerializedProperty shadowsStrengthProp;
SerializedProperty shadowsResolutionProp;
SerializedProperty shadowsBiasProp;
SerializedProperty shadowsNormalBiasProp;
SerializedProperty shadowsNearPlaneProp;
SerializedProperty renderModeProp;
SerializedProperty cullingMaskProp;
SerializedProperty lightmappingProp;
SerializedProperty areaSizeXProp;
SerializedProperty areaSizeYProp;
SerializedProperty bakedShadowRadiusProp;
SerializedProperty bakedShadowAngleProp;
AnimBool animShowSpotOptions = new AnimBool();
AnimBool animShowPointOptions = new AnimBool();
AnimBool animShowDirOptions = new AnimBool();

class Styles
{
public readonly GUIContent Type = new GUIContent("Type", "Specifies the current type of light. Possible types are Directional, Spot, Point, and Area lights.");
public readonly GUIContent Range = new GUIContent("Range", "Controls how far the light is emitted from the center of the object.");
public readonly GUIContent Color = new GUIContent("Color", "Controls the color being emitted by the light.");
public readonly GUIContent Intensity = new GUIContent("Intensity", "Controls the brightness of the light. Light color is multiplied by this value.");
public readonly GUIContent LightmappingMode = new GUIContent("Mode", "Specifies the light mode used to determine if and how a light will be baked. Possible modes are Baked, Mixed, and Realtime.");
public readonly GUIContent LightBounceIntensity = new GUIContent("Indirect Multiplier", "Controls the intensity of indirect light being contributed to the scene. A value of 0 will cause Realtime lights to be removed from realtime global illumination and Baked and Mixed lights to no longer emit indirect lighting. Has no effect when both Realtime and Baked Global Illumination are disabled.");
public readonly GUIContent ShadowType = new GUIContent("Shadow Type", "Specifies whether Hard Shadows, Soft Shadows, or No Shadows will be cast by the light.");
//realtime
public readonly GUIContent ShadowRealtimeSettings = new GUIContent("Realtime Shadows", "Settings for realtime direct shadows.");
public readonly GUIContent ShadowStrength = new GUIContent("Strength", "Controls how dark the shadows cast by the light will be.");
public readonly GUIContent ShadowResolution = new GUIContent("Resolution", "Controls the rendered resolution of the shadow maps. A higher resolution will increase the fidelity of shadows at the cost of GPU performance and memory usage.");
public readonly GUIContent ShadowBias = new GUIContent("Bias", "Controls the distance at which the shadows will be pushed away from the light. Useful for avoiding false self-shadowing artifacts.");
public readonly GUIContent ShadowNormalBias = new GUIContent("Normal Bias", "Controls distance at which the shadow casting surfaces will be shrunk along the surface normal. Useful for avoiding false self-shadowing artifacts.");
public readonly GUIContent ShadowNearPlane = new GUIContent("Near Plane", "Controls the value for the near clip plane when rendering shadows. Currently clamped to 0.1 units or 1% of the lights range property, whichever is lower.");
//baked
public readonly GUIContent BakedShadowRadius = new GUIContent("Baked Shadow Radius", "Controls the amount of artificial softening applied to the edges of shadows cast by the Point or Spot light.");
public readonly GUIContent BakedShadowAngle = new GUIContent("Baked Shadow Angle", "Controls the amount of artificial softening applied to the edges of shadows cast by directional lights.");
public readonly GUIContent RenderMode = new GUIContent("Render Mode", "Specifies the importance of the light which impacts lighting fidelity and performance. Options are Auto, Important, and Not Important. This only affects Forward Rendering");
public readonly GUIContent CullingMask = new GUIContent("Culling Mask", "Specifies which layers will be affected or excluded from the light's effect on objects in the scene.");
public readonly GUIContent AreaWidth = new GUIContent("Width", "Controls the width in units of the area light.");
public readonly GUIContent AreaHeight = new GUIContent("Height", "Controls the height in units of the area light.");
public readonly GUIContent IndirectBounceShadowWarning = new GUIContent("Realtime indirect bounce shadowing is not supported for Spot and Point lights.");
public readonly GUIContent[] LightmapBakeTypeTitles = { new GUIContent("Realtime"), new GUIContent("Mixed"), new GUIContent("Baked") };
public readonly int[] LightmapBakeTypeValues = { (int)LightmapBakeType.Realtime, (int)LightmapBakeType.Mixed, (int)LightmapBakeType.Baked };
private bool TypeIsSame { get { return !typeProp.hasMultipleDifferentValues; } }
private bool ShadowTypeIsSame { get { return !shadowsTypeProp.hasMultipleDifferentValues; } }
private bool LightmappingTypeIsSame { get { return !lightmappingProp.hasMultipleDifferentValues; } }
private bool TypeIsSame { get { return !settings.lightType.hasMultipleDifferentValues; } }
private bool ShadowTypeIsSame { get { return !settings.shadowsType.hasMultipleDifferentValues; } }
private bool LightmappingTypeIsSame { get { return !settings.lightmapping.hasMultipleDifferentValues; } }
private bool IsRealtime { get { return lightmappingProp.intValue == 4; } }
private bool IsCompletelyBaked { get { return lightmappingProp.intValue == 2; } }
private bool IsBakedOrMixed { get { return !IsRealtime; } }
private Texture Cookie { get { return cookieProp.objectReferenceValue as Texture; } }
private bool SpotOptionsValue { get { return TypeIsSame && LightProperty.type == LightType.Spot; } }
private bool PointOptionsValue { get { return TypeIsSame && LightProperty.type == LightType.Point; } }

// Point light realtime shadows not supported
private bool RuntimeOptionsValue { get { return TypeIsSame && (LightProperty.type != LightType.Area && LightProperty.type != LightType.Point && !IsCompletelyBaked); } }
private bool BakedShadowRadius { get { return TypeIsSame && (LightProperty.type == LightType.Point || LightProperty.type == LightType.Spot) && IsBakedOrMixed; } }
private bool BakedShadowAngle { get { return TypeIsSame && LightProperty.type == LightType.Directional && IsBakedOrMixed; } }
private bool RuntimeOptionsValue { get { return TypeIsSame && (LightProperty.type != LightType.Area && LightProperty.type != LightType.Point && !settings.isCompletelyBaked); } }
private bool BakedShadowRadius { get { return TypeIsSame && (LightProperty.type == LightType.Point || LightProperty.type == LightType.Spot) && settings.isBakedOrMixed; } }
private bool BakedShadowAngle { get { return TypeIsSame && LightProperty.type == LightType.Directional && settings.isBakedOrMixed; } }
private bool BounceWarningValue
{
get
{
return TypeIsSame && (LightProperty.type == LightType.Point || LightProperty.type == LightType.Spot) &&
LightmappingTypeIsSame && IsRealtime && !bounceIntensityProp.hasMultipleDifferentValues && bounceIntensityProp.floatValue > 0.0F;
}
}
private bool BakingWarningValue { get { return !UnityEditor.Lightmapping.bakedGI && LightmappingTypeIsSame && IsBakedOrMixed; } }
private bool BakingWarningValue { get { return !UnityEditor.Lightmapping.bakedGI && LightmappingTypeIsSame && settings.isBakedOrMixed; } }
private bool ShowLightBounceIntensity { get { return true; } }
private bool CookieWarningValue
{

!cookieProp.hasMultipleDifferentValues && Cookie && Cookie.wrapMode != TextureWrapMode.Clamp;
!settings.cookieProp.hasMultipleDifferentValues && settings.cookie && settings.cookie.wrapMode != TextureWrapMode.Clamp;
private bool IsShadowEnabled { get { return shadowsTypeProp.intValue != 0; } }
private bool IsShadowEnabled { get { return settings.shadowsType.intValue != 0; } }
private bool RealtimeShadowsWarningValue
{

ShadowTypeIsSame && IsShadowEnabled &&
LightmappingTypeIsSame && !IsCompletelyBaked;
LightmappingTypeIsSame && !settings.isCompletelyBaked;
}
}

SetOptions(animShowLightBounceIntensity, initialize, ShowLightBounceIntensity);
}
void OnEnable()
protected override void OnEnable()
typeProp = serializedObject.FindProperty("m_Type");
rangeProp = serializedObject.FindProperty("m_Range");
spotAngleProp = serializedObject.FindProperty("m_SpotAngle");
cookieSizeProp = serializedObject.FindProperty("m_CookieSize");
colorProp = serializedObject.FindProperty("m_Color");
intensityProp = serializedObject.FindProperty("m_Intensity");
bounceIntensityProp = serializedObject.FindProperty("m_BounceIntensity");
cookieProp = serializedObject.FindProperty("m_Cookie");
shadowsTypeProp = serializedObject.FindProperty("m_Shadows.m_Type");
shadowsStrengthProp = serializedObject.FindProperty("m_Shadows.m_Strength");
shadowsResolutionProp = serializedObject.FindProperty("m_Shadows.m_Resolution");
shadowsBiasProp = serializedObject.FindProperty("m_Shadows.m_Bias");
shadowsNormalBiasProp = serializedObject.FindProperty("m_Shadows.m_NormalBias");
shadowsNearPlaneProp = serializedObject.FindProperty("m_Shadows.m_NearPlane");
renderModeProp = serializedObject.FindProperty("m_RenderMode");
cullingMaskProp = serializedObject.FindProperty("m_CullingMask");
lightmappingProp = serializedObject.FindProperty("m_Lightmapping");
areaSizeXProp = serializedObject.FindProperty("m_AreaSize.x");
areaSizeYProp = serializedObject.FindProperty("m_AreaSize.y");
bakedShadowRadiusProp = serializedObject.FindProperty("m_ShadowRadius");
bakedShadowAngleProp = serializedObject.FindProperty("m_ShadowAngle");
settings.OnEnable();
public void DrawLightType()
{
EditorGUILayout.PropertyField(typeProp, s_Styles.Type);
}
public void DrawRange(bool showAreaOptions)
{
// If the light is an area light, the range is determined by other parameters.
// Therefore, disable area light's range for editing, but just update the editor field.
if (showAreaOptions)
{
GUI.enabled = false;
string areaLightToolTip = "For area lights " + rangeProp.displayName + " is computed from Width, Height and Intensity";
GUIContent areaRangeWithToolTip = new GUIContent(rangeProp.displayName, areaLightToolTip);
EditorGUILayout.FloatField(areaRangeWithToolTip, LightProperty.range);
GUI.enabled = true;
}
else
EditorGUILayout.PropertyField(rangeProp, s_Styles.Range);
}
EditorGUILayout.Slider(spotAngleProp, 1f, 179f, s_Styles.SpotAngle);
}
public void DrawArea()
{
EditorGUILayout.PropertyField(areaSizeXProp, s_Styles.AreaWidth);
EditorGUILayout.PropertyField(areaSizeYProp, s_Styles.AreaHeight);
}
public void DrawColor()
{
EditorGUILayout.PropertyField(colorProp, s_Styles.Color);
}
public void DrawLightmapping()
{
EditorGUILayout.IntPopup(lightmappingProp, s_Styles.LightmapBakeTypeTitles, s_Styles.LightmapBakeTypeValues, s_Styles.LightmappingMode);
// Warning if GI Baking disabled and m_Lightmapping isn't realtime
if (BakingWarningValue)
{
EditorGUILayout.HelpBox(s_Styles.BakingWarning.text, MessageType.Info);
}
}
public void DrawIntensity()
{
EditorGUILayout.PropertyField(intensityProp, s_Styles.Intensity);
}
public void DrawBounceIntensity()
{
EditorGUILayout.PropertyField(bounceIntensityProp, s_Styles.LightBounceIntensity);
// Indirect shadows warning (Should be removed when we support realtime indirect shadows)
if (BounceWarningValue)
{
EditorGUILayout.HelpBox(s_Styles.IndirectBounceShadowWarning.text, MessageType.Info);
}
EditorGUILayout.Slider(settings.spotAngle, 1f, 179f, s_Styles.SpotAngle);
EditorGUILayout.PropertyField(cookieProp, s_Styles.Cookie);
EditorGUILayout.PropertyField(settings.cookieProp, s_Styles.Cookie);
if (CookieWarningValue)
{

public void DrawCookieSize()
{
EditorGUILayout.PropertyField(cookieSizeProp, s_Styles.CookieSize);
}
public void DrawRenderMode()
{
EditorGUILayout.PropertyField(renderModeProp, s_Styles.RenderMode);
}
public void DrawCullingMask()
{
EditorGUILayout.PropertyField(cullingMaskProp, s_Styles.CullingMask);
}
public void DrawShadowsType()
{
EditorGUILayout.Space();
EditorGUILayout.PropertyField(shadowsTypeProp, s_Styles.ShadowType);
}
public void DrawBakedShadowRadius()
{
using (new EditorGUI.DisabledScope(shadowsTypeProp.intValue != (int)LightShadows.Soft))
{
EditorGUILayout.PropertyField(bakedShadowRadiusProp, s_Styles.BakedShadowRadius);
}
}
public void DrawBakedShadowAngle()
{
using (new EditorGUI.DisabledScope(shadowsTypeProp.intValue != (int)LightShadows.Soft))
{
EditorGUILayout.Slider(bakedShadowAngleProp, 0.0F, 90.0F, s_Styles.BakedShadowAngle);
}
}
public void DrawRuntimeShadow()
{
EditorGUILayout.LabelField(s_Styles.ShadowRealtimeSettings);
EditorGUI.indentLevel += 1;
EditorGUILayout.Slider(shadowsStrengthProp, 0f, 1f, s_Styles.ShadowStrength);
EditorGUILayout.PropertyField(shadowsResolutionProp, s_Styles.ShadowResolution);
EditorGUILayout.Slider(shadowsBiasProp, 0.0f, 2.0f, s_Styles.ShadowBias);
EditorGUILayout.Slider(shadowsNormalBiasProp, 0.0f, 3.0f, s_Styles.ShadowNormalBias);
// this min bound should match the calculation in SharedLightData::GetNearPlaneMinBound()
float nearPlaneMinBound = Mathf.Min(0.01f*rangeProp.floatValue, 0.1f);
EditorGUILayout.Slider(shadowsNearPlaneProp, nearPlaneMinBound, 10.0f, s_Styles.ShadowNearPlane);
EditorGUI.indentLevel -= 1;
EditorGUILayout.PropertyField(settings.cookieSize, s_Styles.CookieSize);
}
public override void OnInspectorGUI()

serializedObject.Update();
settings.Update();
DrawLightType();
settings.DrawLightType();
EditorGUILayout.Space();

if (group.visible) DrawRange(animShowAreaOptions.target);
if (group.visible)
settings.DrawRange(animShowAreaOptions.target);
if (group.visible) DrawSpotAngle();
if (group.visible)
DrawSpotAngle();
if (group.visible) DrawArea();
if (group.visible)
settings.DrawArea();
DrawColor();
settings.DrawColor();
if (group.visible) DrawLightmapping();
if (group.visible)
settings.DrawLightmapping();
DrawIntensity();
settings.DrawIntensity();
if (group.visible) DrawBounceIntensity();
if (group.visible)
settings.DrawBounceIntensity();
if (group.visible) DrawCookie();
if (group.visible)
DrawCookie();
if (group.visible) DrawCookieSize();
if (group.visible)
DrawCookieSize();
DrawRenderMode();
DrawCullingMask();
settings.DrawRenderMode();
settings.DrawCullingMask();
EditorGUILayout.Space();

// Shadows drop-down. Area lights can only be baked and always have shadows.
float show = 1.0f - animShowAreaOptions.faded;
using (new EditorGUILayout.FadeGroupScope(show))
DrawShadowsType();
settings.DrawShadowsType();
if (group.visible) DrawBakedShadowRadius();
if (group.visible)
settings.DrawBakedShadowRadius();
if (group.visible) DrawBakedShadowAngle();
if (group.visible)
settings.DrawBakedShadowAngle();
if (group.visible) DrawRuntimeShadow();
if (group.visible)
settings.DrawRuntimeShadow();
EditorGUI.indentLevel -= 1;
if (BakingWarningValue)

64
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardGUI.cs


private static class Styles
{
public static GUIContent uvSetLabel = new GUIContent("UV Set");
public static GUIContent albedoText = new GUIContent("Albedo", "Albedo (RGB) and Transparency (A)");
public static GUIContent alphaCutoffText = new GUIContent("Alpha Cutoff", "Threshold for alpha cutoff");
public static GUIContent specularMapText = new GUIContent("Specular", "Specular (RGB) and Smoothness (A)");

public static GUIContent highlightsText = new GUIContent("Specular Highlights", "Specular Highlights");
public static GUIContent reflectionsText = new GUIContent("Reflections", "Glossy Reflections");
public static GUIContent normalMapText = new GUIContent("Normal Map", "Normal Map");
public static GUIContent heightMapText = new GUIContent("Height Map", "Height Map (G)");
public static GUIContent detailMaskText = new GUIContent("Detail Mask", "Mask for Secondary Maps (A)");
public static GUIContent detailAlbedoText = new GUIContent("Detail Albedo x2", "Albedo (RGB) multiplied by 2");
public static GUIContent detailNormalMapText = new GUIContent("Normal Map", "Normal Map");
public static GUIContent bumpScaleNotSupported = new GUIContent("Bump scale is not supported on mobile platforms");
public static GUIContent fixNow = new GUIContent("Fix now");

}
#pragma warning disable 0414
private MaterialProperty workflowMode = null;
private MaterialProperty blendMode = null;
private MaterialProperty workflowMode;
private MaterialProperty blendMode;
private MaterialProperty albedoColor = null;
private MaterialProperty albedoMap = null;
private MaterialProperty alphaCutoff = null;
private MaterialProperty albedoColor;
private MaterialProperty albedoMap;
private MaterialProperty alphaCutoff;
private MaterialProperty smoothness = null;
private MaterialProperty smoothnessScale = null;
private MaterialProperty smoothnessMapChannel = null;
private MaterialProperty smoothness;
private MaterialProperty smoothnessScale;
private MaterialProperty smoothnessMapChannel;
private MaterialProperty metallic = null;
private MaterialProperty specColor = null;
private MaterialProperty metallicGlossMap = null;
private MaterialProperty specGlossMap = null;
private MaterialProperty highlights = null;
private MaterialProperty reflections = null;
private MaterialProperty metallic;
private MaterialProperty specColor;
private MaterialProperty metallicGlossMap;
private MaterialProperty specGlossMap;
private MaterialProperty highlights;
private MaterialProperty reflections;
private MaterialProperty bumpScale = null;
private MaterialProperty bumpMap = null;
private MaterialProperty occlusionStrength = null;
private MaterialProperty occlusionMap = null;
private MaterialProperty heigtMapScale = null;
private MaterialProperty heightMap = null;
private MaterialProperty emissionColorForRendering = null;
private MaterialProperty emissionMap = null;
private MaterialProperty detailMask = null;
private MaterialProperty detailAlbedoMap = null;
private MaterialProperty detailNormalMapScale = null;
private MaterialProperty detailNormalMap = null;
private MaterialProperty uvSetSecondary = null;
private MaterialProperty bumpScale;
private MaterialProperty bumpMap;
private MaterialProperty occlusionStrength;
private MaterialProperty occlusionMap;
private MaterialProperty emissionColorForRendering;
private MaterialProperty emissionMap;
private const float kMaxfp16 = 65536f; // Clamp to a value that fits into fp16.
private ColorPickerHDRConfig m_ColorPickerHDRConfig = new ColorPickerHDRConfig(0f, kMaxfp16, 1 / kMaxfp16, 3f);
private bool m_FirstTimeApply = true;
#pragma warning restore 0414

bumpScale = FindProperty("_BumpScale", props);
bumpMap = FindProperty("_BumpMap", props);
heigtMapScale = FindProperty("_Parallax", props);
heightMap = FindProperty("_ParallaxMap", props);
detailMask = FindProperty("_DetailMask", props);
detailAlbedoMap = FindProperty("_DetailAlbedoMap", props);
detailNormalMapScale = FindProperty("_DetailNormalMapScale", props);
detailNormalMap = FindProperty("_DetailNormalMap", props);
uvSetSecondary = FindProperty("_UVSec", props);
}
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)

bool hadEmissionTexture = emissionMap.textureValue != null;
// Texture and HDR color controls
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, m_ColorPickerHDRConfig, false);
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, false);
// If texture was assigned and color was black set color to white
float brightness = emissionColorForRendering.colorValue.maxColorComponent;

47
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardParticlesShaderGUI.cs


public static GUIContent streamApplyToAllSystemsText = new GUIContent("Apply to Systems", "Apply the vertex stream layout to all Particle Systems using this material");
}
MaterialProperty blendMode = null;
MaterialProperty colorMode = null;
MaterialProperty flipbookMode = null;
MaterialProperty cullMode = null;
MaterialProperty albedoMap = null;
MaterialProperty albedoColor = null;
MaterialProperty alphaCutoff = null;
MaterialProperty metallicMap = null;
MaterialProperty metallic = null;
MaterialProperty smoothness = null;
MaterialProperty bumpScale = null;
MaterialProperty bumpMap = null;
MaterialProperty emissionEnabled = null;
MaterialProperty emissionColorForRendering = null;
MaterialProperty emissionMap = null;
MaterialProperty softParticlesEnabled = null;
MaterialProperty cameraFadingEnabled = null;
MaterialProperty softParticlesNearFadeDistance = null;
MaterialProperty softParticlesFarFadeDistance = null;
MaterialProperty cameraNearFadeDistance = null;
MaterialProperty cameraFarFadeDistance = null;
MaterialProperty blendMode;
MaterialProperty colorMode;
MaterialProperty flipbookMode;
MaterialProperty cullMode;
MaterialProperty albedoMap;
MaterialProperty albedoColor;
MaterialProperty alphaCutoff;
MaterialProperty metallicMap;
MaterialProperty metallic;
MaterialProperty smoothness;
MaterialProperty bumpScale;
MaterialProperty bumpMap;
MaterialProperty emissionEnabled;
MaterialProperty emissionColorForRendering;
MaterialProperty emissionMap;
MaterialProperty softParticlesEnabled;
MaterialProperty cameraFadingEnabled;
MaterialProperty softParticlesNearFadeDistance;
MaterialProperty softParticlesFarFadeDistance;
MaterialProperty cameraNearFadeDistance;
MaterialProperty cameraFarFadeDistance;
ColorPickerHDRConfig m_ColorPickerHDRConfig = new ColorPickerHDRConfig(0f, 99f, 1 / 99f, 3f);
List<ParticleSystemRenderer> m_RenderersUsingThisMaterial = new List<ParticleSystemRenderer>();
bool m_FirstTimeApply = true;

void DoAlbedoArea(Material material)
{
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.albedoText, albedoMap, albedoColor, m_ColorPickerHDRConfig, true);
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.albedoText, albedoMap, albedoColor, true);
if (((BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout))
{
m_MaterialEditor.ShaderProperty(alphaCutoff, Styles.alphaCutoffText, MaterialEditor.kMiniTextureFieldLabelIndentLevel);

bool hadEmissionTexture = emissionMap.textureValue != null;
// Texture and HDR color controls
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, m_ColorPickerHDRConfig, false);
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, false);
// If texture was assigned and color was black set color to white
float brightness = emissionColorForRendering.colorValue.maxColorComponent;

30
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardSimpleLightingGUI.cs


public class LightweightStandardSimpleLightingGUI : ShaderGUI
{
private const float kMinShininessValue = 0.01f;
private MaterialProperty blendModeProp = null;
private MaterialProperty albedoMapProp = null;
private MaterialProperty albedoColorProp = null;
private MaterialProperty alphaCutoffProp = null;
private MaterialProperty specularSourceProp = null;
private MaterialProperty glossinessSourceProp = null;
private MaterialProperty specularGlossMapProp = null;
private MaterialProperty specularColorProp = null;
private MaterialProperty shininessProp = null;
private MaterialProperty bumpMapProp = null;
private MaterialProperty emissionMapProp = null;
private MaterialProperty emissionColorProp = null;
private MaterialProperty blendModeProp;
private MaterialProperty albedoMapProp;
private MaterialProperty albedoColorProp;
private MaterialProperty alphaCutoffProp;
private MaterialProperty specularSourceProp;
private MaterialProperty glossinessSourceProp;
private MaterialProperty specularGlossMapProp;
private MaterialProperty specularColorProp;
private MaterialProperty shininessProp;
private MaterialProperty bumpMapProp;
private MaterialProperty emissionMapProp;
private MaterialProperty emissionColorProp;
private MaterialEditor m_MaterialEditor = null;
private const float kMaxfp16 = 65536f; // Clamp to a value that fits into fp16.
private ColorPickerHDRConfig m_ColorPickerHDRConfig = new ColorPickerHDRConfig(0f, kMaxfp16, 1 / kMaxfp16, 3f);
private MaterialEditor m_MaterialEditor;
private static class Styles
{

bool hadEmissionTexture = emissionMapProp.textureValue != null;
// Texture and HDR color controls
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionMapLabel, emissionMapProp, emissionColorProp, m_ColorPickerHDRConfig, false);
m_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionMapLabel, emissionMapProp, emissionColorProp, false);
// If texture was assigned and color was black set color to white
float brightness = emissionColorProp.colorValue.maxColorComponent;

78
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightUnlitGUI.cs


public class LightweightUnlitGUI : ShaderGUI
{
private MaterialProperty blendModeProp = null;
private MaterialProperty mainTexProp = null;
private MaterialProperty mainColorProp = null;
private MaterialProperty alphaCutoffProp = null;
private MaterialProperty blendModeProp;
private MaterialProperty mainTexProp;
private MaterialProperty mainColorProp;
private MaterialProperty alphaCutoffProp;
private MaterialProperty sampleGIProp;
private MaterialProperty bumpMap;
private MaterialEditor m_MaterialEditor = null;
private MaterialEditor m_MaterialEditor;
private static class Styles
{

new GUIContent("MainTex (RGB) Alpha (A)", "Base Color and Alpha")
};
public static GUIContent normalMapLabel = new GUIContent("Normal Map", "Normal Map");
public static GUIContent sampleGILabel = new GUIContent("Sample GI", "If enabled GI will be sampled from SH or Lightmap.");
}
private void FindMaterialProperties(MaterialProperty[] properties)

mainColorProp = FindProperty("_MainColor", properties);
mainColorProp = FindProperty("_Color", properties);
sampleGIProp = FindProperty("_SampleGI", properties, false);
bumpMap = FindProperty("_BumpMap", properties, false);
}
private void DoPopup(string label, MaterialProperty property, string[] options)
{
EditorGUI.showMixedValue = property.hasMixedValue;
var mode = property.floatValue;
EditorGUI.BeginChangeCheck();
mode = EditorGUILayout.Popup(label, (int)mode, options);
if (EditorGUI.EndChangeCheck())
{
m_MaterialEditor.RegisterPropertyChangeUndo(label);
property.floatValue = mode;
}
EditorGUI.showMixedValue = false;
Material material = materialEditor.target as Material;
int modeValue = (int)blendModeProp.floatValue;
modeValue = EditorGUILayout.Popup(Styles.renderingModeLabel, modeValue, Styles.blendNames);
if (EditorGUI.EndChangeCheck())
blendModeProp.floatValue = modeValue;
{
DoPopup(Styles.renderingModeLabel, blendModeProp, Styles.blendNames);
int modeValue = (int) blendModeProp.floatValue;
GUIContent mainTexLabel = Styles.mainTexLabels[Math.Min(modeValue, 1)];
m_MaterialEditor.TexturePropertySingleLine(mainTexLabel, mainTexProp, mainColorProp);
m_MaterialEditor.TextureScaleOffsetProperty(mainTexProp);
GUIContent mainTexLabel = Styles.mainTexLabels[Math.Min(modeValue, 1)];
m_MaterialEditor.TexturePropertySingleLine(mainTexLabel, mainTexProp, mainColorProp);
m_MaterialEditor.TextureScaleOffsetProperty(mainTexProp);
if ((UpgradeBlendMode) modeValue == UpgradeBlendMode.Cutout)
m_MaterialEditor.RangeProperty(alphaCutoffProp, Styles.alphaCutoffLabel);
if ((UpgradeBlendMode) modeValue == UpgradeBlendMode.Cutout)
m_MaterialEditor.RangeProperty(alphaCutoffProp, Styles.alphaCutoffLabel);
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
m_MaterialEditor.ShaderProperty(sampleGIProp, Styles.sampleGILabel);
if (sampleGIProp.floatValue >= 1.0)
m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapLabel, bumpMap);
materialEditor.RenderQueueField();
EditorGUILayout.Space();
EditorGUILayout.Space();
LightweightShaderHelper.SetMaterialBlendMode(material);
materialEditor.RenderQueueField();
}
if (EditorGUI.EndChangeCheck())
{
foreach (var target in blendModeProp.targets)
MaterialChanged((Material)target);
}
}
private void MaterialChanged(Material material)
{
material.shaderKeywords = null;
bool sampleGI = material.GetFloat("_SampleGI") >= 1.0f;
LightweightShaderHelper.SetMaterialBlendMode(material);
LightweightShaderHelper.SetKeyword(material, "_SAMPLE_GI", sampleGI);
LightweightShaderHelper.SetKeyword(material, "_NORMAL_MAP", sampleGI && material.GetTexture("_BumpMap"));
}
}

5
ScriptableRenderPipeline/LightweightPipeline/Editor/StandardToLightweightMaterialUpgrader.cs.meta


fileFormatVersion: 2
guid: aec5479bdc442cb4d96b1de3f5e5c818
timeCreated: 1484641774
licenseType: Pro
guid: d639cdbf740deb94687e01a181ea790a
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0

6
ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs


m_RequiredDepth = false;
m_CameraPostProcessLayer = m_CurrCamera.GetComponent<PostProcessLayer>();
bool msaaEnabled = m_Asset.MSAASampleCount > 1 && (m_CurrCamera.targetTexture == null || m_CurrCamera.targetTexture.antiAliasing > 1);
bool msaaEnabled = m_CurrCamera.allowMSAA && m_Asset.MSAASampleCount > 1 && (m_CurrCamera.targetTexture == null || m_CurrCamera.targetTexture.antiAliasing > 1);
bool softParticlesEnabled = m_Asset.SupportsSoftParticles && !stereoEnabled;
bool softParticlesEnabled = m_Asset.RequireCameraDepthTexture && !stereoEnabled;
if (postProcessEnabled)
{
m_RequiredDepth = true;

cmd.EnableShaderKeyword(shadowKeywords[keywordIndex]);
}
CoreUtils.SetKeyword(cmd, "SOFTPARTICLES_ON", m_Asset.SupportsSoftParticles);
CoreUtils.SetKeyword(cmd, "SOFTPARTICLES_ON", m_Asset.RequireCameraDepthTexture);
}
private bool RenderShadows(ref CullResults cullResults, ref VisibleLight shadowLight, int shadowLightIndex, ref ScriptableRenderContext context)

39
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCore.cginc


#define OUTPUT_COLOR(color) color
#endif
#ifdef _NORMALMAP
#define OUTPUT_NORMAL(IN, OUT) OutputTangentToWorld(IN.tangent, IN.normal, OUT.tangent, OUT.binormal, OUT.normal)
#else
#define OUTPUT_NORMAL(IN, OUT) OUT.normal = UnityObjectToWorldNormal(IN.normal)
#endif
#ifdef LIGHTMAP_ON
#define OUTPUT_LIGHTMAP_UV(lightmapUV, lightmapScaleOffset, OUT) OUT.xy = lightmapUV.xy * lightmapScaleOffset.xy + lightmapScaleOffset.zw;
#define OUTPUT_SH(normalWS, OUT)
#else
#define OUTPUT_LIGHTMAP_UV(lightmapUV, lightmapScaleOffset, OUT)
#define OUTPUT_SH(normalWS, OUT) OUT.xyz = EvaluateSHPerVertex(normalWS)
#endif
half _Pow4(half x)
{
return x * x * x * x;

return oneMinusT + b * t;
}
void AlphaDiscard(half alpha, half cutoff)
{
#ifdef _ALPHATEST_ON
clip(alpha - cutoff);
#endif
}
half3 SafeNormalize(half3 inVec)
{
half dp3 = max(1.e-4h, dot(inVec, inVec));

return half3(0.0, 0.0, 0.0);
}
half3 EvaluateSHPerPixel(half3 normalWS)
{
return max(half3(0, 0, 0), ShadeSH9(half4(normalWS, 1.0)));
}
half3 EvaluateSHPerPixel(half3 normalWS, half3 L2Term)
half3 EvaluateSHPerPixel(half3 L2Term, half3 normalWS)
return = max(half3(0, 0, 0), L2Term + SHEvalLinearL0L1(half4(normalWS, 1.0)));
return max(half3(0, 0, 0), L2Term + SHEvalLinearL0L1(half4(normalWS, 1.0)));
#endif
// Default: Evaluate SH fully per-pixel

#endif
return bakedColor;
}
half3 SampleGI(float4 sampleData, half3 normalWS)
{
#if LIGHTMAP_ON
return SampleLightmap(sampleData.xy, normalWS);
#endif
return EvaluateSHPerPixel(sampleData.xyz, normalWS);
}
void OutputTangentToWorld(half4 vertexTangent, half3 vertexNormal, out half3 tangentWS, out half3 binormalWS, out half3 normalWS)

3
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightInput.cginc


CBUFFER_END
CBUFFER_START(_PerCamera)
sampler2D _MainLightCookie;
float4 _MainLightPosition;
half4 _MainLightColor;
half4 _MainLightDistanceAttenuation;

half4 _AdditionalLightSpotDir[MAX_VISIBLE_LIGHTS];
half4 _AdditionalLightSpotAttenuation[MAX_VISIBLE_LIGHTS];
CBUFFER_END
sampler2D _MainLightCookie;
// These are set internally by the engine upon request by RendererConfiguration.
// Check GetRendererSettings in LightweightPipeline.cs

79
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightPassLit.cginc


struct LightweightVertexOutput
{
float4 uv01 : TEXCOORD0; // xy: main UV, zw: lightmap UV (directional / non-directional)
float3 posWS : TEXCOORD1;
float2 uv : TEXCOORD0;
float4 lightmapUVOrVertexSH : TEXCOORD1; // holds either lightmapUV or vertex SH. depending on LIGHTMAP_ON
float4 posWS : TEXCOORD2;
half3 normal : TEXCOORD3;
half3 tangent : TEXCOORD2;
half3 binormal : TEXCOORD3;
half3 normal : TEXCOORD4;
#else
half3 normal : TEXCOORD2;
half3 tangent : TEXCOORD4;
half3 binormal : TEXCOORD5;
half3 viewDir : TEXCOORD5;
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
#ifndef LIGHTMAP_ON
half4 vertexSH : TEXCOORD7;
#endif
half3 viewDir : TEXCOORD6;
half4 fogFactorAndVertexLight : TEXCOORD7; // x: fogFactor, yzw: vertex light
float4 clipPos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO

UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.uv01.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
#ifdef LIGHTMAP_ON
o.uv01.zw = v.lightmapUV * unity_LightmapST.xy + unity_LightmapST.zw;
#endif
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
float4 positionWS = mul(unity_ObjectToWorld, v.vertex);
half3 viewDirectionWS = SafeNormalize(_WorldSpaceCameraPos - positionWS.xyz);
o.posWS = mul(unity_ObjectToWorld, v.vertex);
o.clipPos = mul(UNITY_MATRIX_VP, o.posWS);
o.viewDir = SafeNormalize(_WorldSpaceCameraPos - o.posWS.xyz);
#if _NORMALMAP
OutputTangentToWorld(v.tangent, v.normal, o.tangent, o.binormal, o.normal);
#else
o.normal = UnityObjectToWorldNormal(v.normal);
#endif
// initializes o.normal and if _NORMALMAP also o.tangent and o.binormal
OUTPUT_NORMAL(v, o);
float4 clipPos = mul(UNITY_MATRIX_VP, positionWS);
#ifndef LIGHTMAP_ON
o.vertexSH = half4(EvaluateSHPerVertex(o.normal), 0.0);
#endif
// We either sample GI from lightmap or SH. lightmap UV and vertex SH coefficients
// are packed in lightmapUVOrVertexSH to save interpolator.
// The following funcions initialize
OUTPUT_LIGHTMAP_UV(v.lightmapUV, unity_LightmapST, o.lightmapUVOrVertexSH);
OUTPUT_SH(o.normal, o.lightmapUVOrVertexSH);
o.posWS = positionWS;
o.viewDir = viewDirectionWS;
o.fogFactorAndVertexLight.yzw = VertexLighting(positionWS.xyz, o.normal);
o.fogFactorAndVertexLight.x = ComputeFogFactor(clipPos.z);
o.clipPos = clipPos;
half3 vertexLight = VertexLighting(o.posWS.xyz, o.normal);
half fogFactor = ComputeFogFactor(o.clipPos.z);
o.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
return o;
}

{
SurfaceData surfaceData;
InitializeStandardLitSurfaceData(IN.uv01.xy, surfaceData);
InitializeStandardLitSurfaceData(IN.uv, surfaceData);
#if _NORMALMAP
half3 normalWS = TangentToWorldNormal(surfaceData.normal, IN.tangent, IN.binormal, IN.normal);

#if LIGHTMAP_ON
half3 indirectDiffuse = SampleLightmap(IN.uv01.zw, normalWS);
#else
half3 indirectDiffuse = EvaluateSHPerPixel(normalWS, IN.vertexSH);
#endif
half3 indirectDiffuse = SampleGI(IN.lightmapUVOrVertexSH, normalWS);
float fogFactor = IN.fogFactorAndVertexLight.x;
float fogFactor = IN.fogFactorAndVertexLight.x;
half4 color = LightweightFragmentPBR(IN.posWS, normalWS, IN.viewDir, indirectDiffuse, IN.fogFactorAndVertexLight.yzw, surfaceData.albedo, surfaceData.metallic, surfaceData.specular, surfaceData.smoothness, surfaceData.occlusion, surfaceData.emission, surfaceData.alpha);
// Computes fog factor per-vertex

// Used for StandardSimpleLighting shader
half4 LitPassFragmentSimple(LightweightVertexOutput IN) : SV_Target
{
float2 uv = IN.uv01.xy;
float2 lightmapUV = IN.uv01.zw;
float2 uv = IN.uv;
half4 diffuseAlpha = tex2D(_MainTex, uv);
half3 diffuse = LIGHTWEIGHT_GAMMA_TO_LINEAR(diffuseAlpha.rgb) * _Color.rgb;

half alpha = diffuseAlpha.a * _Color.a;
#endif
#ifdef _ALPHATEST_ON
clip(alpha - _Cutoff);
#endif
AlphaDiscard(alpha, _Cutoff);
#if _NORMALMAP
half3 normalTangent = Normal(uv);

half3 viewDirectionWS = SafeNormalize(IN.viewDir.xyz);
float3 positionWS = IN.posWS.xyz;
#if defined(LIGHTMAP_ON)
half3 diffuseGI = SampleLightmap(lightmapUV, normalWS);
#else
half3 diffuseGI = EvaluateSHPerPixel(normalWS, IN.vertexSH);
#endif
half3 diffuseGI = SampleGI(IN.lightmapUVOrVertexSH, normalWS);
#if _VERTEX_LIGHTS
diffuseGI += IN.fogFactorAndVertexLight.yzw;

33
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandard.shader


ENDCG
}
// This pass it not used during regular rendering, only for lightmap baking.
Pass
{
Tags{"LightMode" = "Meta"}
// This pass it not used during regular rendering, only for lightmap baking.
Pass
{
Tags{"LightMode" = "Meta"}
Cull Off
Cull Off
CGPROGRAM
#pragma vertex LightweightVertexMeta
#pragma fragment LightweightFragmentMeta
CGPROGRAM
#pragma vertex LightweightVertexMeta
#pragma fragment LightweightFragmentMeta
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICSPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature EDITOR_VISUALIZATION
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICSPECGLOSSMAP
#pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma shader_feature EDITOR_VISUALIZATION
#pragma shader_feature _EMISSION
#pragma shader_feature _SPECGLOSSMAP
#pragma shader_feature _SPECGLOSSMAP
#include "LightweightPassMeta.cginc"
ENDCG
}
#include "LightweightPassMeta.cginc"
ENDCG
}
}
FallBack "Hidden/InternalErrorShader"
CustomEditor "LightweightStandardGUI"

71
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader


Properties
{
_MainTex("Texture", 2D) = "white" {}
_MainColor("MainColor", Color) = (1, 1, 1, 1)
_Color("Color", Color) = (1, 1, 1, 1)
[Toggle] _SampleGI("SampleGI", float) = 0.0
_BumpMap("Normal Map", 2D) = "bump" {}
// BlendMode
[HideInInspector] _Mode("Mode", Float) = 0.0

#pragma fragment frag
#pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON
#pragma multi_compile_fog
#pragma shader_feature _SAMPLE_GI
#include "UnityCG.cginc"
#include "LightweightCore.cginc"
#include "LightweightSurfaceInput.cginc"
struct appdata
struct VertexInput
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float2 lightmapUV : TEXCOORD1;
float3 normal : NORMAL;
struct v2f
struct VertexOutput
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float3 uv0AndFogCoord : TEXCOORD0; // xy: uv0, z: fogCoord
#if _SAMPLE_GI
float4 lightmapOrVertexSH : TEXCOORD1;
half3 normal : TEXCOORD2;
#if _NORMALMAP
half3 tangent : TEXCOORD3;
half3 binormal : TEXCOORD4;
#endif
#endif
sampler2D _MainTex;
float4 _MainTex_ST;
half4 _MainColor;
half _Cutoff;
v2f vert(appdata v)
VertexOutput vert(VertexInput v)
v2f o;
VertexOutput o = (VertexOutput)0;
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
o.uv0AndFogCoord.xy = TRANSFORM_TEX(v.uv, _MainTex);
o.uv0AndFogCoord.z = ComputeFogFactor(o.vertex.z);
#if _SAMPLE_GI
OUTPUT_NORMAL(v, o);
half3 normalWS = o.normal;
OUTPUT_LIGHTMAP_UV(v.lightmapUV, unity_LightmapST, o.lightmapOrVertexSH.xy);
OUTPUT_SH(normalWS, o.lightmapOrVertexSH);
#endif
fixed4 frag(v2f i) : SV_Target
fixed4 frag(VertexOutput IN) : SV_Target
fixed4 texColor = tex2D(_MainTex, i.uv);
fixed alpha = texColor.a * _MainColor.a;
fixed3 color = texColor.rgb * _MainColor.rgb;
half2 uv = IN.uv0AndFogCoord.xy;
half4 texColor = tex2D(_MainTex, uv);
half3 color = texColor.rgb * _Color.rgb;
half alpha = texColor.a * _Color.a;
AlphaDiscard(alpha, _Cutoff);
#ifdef _ALPHATEST_ON
clip(alpha - _Cutoff);
#if _SAMPLE_GI
#if _NORMALMAP
half3 normalWS = TangentToWorldNormal(surfaceData.normal, IN.tangent, IN.binormal, IN.normal);
#else
half3 normalWS = normalize(IN.normal);
#endif
color += SampleGI(IN.lightmapOrVertexSH, normalWS);
UNITY_APPLY_FOG(i.fogCoord, color);
ApplyFog(color, IN.uv0AndFogCoord.z);
#ifdef _ALPHABLEND_ON
return fixed4(color, alpha);

6
ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs


// Default values set when a new LightweightPipeline asset is created
[SerializeField] private int m_MaxPixelLights = 4;
[SerializeField] private bool m_SupportsVertexLight = false;
[SerializeField] private bool m_SupportSoftParticles = false;
[SerializeField] private bool m_RequireCameraDepthTexture = false;
[SerializeField] private MSAAQuality m_MSAA = MSAAQuality._4x;
[SerializeField] private float m_RenderScale = 1.0f;
[SerializeField] private ShadowType m_ShadowType = ShadowType.HARD_SHADOWS;

get { return m_SupportsVertexLight; }
}
public bool SupportsSoftParticles
public bool RequireCameraDepthTexture
get { return m_SupportSoftParticles; }
get { return m_RequireCameraDepthTexture; }
}
public int MSAASampleCount

33
Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps.unity


m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3

m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_IndirectSpecularColor: {r: 0.18263894, g: 0.22835018, b: 0.30714685, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0

m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 9
serializedVersion: 10
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!23 &35430817
MeshRenderer:

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: f07d64f004a1345ab989bfb4c08c1629, type: 2}
m_StaticBatchInfo:

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!23 &167879084
MeshRenderer:

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: ae6dcf3efd53846d6a4c747e34721a86, type: 2}
m_StaticBatchInfo:

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!23 &316403772
MeshRenderer:

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 46f4548be2fd99a49930be9c22b22312, type: 2}
m_StaticBatchInfo:

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!23 &442397142
MeshRenderer:

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 2eb5a64ab43ee410f80b503f2637eaa4, type: 2}
m_StaticBatchInfo:

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!23 &952102530
MeshRenderer:

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 874a014676eb94aa0b2df78530ae71ec, type: 2}
m_StaticBatchInfo:

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!23 &1511850537
MeshRenderer:

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 4fe532de4bae248f4bfff4daa180fa2d, type: 2}
m_StaticBatchInfo:

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!23 &1664660673
MeshRenderer:

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 5cf2933049f3c41858b74c8f37387bd7, type: 2}
m_StaticBatchInfo:

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!23 &1823431992
MeshRenderer:

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 466de0b30ac50484c9d07caa7c51b179, type: 2}
m_StaticBatchInfo:

5
Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps/007_LitShaderMaps_UnlitMatTexture_08.mat


m_PrefabInternal: {fileID: 0}
m_Name: 007_LitShaderMaps_UnlitMatTexture_08
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
m_ShaderKeywords: _EMISSION _NORMALMAP _SPECGLOSSMAP_BASE_ALPHA
m_ShaderKeywords: _SAMPLE_GI
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0

- _OcclusionStrength: 1
- _Parallax: 0.02
- _ReflectionSource: 0
- _SampleGI: 1
- _Shininess: 1
- _SmoothnessTextureChannel: 0
- _SpecSource: 0

- _ZWrite: 1
m_Colors:
- _Color: {r: 0.9264706, g: 0.095371954, b: 0.095371954, a: 1}
- _Color: {r: 1, g: 1, b: 0.9254902, a: 1}
- _EmissionColor: {r: 0.20663926, g: 0.24034719, b: 0.28676468, a: 1}
- _MainColor: {r: 1, g: 1, b: 1, a: 1}
- _ReflectColor: {r: 1, g: 1, b: 1, a: 1}

3
Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps/007_LitShaderMaps_UnlitMat_07.mat


m_PrefabInternal: {fileID: 0}
m_Name: 007_LitShaderMaps_UnlitMat_07
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
m_ShaderKeywords: _ALPHABLEND_ON _NORMALMAP _SPECGLOSSMAP_BASE_ALPHA
m_ShaderKeywords: _ALPHABLEND_ON _SAMPLE_GI
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0

- _OcclusionStrength: 1
- _Parallax: 0.02
- _ReflectionSource: 0
- _SampleGI: 1
- _Shininess: 1
- _SmoothnessTextureChannel: 0
- _SpecSource: 0

5
Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps/LightingData.asset
文件差异内容过多而无法显示
查看文件

2
Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/007_LitShaderMaps/LightingData.asset.meta


fileFormatVersion: 2
guid: 6666d64eb9e654d1687ae92db85626c2
timeCreated: 1509370226
licenseType: Pro
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 25800000

/ScriptableRenderPipeline/LightweightPipeline/Resources → /ScriptableRenderPipeline/LightweightPipeline/Data

/ScriptableRenderPipeline/LightweightPipeline/Resources.meta → /ScriptableRenderPipeline/LightweightPipeline/Data.meta

正在加载...
取消
保存