Search Issue Tracker

Fixed in 2022.1.X

Votes

0

Found in

2018.4.16f1

Issue ID

1370847

Regression

No

Using RenderToCubemap using a camera with the PhysicalParameter produces an incorrect Cubemap

Camera

-

Using RenderToCubemap using a camera with the PhysicalParameter produces an incorrect Cubemap

This problem was initially reported on the Unity Recorder to record 360 videos see https://fogbugz.unity3d.com/f/cases/1205635/ which is now tracked on Jira at https://jira.unity3d.com/browse/REC-164

To reproduce the issue
Create a new 3D project in Unity
Create a RenderTexture of size 4096x2048
Create an Empty game object
Add the following script to the game object
Enter in play mode

You will see that the content of the RenderTarget is correctly rendered for a Camera without the Physical parameter set
and it will render incorrectly when you set the Physical parameters.

Using the following script you can render a cubemap to a RenderTexture, you need to associate the MainCamera and a Target RenderTexture that you create with size 4096x2048

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using Object = System.Object;

public class RenderCubeMapToRT : MonoBehaviour
{
public RenderTexture OutputRenderTexture;
public Camera targetCamera;
RenderTexture m_Cubemap1;
private int OutputWidth = 4096;
private int OutputHeight = 2048;
private int MapSize = 1024;

// Start is called before the first frame update
void Start()
{
var fmtRW = RenderTextureReadWrite.Default;
var fmt = RenderTextureFormat.ARGB32;

m_Cubemap1 = new RenderTexture(MapSize, MapSize, 24, fmt, fmtRW)
{
dimension = TextureDimension.Cube
};

}

// Update is called once per frame
void LateUpdate()
{
StartCoroutine(CaptureFrame());
}

IEnumerator CaptureFrame()
{
yield return new WaitForEndOfFrame();
if (OutputRenderTexture != null)
{
targetCamera.RenderToCubemap(m_Cubemap1, 63, Camera.MonoOrStereoscopicEye.Mono);
m_Cubemap1.ConvertToEquirect(OutputRenderTexture);
}
}

private void OnDestroy()
{
m_Cubemap1.Release();
m_Cubemap1 = null;
}
}

  1. Response avatar

    Resolution Note (fix version 2022.1):

    Originally logged has a recorder bug. Tested with 3.0.2 version of the recorder package and fixed.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.