Nerites 6 年前
当前提交
8087b626
共有 3 个文件被更改,包括 25 次插入25 次删除
  1. 1
      com.unity.render-pipelines.lightweight/CHANGELOG.md
  2. 25
      com.unity.render-pipelines.lightweight/LWRP/LightweightPipeline.cs
  3. 24
      com.unity.render-pipelines.lightweight/LWRP/LightweightPipelineCore.cs

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


- Updated the UI for the Lighweight pipeline asset.
### Fixed
- Post-processing now works with VR on PC.
- PS4 compiler error
- Fixed VR multiview rendering by forcing MSAA to be off. There's a current issue in engine that breaks MSAA and Texture2DArray.
- Fixed UnityPerDraw CB layout

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


}
}
public static void RenderPostProcess(CommandBuffer cmd, PostProcessRenderContext context, ref CameraData cameraData, RenderTextureFormat colorFormat, RenderTargetIdentifier source, RenderTargetIdentifier dest, bool opaqueOnly)
{
context.Reset();
context.camera = cameraData.camera;
context.source = source;
context.sourceFormat = colorFormat;
context.destination = dest;
context.command = cmd;
context.flip = cameraData.camera.targetTexture == null;
if (opaqueOnly)
cameraData.postProcessLayer.RenderOpaqueOnly(context);
else
cameraData.postProcessLayer.Render(context);
}
void SetSupportedRenderingFeatures()
{
#if UNITY_EDITOR

cameraData.postProcessLayer = camera.GetComponent<PostProcessLayer>();
cameraData.postProcessEnabled = cameraData.postProcessLayer != null && cameraData.postProcessLayer.isActiveAndEnabled;
// PostProcess for VR is not working atm. Disable it for now.
cameraData.postProcessEnabled &= !cameraData.isStereoEnabled;
Rect cameraRect = camera.rect;
cameraData.isDefaultViewport = (!(Math.Abs(cameraRect.x) > 0.0f || Math.Abs(cameraRect.y) > 0.0f ||

float cameraWidth = (float)cameraData.camera.pixelWidth * cameraData.renderScale;
float cameraHeight = (float)cameraData.camera.pixelHeight * cameraData.renderScale;
Shader.SetGlobalVector(PerCameraBuffer._ScaledScreenParams, new Vector4(cameraWidth, cameraHeight, 1.0f + 1.0f / cameraWidth, 1.0f + 1.0f / cameraHeight));
}
bool IsStereoEnabled(Camera camera)
{
bool isSceneViewCamera = camera.cameraType == CameraType.SceneView;
return XRGraphicsConfig.enabled && !isSceneViewCamera && (camera.stereoTargetEye == StereoTargetEyeMask.Both);
}
}
}

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


using System.Collections.Generic;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.XR;
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{

public static bool IsSupportedCookieType(LightType lightType)
{
return lightType == LightType.Directional || lightType == LightType.Spot;
}
public static bool IsStereoEnabled(Camera camera)
{
bool isSceneViewCamera = camera.cameraType == CameraType.SceneView;
return XRGraphicsConfig.enabled && !isSceneViewCamera && (camera.stereoTargetEye == StereoTargetEyeMask.Both);
}
public static void RenderPostProcess(CommandBuffer cmd, PostProcessRenderContext context, ref CameraData cameraData, RenderTextureFormat colorFormat, RenderTargetIdentifier source, RenderTargetIdentifier dest, bool opaqueOnly)
{
Camera camera = cameraData.camera;
context.Reset();
context.camera = camera;
context.source = source;
context.sourceFormat = colorFormat;
context.destination = dest;
context.command = cmd;
context.flip = !IsStereoEnabled(camera) && camera.targetTexture == null;
if (opaqueOnly)
cameraData.postProcessLayer.RenderOpaqueOnly(context);
else
cameraData.postProcessLayer.Render(context);
}
}
}
正在加载...
取消
保存