Search Unity

Is RenderToCubemap dependant on the chosen render pipeline?

Discussion in 'High Definition Render Pipeline' started by carcasanchez, Feb 4, 2020.

  1. carcasanchez

    carcasanchez

    Joined:
    Jul 15, 2018
    Posts:
    177
    Hello there,
    I am working with a code that generates a simple cubemap, using the camera.RenderToCubemap function, but after switching to HDRP, I have found that the resultant cubemap differs from the cubemap generated with the standard pipeline.
    I generate a material with an unlit shader, and after that I proceed to render the cubemap.
    This is the cubemap as rendered in the standard pipeline:
    upload_2020-2-4_10-15-9.png
    And this is the cubemap generated with HDRP: upload_2020-2-4_10-15-35.png

    This is the shader I use:
    Code (CSharp):
    1. Shader "Impostors/ViewShader"
    2. {
    3.     Properties
    4.     {
    5.        
    6.     }
    7.     SubShader
    8.     {
    9.         Tags { "RenderType"="Opaque" }
    10.         LOD 100
    11.  
    12.         Pass
    13.         {
    14.             Cull off
    15.  
    16.             CGPROGRAM
    17.             #pragma vertex vert
    18.             #pragma fragment frag
    19.             // make fog work
    20.             //#pragma multi_compile_fog
    21.            
    22.             #include "UnityCG.cginc"
    23.  
    24.             struct appdata
    25.             {
    26.                 float4 vertex : POSITION;
    27.                 float4 color : COLOR;
    28.             };
    29.  
    30.             struct v2f
    31.             {
    32.                 float4 vertex : SV_POSITION;
    33.                 float4 color : COLOR;
    34.             };
    35.                        
    36.             v2f vert (appdata v)
    37.             {
    38.                 v2f o;
    39.                 o.color = v.color;
    40.                 o.vertex = UnityObjectToClipPos(v.vertex);
    41.                 return o;
    42.             }
    43.            
    44.             fixed4 frag (v2f i) : SV_Target
    45.             {
    46.                 // sample the texture
    47.                 fixed4 col = i.color;
    48.                 // apply fog
    49.                 return col;
    50.             }
    51.             ENDCG
    52.         }
    53.     }
    54. }
    55.  
    I tried to switch the render material to HDRP/Unlit, to see if a shader specifically created for HDRP will solve the issue, but the result is worse: upload_2020-2-4_10-17-48.png

    I suspect that the shader not being adapted to HDRP is the cause, but I don't know how to solve this.
    Any help will be welcome.