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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
Resolution Note (fix version 2022.1):
Originally logged has a recorder bug. Tested with 3.0.2 version of the recorder package and fixed.