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
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;
}
}
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Frame Debugger is not disabled when switching Scenes if the Frame Debugger window is not open during the transition
- Standalone Profiler Targets another Project if a Standalone Profiler was launched in it before when switching between Edit or Play Mode Targets
- Crash on ForwardRenderLoopJob when opening a specific project
- [Android] Memory leak and eventual crash on Snapdragon 8 Gen 1+ devices when a Clear Pass is executed after Framebuffer Fetch
- PhysicsRaycaster ray length is incorrect when casting from rotated Camera
Resolution Note (fix version 2022.1):
Originally logged has a recorder bug. Tested with 3.0.2 version of the recorder package and fixed.