Search Unity

Question 'Custom' Texture for EnvironmentProbe not converting

Discussion in 'AR' started by FrankvHoof, Feb 3, 2021.

  1. FrankvHoof

    FrankvHoof

    Joined:
    Nov 3, 2014
    Posts:
    258
    I'm trying to push a texture from a Unity ReflectionProbe into an XREnvironmentProbeSubsystem in order to get this texture to apply through ARFoundation.

    However, the default format for the texture from a ReflectionProbe (ARGBHalf) does not have a corresponding TextureFormat.
    When attempting to use a similar TextureFormat (RGBAHalf) I get 2 errors:
    - d3d11: failed to create 2D texture shader resource view id=2619 [D3D error was 80070057]
    - Unsupported D3D format 0x9

    Is there any way to use the Texture from a ReflectionProbe to fill the texture for an AREnvironmentProbe?
     
  2. FrankvHoof

    FrankvHoof

    Joined:
    Nov 3, 2014
    Posts:
    258
    Anyone?
     
  3. FrankvHoof

    FrankvHoof

    Joined:
    Nov 3, 2014
    Posts:
    258
    Is there someone from @Unity that can provide more info on the type and format of the Texture that the EnvironmentProbeSubsystem expects to receive?
    It appears to be very poorly documented..
     
  4. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Circulated this with the team: The XREnvironmentProbeSubsystem has no API to accept textures.
     
  5. FrankvHoof

    FrankvHoof

    Joined:
    Nov 3, 2014
    Posts:
    258
    @TreyK-47 My apologies, I should've worded my question better.

    I'm working on a custom XRPlugin, the XREnvironmentProbeSubsystem is my own. What I'm trying to do is take the RealtimeTexture (RenderTexture) from a Unity ReflectionProbe, and forward that into ARFoundation.

    The errors denoted previously are thrown from AREnvironmentProbe.UpdateEnvironmentTexture (called from AREnvironmentProbe.OnAfterSetSessionRelativeData):
    Code (CSharp):
    1. d3d11: failed to create Cube texture shader resource view id=2711 [D3D error was 80070057]
    2. Unsupported D3D format 0x9
    The AREnvironmentProbe does get a (corrupted) Texture set to it. If I try to open this Texture in the editor, the following 2 errors are thrown:
    Code (CSharp):
    1. Texture is not accessible - UnityEditor.CubemapInspector:OnEnable()
    2. Can't read from cubemap - UnityEditor.CubemapInspector.OnEnable()
    My questions are thus:
    What type of Texture is the AREnvironmentProbe expecting?
    Is there a(n easy) way to convert the (RealTime)Texture from a Unity ReflectionProbe to the type that an AREnvironmentProbe is expecting?
     
  6. todds_unity

    todds_unity

    Joined:
    Aug 1, 2018
    Posts:
    324
    > What type of Texture is the AREnvironmentProbe expecting?

    AR Foundation itself does not care about the texture type. AR Foundation will create reflection probe for each environment probe. This texture error is coming from the Core reflection probe rendering code, and the required texture format for the reflection probe texture varies based on platform.

    > Is there a(n easy) way to convert the (RealTime)Texture from a Unity ReflectionProbe to the type that an AREnvironmentProbe is expecting?

    As mentioned above, AR Foundation is simply wrapping the environment probe texture data into a Unity reflection probe.


    Todd