浏览代码

Revert "HDRenderLoop: Enable linearLighting and CCT + rename rebuild to build"

This reverts commit 4842000efd1c88991ba9d57e371f66de10f37d67.
/main
Sebastien Lagarde 8 年前
当前提交
92e53eeb
共有 5 个文件被更改,包括 20 次插入30 次删除
  1. 36
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  2. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightLoop.cs
  3. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs
  4. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs
  5. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyRenderer.cs

36
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


RenderTargetIdentifier m_DistortionBufferRT;
// Detect when windows size is changing
int m_currentWidth;
int m_currentHeight;
// Keep these settings safe to recover when leaving the render pipeline
bool previousLightsUseLinearIntensity;
bool previousLightsUseCCT;
int m_WidthOnRecord;
int m_HeightOnRecord;
// This must be allocate outside of Build() else the option in the class can't be set in the inspector (as it will in this case recreate the class with default value)
// This must be allocate outside of Rebuild() else the option in the class can't be set in the inspector (as it will in this case recreate the class with default value)
BaseLightLoop m_lightLoop = new TilePass.LightLoop();
public BaseLightLoop lightLoop

// TODO: Find a way to automatically create/iterate through deferred material
// TODO TO CHECK: SebL I move allocation from Build() to here, but there was a comment "// Our object can be garbage collected, so need to be allocate here", it is still true ?
// TODO TO CHECK: SebL I move allocation from Rebuild() to here, but there was a comment "// Our object can be garbage collected, so need to be allocate here", it is still true ?
Lit.RenderLoop m_LitRenderLoop = new Lit.RenderLoop();
public override void Build()

reflectionProbe = UnityEditor.SupportedRenderingFeatures.ReflectionProbe.Rotation
};
#endif
previousLightsUseLinearIntensity = UnityEngine.Rendering.GraphicsSettings.lightsUseLinearIntensity;
previousLightsUseCCT = UnityEngine.Rendering.GraphicsSettings.lightsUseCCT;
UnityEngine.Rendering.GraphicsSettings.lightsUseLinearIntensity = true;
UnityEngine.Rendering.GraphicsSettings.lightsUseCCT = true;
m_CameraColorBuffer = Shader.PropertyToID("_CameraColorTexture");
m_CameraDepthBuffer = Shader.PropertyToID("_CameraDepthTexture");

m_SkyRenderer = new SkyRenderer();
m_SkyRenderer.Build();
m_SkyRenderer.Rebuild();
m_FinalPassMaterial = Utilities.CreateEngineMaterial("Hidden/HDRenderLoop/FinalPass");
m_DebugViewMaterialGBuffer = Utilities.CreateEngineMaterial("Hidden/HDRenderLoop/DebugViewMaterialGBuffer");

m_DistortionBuffer = Shader.PropertyToID("_DistortionTexture");
m_DistortionBufferRT = new RenderTargetIdentifier(m_DistortionBuffer);
m_LitRenderLoop.Build();
m_lightLoop.Build(m_TextureSettings);
m_LitRenderLoop.Rebuild();
m_lightLoop.Rebuild(m_TextureSettings);
m_lightLoop.Cleanup();
m_lightLoop.Cleanup();
Utilities.Destroy(m_FinalPassMaterial);
Utilities.Destroy(m_DebugViewMaterialGBuffer);

#if UNITY_EDITOR
UnityEditor.SupportedRenderingFeatures.active = UnityEditor.SupportedRenderingFeatures.Default;
#endif
UnityEngine.Rendering.GraphicsSettings.lightsUseLinearIntensity = previousLightsUseLinearIntensity;
UnityEngine.Rendering.GraphicsSettings.lightsUseCCT = previousLightsUseCCT;
}
void InitAndClearBuffer(Camera camera, RenderLoop renderLoop)

// For now consider we have only one camera that go to this code, the main one.
m_SkyRenderer.Resize(m_SkyParameters); // TODO: Also a bad naming, here we just want to realloc texture if skyparameters change (usefull for lookdev)
if (camera.pixelWidth != m_currentWidth || camera.pixelHeight != m_currentHeight || m_lightLoop.NeedResize())
if (camera.pixelWidth != m_WidthOnRecord || camera.pixelHeight != m_HeightOnRecord || m_lightLoop.NeedResize())
if (m_currentWidth > 0 && m_currentHeight > 0)
if (m_WidthOnRecord > 0 && m_HeightOnRecord > 0)
{
m_lightLoop.ReleaseResolutionDependentBuffers();
}

// update recorded window resolution
m_currentWidth = camera.pixelWidth;
m_currentHeight = camera.pixelHeight;
m_WidthOnRecord = camera.pixelWidth;
m_HeightOnRecord = camera.pixelHeight;
}
}

4
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/LightLoop.cs


public class BaseLightLoop
{
// TODO: We should rather put the texture settings in LightLoop, but how do we serialize it ?
public virtual void Build(TextureSettings textureSettings) {}
public virtual void Rebuild(TextureSettings textureSettings) {}
public virtual void Cleanup() {}

public virtual void PrepareLightsForGPU(CullResults cullResults, Camera camera, ref ShadowOutput shadowOutput) { }
// TODO: this should not be part of the interface but for now make something working
// TODO: this should not be aprt of the interface but for now make something working
public virtual void BuildGPULightLists(Camera camera, RenderLoop loop, RenderTargetIdentifier cameraDepthBufferRT) { }
public virtual void PushGlobalParams(Camera camera, RenderLoop loop) {}

4
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/TilePass/TilePass.cs


public int debugViewTilesFlags = 0;
public bool enableClustered = false;
public bool disableFptlWhenClustered = true; // still useful on opaques. Should be false by default to force tile on opaque.
public bool enableBigTilePrepass = false;
public bool enableBigTilePrepass = true;
const bool k_UseDepthBuffer = true; // only has an impact when EnableClustered is true (requires a depth-prepass)
const bool k_UseAsyncCompute = true; // should not use on mobile

return (camera.pixelHeight + (k_TileSize - 1)) / k_TileSize;
}
public override void Build(TextureSettings textureSettings)
public override void Rebuild(TextureSettings textureSettings)
{
m_lightList = new LightList();
m_lightList.Allocate();

4
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs


return CreateLUT(k_LtcLUTResolution, k_LtcLUTResolution, format, pixels);
}
public void Build()
public void Rebuild()
{
m_InitPreFGD = CreateEngineMaterial("Hidden/HDRenderLoop/PreIntegratedFGD");
m_PreIntegratedFGD = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGBHalf);

{
Utilities.Destroy(m_InitPreFGD);
// TODO: how to delete RenderTexture ? or do we need to do it ?
// TODO: how to delete RenderTexture ?
isInit = false;
}

2
Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyRenderer.cs


RebuildTextures(skyParameters);
}
public void Build()
public void Rebuild()
{
// TODO: We need to have an API to send our sky information to Enlighten. For now use a workaround through skybox/cubemap material...
m_StandardSkyboxMaterial = Utilities.CreateEngineMaterial("Skybox/Cubemap");

正在加载...
取消
保存