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
- Selector gets stuck in UI if scroll is used while dragging
- Created asset is placed in a new folder when creating a new folder and instantly creating an asset by clicking somewhere else
- Selecting and deleting transition in Animator does not add to Undo History when animation is previewed in Inspector
- GameObjects remain static when updating constraints of PhysicsJoint with "Enable Sleeping" selected in Havok Physics Configuration
- [iOS] Touch input is not clocked and UI is unresponsive when the application is paused mid-drag without lifting the finger
Resolution Note (fix version 2022.1):
Originally logged has a recorder bug. Tested with 3.0.2 version of the recorder package and fixed.