Code Monkey home page Code Monkey logo

potential-cubemap-descriptor-bug's Introduction

Potential cube map bug

Present on both Unity versions 2020.1.0b6 & 2019.3.0f3. I did not test other versions.

EDIT: Confirmed. Dup of https://issuetracker.unity3d.com/issues/rendertexture-is-flipped-upside-down-when-using-rendertexturedescriptor

The Issue

Given this scene...

0

...with a camera at the center.

Rendering into a RenderTexture created like this:

_renderTexture = new RenderTexture(512, 512, 1,  GraphicsFormat.R32G32_SFloat);
_renderTexture.useMipMap = false;
_renderTexture.autoGenerateMips = false;
_renderTexture.useDynamicScale = false;
_renderTexture.dimension = TextureDimension.Cube;
_renderTexture.filterMode = FilterMode.Point;

Correctly results in this:

1

Note: the color change is due to the R32G32_SFloat format. That format is required for our project's usecase so I have left it as is

However when making (what appears to be) a RenderTexture with the same settings via a RenderTextureDescriptor...

var descriptor = new RenderTextureDescriptor();
descriptor.dimension = UnityEngine.Rendering.TextureDimension.Cube;
descriptor.width = 512;
descriptor.height = 512;
descriptor.volumeDepth = 1;
descriptor.depthBufferBits = 16; // set so it matches Approach2
descriptor.stencilFormat = GraphicsFormat.None; // set so it matches Approach2
descriptor.bindMS = false;
descriptor.msaaSamples = 1; // set as required
descriptor.graphicsFormat = GraphicsFormat.R32G32_SFloat;
descriptor.useMipMap = false;
descriptor.autoGenerateMips = false;
_renderTextureFromDescriptor = new RenderTexture(descriptor);
_renderTextureFromDescriptor.filterMode = FilterMode.Point;

...this is the result:

2

The top and bottom faces of the cubemap appear flipped to me. Here is an image I've scribbled on to show the face edge and point of interest

3

To Reproduce issue

The scene in this test case shows the issue.

  • Open this project in the Unity Editor
  • Click the Play button
  • Once running, navigate to the object named 'Test' in the inspector
  • You will see two exposed RenderTexture fields. Double clicking each one will show the cubemap that has been captured by this test-case
  • Render Texture shows the result when the RenderTexture was created without using a RenderTextureDescriptor
  • Render Texture From Descriptor shows the result when the RenderTexture was created using a RenderTextureDescriptor

The Monobehaviour for the 'Test' object can be found here Assets/Test.cs

potential-cubemap-descriptor-bug's People

Contributors

cbaggers avatar

Watchers

Jonny Ree avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.