Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Dirrogate's avatar
Dirrogate
Expert Protege
7 years ago

Quest: Does Unity support surface shader tessellation for Android / OpenGL ES

I'd asked this on the Unity3D reddit, but haven't got a clear answer wrt the Quest.
I'm not a coder at all (a filmmaker) using Unity and creating stereoscopic VR video, and now looking at depthmap driven - for pseudo 6dof- video on the Quest.

I've not been able to get a definite answer on if Unity supports surface tessellation shaders on android/Quest.

The reason I ask is, because I'd like to convert the below shader (taken from github) which works perfectly on the Quest, to a tessellation based shader so in theory (in my thinking) I can use a lower triangle count sphere and still get smoother displacement. 

Currently I'm using a 1million triangle sphere with video mapped on it (top half 2d, bottom half grayscale depth map) for doing simulated 6dof vr video.

Any help and insights, I'll be very grateful.

Kind Regards.

Shader "PointCloud/Displacer/Spherical_OU"{

Properties{
_MainTex ("Texture", 2D) = "black" {}
_Displacement ("Displacement", float) = 0.1
_Maximum("Maximum", float) = 99.0
_BaselineLength("Baseline Length", float) = 0.5
_SphericalAngle("Spherical Angle", float) = 10.0
_FocalLength("Focal Length", float) = 90.0
}

SubShader{
Tags { "RenderType"="Opaque" }
Cull Back
Lighting Off
LOD 300

CGPROGRAM
#pragma surface surf Lambert vertex:disp nolightmap
// #pragma target 3.0

#pragma target 4.6


sampler2D _MainTex;
float _Displacement;
float _BaselineLength;
float _SphericalAngle;
float _FocalLength;
float _Maximum;

struct Input{
float2 uv_MainTex;
};



inline float getDepthSpherical(float d) {
return asin(_BaselineLength * sin(_SphericalAngle)) / asin(d);
}

inline float getDepthFlat(float d) {
return (_FocalLength / -100.0) * _BaselineLength / d;
}

void disp (inout appdata_full v){
v.vertex.xyz = v.normal * clamp(getDepthSpherical(tex2Dlod(_MainTex, float4(v.texcoord.xy * float2(1, 0.5), 0, 0)).r), -_Maximum, 0) * _Displacement;
}

void surf(Input IN, inout SurfaceOutput o){
fixed4 mainTex = tex2D(_MainTex, IN.uv_MainTex * float2(1, 0.5) + float2(0, 0.5));
//o.Emission = mainTex.rgb;
o.Albedo = mainTex.rgb;
}

ENDCG
}

FallBack "Diffuse"

}

No RepliesBe the first to reply