浏览代码

Sorting of opaque objects now respects camera settings (opaqueSortMode) and disables front-to-back sorting when a GPU has HSR and camera is set to OpaqueSortMode.Default.

/main
Aleksandr Kirillov 6 年前
当前提交
9d6ebfa8
共有 6 个文件被更改,包括 26 次插入7 次删除
  1. 5
      com.unity.render-pipelines.lightweight/CHANGELOG.md
  2. 9
      com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs
  3. 3
      com.unity.render-pipelines.lightweight/LWRP/LightweightPipelineCore.cs
  4. 3
      com.unity.render-pipelines.lightweight/LWRP/Passes/DepthOnlyPass.cs
  5. 3
      com.unity.render-pipelines.lightweight/LWRP/Passes/RenderOpaqueForwardPass.cs
  6. 10
      com.unity.render-pipelines.lightweight/package.json

5
com.unity.render-pipelines.lightweight/CHANGELOG.md


The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [3.5.0-preview]
### Added
- Sorting of opaque objects now respects camera opaqueSortMode setting.
- Sorting of opaque objects disables front-to-back sorting flag when camera settings allow that and the GPU has hidden surface removal.
## [3.4.0-preview]
### Added
- When you have enabled Gizmos, they now appear correctly in the Game view.

9
com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs


#endif
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEditor.Experimental.Rendering;
using UnityEngine;
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{

}
cameraData.requiresDepthTexture |= cameraData.postProcessEnabled;
var commonOpaqueFlags = SortFlags.CommonOpaque;
var noFrontToBackOpaqueFlags = SortFlags.SortingLayer | SortFlags.RenderQueue | SortFlags.OptimizeStateChanges | SortFlags.CanvasOrder;
bool hasHSRGPU = SystemInfo.hasHiddenSurfaceRemovalOnGPU;
bool canSkipFrontToBackSorting = (camera.opaqueSortMode == OpaqueSortMode.Default && hasHSRGPU) || camera.opaqueSortMode == OpaqueSortMode.NoDistanceSort;
cameraData.defaultOpaqueSortFlags = canSkipFrontToBackSorting ? noFrontToBackOpaqueFlags : commonOpaqueFlags;
}

3
com.unity.render-pipelines.lightweight/LWRP/LightweightPipelineCore.cs


using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.XR;
using UnityEngine.Experimental.Rendering;
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{

public bool requiresSoftParticles;
public bool requiresOpaqueTexture;
public Downsampling opaqueTextureDownsampling;
public SortFlags defaultOpaqueSortFlags;
public bool isStereoEnabled;

3
com.unity.render-pipelines.lightweight/LWRP/Passes/DepthOnlyPass.cs


context.ExecuteCommandBuffer(cmd);
cmd.Clear();
var drawSettings = CreateDrawRendererSettings(renderingData.cameraData.camera, SortFlags.CommonOpaque, RendererConfiguration.None, renderingData.supportsDynamicBatching);
var sortFlags = renderingData.cameraData.defaultOpaqueSortFlags;
var drawSettings = CreateDrawRendererSettings(renderingData.cameraData.camera, sortFlags, RendererConfiguration.None, renderingData.supportsDynamicBatching);
if (renderingData.cameraData.isStereoEnabled)
{
Camera camera = renderingData.cameraData.camera;

3
com.unity.render-pipelines.lightweight/LWRP/Passes/RenderOpaqueForwardPass.cs


cmd.Clear();
Camera camera = renderingData.cameraData.camera;
var drawSettings = CreateDrawRendererSettings(camera, SortFlags.CommonOpaque, rendererConfiguration, dynamicBatching);
var sortFlags = renderingData.cameraData.defaultOpaqueSortFlags;
var drawSettings = CreateDrawRendererSettings(camera, sortFlags, rendererConfiguration, dynamicBatching);
context.DrawRenderers(cullResults.visibleRenderers, ref drawSettings, opaqueFilterSettings);
// Render objects that did not match any shader pass with error shader

10
com.unity.render-pipelines.lightweight/package.json


{
"name": "com.unity.render-pipelines.lightweight",
"description": "Lightweight Render Pipeline for Unity.",
"version": "3.4.0-preview",
"unity": "2018.3",
"version": "3.5.0-preview",
"unity": "2019.1",
"com.unity.render-pipelines.core": "3.4.0-preview",
"com.unity.shadergraph": "3.4.0-preview"
"com.unity.render-pipelines.core": "3.5.0-preview",
"com.unity.shadergraph": "3.5.0-preview"
}
}
正在加载...
取消
保存