08-17-2023 03:37 PM
Has anyone gotten that combination of things to work? Overlay works just fine with URP, so I'm assuming it's my attempts to punch out a hole that are failing. I'm assuming Oculus' shader doesn't work with URP, as it renders pink in the preview -- but hey, maybe I'm wrong.
I've tried updating it to URP, and I've tried using a URP/Transparent shader, as I believe it's basically the same thing.
I've tried using Render Object on the Universal Render Asset to ensure that we render at the proper time to punch a hole. I set my Quad object to be on the Layer for the Render Object's LayerMask, and set the event to be After Rendering Opaques, and to override Depth, Write Depth, and Depth Test Greater. That should result in it render my quad over anything that might be in the way... right? I also tried Depth Test Always -- which should really always render my transparent thing and write it's depth.
But nothing every shows up on my Quest 2 when I'm set to Underlay. (if I turn off rendering everything else in the scene, it works and I see it.)
Solved! Go to Solution.
08-18-2023 03:38 PM
Okay, got it working, was a foreheadslapper where I'd forgotten I'd turned off a certain Layer on my camera -- the exact layer I was rendering my punchout quad on... eyeroll.
My final URP punchout shader is fairly simple, I can share if anyone is curious.
08-18-2023 03:38 PM
Okay, got it working, was a foreheadslapper where I'd forgotten I'd turned off a certain Layer on my camera -- the exact layer I was rendering my punchout quad on... eyeroll.
My final URP punchout shader is fairly simple, I can share if anyone is curious.
08-25-2023 12:31 PM
Hello, Can you share your punchout shader?
I was trying to use Oculus SDk's Underlay Impostor shader but it doesn't work with URP.
Thank you.
08-25-2023 01:13 PM
Properties {
_MainTex ("Albedo", 2D) = "white" {}
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"RenderPipeline" = "UniversalPipeline"
}
Blend DstColor Zero
Lighting Off
ZWrite On
ZTest LEqual
Pass {
Name "Forward"
Tags { "LightMode" = "UniversalForward" }
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
sampler2D _MainTex;
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
CBUFFER_END
struct vertexIn
{
float4 vertex : POSITION;
float2 texCoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct vertexOut
{
float4 vertex : SV_POSITION;
float2 texCoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
vertexOut vert(vertexIn v)
{
vertexOut output;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
VertexPositionInputs vertexInputs = GetVertexPositionInputs(v.vertex.xyz);
output.vertex = vertexInputs.positionCS;
output.texCoord = TRANSFORM_TEX(v.texCoord, _MainTex);
return output;
}
half4 frag(vertexOut input) : SV_Target
{
half4 outColor = tex2D(_MainTex, input.texCoord);
clip( outColor.a < 0.1f ? -1:1 );
return half4(outColor.xyz, 0);
}
ENDHLSL
}
}
08-25-2023 01:14 PM
It's a pretty simple shader, I adapted it from one on Unity's documentation. If you don't need transparency in your output image, you can lose the clip.
08-25-2023 03:02 PM
Thank you very much!
08-30-2023 10:19 AM
Good 👍👍👍 pls on the table there welcome