Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix shadow rendering correctly to work with shader stripping in WebGl. [case 1381881](https://issuetracker.unity3d.com/issues/webgl-urp-mesh-is-not-rendered-in-the-scene-on-webgl-build)
- VFX: Incorrect Decal rendering when rendescale is different than one [case 1343674](https://issuetracker.unity3d.com/product/unity/issues/guid/1343674/)
- Fixed inspector documentation URLs for the URP asset and Universal Renderer asset.
- Fixed render scale setting unintentionally affecting the scene view camera.
- Fixed property wrappers around material properties.

## [13.1.2] - 2021-11-05
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,14 @@ void SetPerCameraShaderVariables(CommandBuffer cmd, ref CameraData cameraData)

Camera camera = cameraData.camera;

Rect pixelRect = cameraData.pixelRect;
float renderScale = cameraData.isSceneViewCamera ? 1f : cameraData.renderScale;
float scaledCameraWidth = (float)pixelRect.width * renderScale;
float scaledCameraHeight = (float)pixelRect.height * renderScale;
float cameraWidth = (float)pixelRect.width;
float cameraHeight = (float)pixelRect.height;
float scaledCameraWidth = (float)cameraData.cameraTargetDescriptor.width;
float scaledCameraHeight = (float)cameraData.cameraTargetDescriptor.height;
float cameraWidth = (float)camera.pixelWidth;
float cameraHeight = (float)camera.pixelHeight;

// Use eye texture's width and height as screen params when XR is enabled
if (cameraData.xr.enabled)
{
scaledCameraWidth = (float)cameraData.cameraTargetDescriptor.width;
scaledCameraHeight = (float)cameraData.cameraTargetDescriptor.height;
cameraWidth = (float)cameraData.cameraTargetDescriptor.width;
cameraHeight = (float)cameraData.cameraTargetDescriptor.height;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,12 @@ static void InitializeCameraData(Camera camera, UniversalAdditionalCameraData ad
#endif

bool needsAlphaChannel = Graphics.preserveFramebufferAlpha;
cameraData.cameraTargetDescriptor = CreateRenderTextureDescriptor(camera, cameraData.renderScale,

// Render scale is not intended to affect the scene view so override the scale to 1.0 when it's rendered.
bool isSceneViewCamera = (camera.cameraType == CameraType.SceneView);
float renderScale = isSceneViewCamera ? 1.0f : cameraData.renderScale;

cameraData.cameraTargetDescriptor = CreateRenderTextureDescriptor(camera, renderScale,
cameraData.isHdrEnabled, msaaSamples, needsAlphaChannel, cameraData.requiresOpaqueTexture);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,13 +543,16 @@ static GraphicsFormat MakeRenderTextureGraphicsFormat(bool isHdrEnabled, bool ne
static RenderTextureDescriptor CreateRenderTextureDescriptor(Camera camera, float renderScale,
bool isHdrEnabled, int msaaSamples, bool needsAlpha, bool requiresOpaqueTexture)
{
int scaledWidth = (int)((float)camera.pixelWidth * renderScale);
int scaledHeight = (int)((float)camera.pixelHeight * renderScale);

RenderTextureDescriptor desc;

if (camera.targetTexture == null)
{
desc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight);
desc.width = (int)((float)desc.width * renderScale);
desc.height = (int)((float)desc.height * renderScale);
desc.width = scaledWidth;
desc.height = scaledHeight;
desc.graphicsFormat = MakeRenderTextureGraphicsFormat(isHdrEnabled, needsAlpha);
desc.depthBufferBits = 32;
desc.msaaSamples = msaaSamples;
Expand All @@ -558,8 +561,9 @@ static RenderTextureDescriptor CreateRenderTextureDescriptor(Camera camera, floa
else
{
desc = camera.targetTexture.descriptor;
desc.width = (int)((float)camera.pixelWidth * renderScale);
desc.height = (int)((float)camera.pixelHeight * renderScale);
desc.width = scaledWidth;
desc.height = scaledHeight;

if (camera.cameraType == CameraType.SceneView && !isHdrEnabled)
{
desc.graphicsFormat = SystemInfo.GetGraphicsFormat(DefaultFormat.LDR);
Expand Down