diff options
| author | yum <yum.food.vr@gmail.com> | 2024-08-17 17:49:07 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-08-17 17:49:07 -0700 |
| commit | cc4347e460a445f60e6e5b03d055c65b5cdfdbd6 (patch) | |
| tree | f1852e67c3ca90b3533063a7a41e2e5701578e47 | |
| parent | 826709af225e7563cda555d4a8010890b4a9f492 (diff) | |
Scrap tessellation code for now
Not used. Need some codegen dogshit to properly support it cause
shaderlab wont let u toggle it natively.
Also causing compilation bugs in unity 2022.3.22f1 and I don't want to
debug them right now.
| -rw-r--r-- | tooner_lighting.cginc | 139 | ||||
| -rw-r--r-- | tooner_outline_pass.cginc | 105 |
2 files changed, 0 insertions, 244 deletions
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc index 6bce2cc..0166104 100644 --- a/tooner_lighting.cginc +++ b/tooner_lighting.cginc @@ -18,30 +18,6 @@ #include "trochoid_math.cginc" #include "oklab.cginc" -struct tess_data -{ - float4 pos : INTERNALTESSPOS; - float2 uv0 : TEXCOORD0; - float2 uv2 : TEXCOORD1; - #if defined(LIGHTMAP_ON) - float2 lmuv : TEXCOORD1; - #endif - float3 normal : TEXCOORD2; - float4 tangent : TEXCOORD3; - - #if defined(VERTEXLIGHT_ON) - float3 vertexLightColor : TEXCOORD4; - #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO -}; - -struct tess_factors { - float edge[3] : SV_TessFactor; - float inside : SV_InsideTessFactor; -}; - void getVertexLightColor(inout v2f i) { #if defined(VERTEXLIGHT_ON) @@ -200,121 +176,6 @@ v2f vert(appdata v) return o; } -void getVertexLightColorTess(inout tess_data i) -{ - #if defined(VERTEXLIGHT_ON) - float3 worldPos = mul(unity_ObjectToWorld, i.pos).xyz; - float3 view_dir = normalize(_WorldSpaceCameraPos - worldPos); - uint normals_mode = round(_Mesh_Normals_Mode); - bool flat = (normals_mode == 0); - float3 flat_normal = normalize( - (1.0 / _Flatten_Mesh_Normals_Str) * i.normal + - _Flatten_Mesh_Normals_Str * view_dir); - i.vertexLightColor = Shade4PointLights( - unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0, - unity_LightColor[0].rgb, - unity_LightColor[1].rgb, - unity_LightColor[2].rgb, - unity_LightColor[3].rgb, - unity_4LightAtten0, worldPos, flat ? flat_normal : i.normal - ); - #endif -} - -tess_data hull_vertex(appdata v) -{ - tess_data o; - - UNITY_INITIALIZE_OUTPUT(tess_data, o); - UNITY_SETUP_INSTANCE_ID(v); - UNITY_TRANSFER_INSTANCE_ID(v, o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - - o.pos = v.vertex; - //o.vertex = UnityObjectToClipPos(v.vertex); - //o.worldPos = mul(unity_ObjectToWorld, v.vertex); - //o.objPos = v.vertex; - - o.normal = UnityObjectToWorldNormal(v.normal); - o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); - o.uv0 = v.uv0.xy; - o.uv2 = v.uv2.xy; - #if defined(LIGHTMAP_ON) - o.lmuv = v.uv2 * unity_LightmapST.xy + unity_LightmapST.zw; - #endif - - getVertexLightColorTess(o); - - return o; -} - -tess_factors patch_constant(InputPatch<tess_data, 3> patch) -{ - tess_factors f; - -#if defined(_TESSELLATION) - float3 worldPos = mul(unity_ObjectToWorld, patch[0].pos); - float factor = _Tess_Factor; - if (_Tess_Dist_Cutoff > 0 && length(_WorldSpaceCameraPos - worldPos) > _Tess_Dist_Cutoff) { - factor = 1; - } -#else - float factor = 1; -#endif - - f.edge[0] = factor; - f.edge[1] = factor; - f.edge[2] = factor; - f.inside = factor; - return f; -} - -[UNITY_domain("tri")] -[UNITY_outputcontrolpoints(3)] -[UNITY_outputtopology("triangle_cw")] -[UNITY_partitioning("fractional_odd")] -[UNITY_patchconstantfunc("patch_constant")] -tess_data hull( - InputPatch<tess_data, 3> patch, - uint id : SV_OutputControlPointID) -{ - return patch[id]; -} - -[UNITY_domain("tri")] -v2f domain( - tess_factors factors, - OutputPatch<tess_data, 3> patch, - float3 baryc : SV_DomainLocation) -{ - v2f data; -#define DOMAIN_INTERP(fieldName) data.fieldName = \ - patch[0].fieldName * baryc.x + \ - patch[1].fieldName * baryc.y + \ - patch[2].fieldName * baryc.z; - DOMAIN_INTERP(uv0); - DOMAIN_INTERP(uv2); - #if defined(LIGHTMAP_ON) - DOMAIN_INTERP(lmuv); - #endif - DOMAIN_INTERP(normal); - DOMAIN_INTERP(tangent); - - #if defined(VERTEXLIGHT_ON) - DOMAIN_INTERP(vertexLightColor); - #endif - - float4 vertex = - patch[0].pos * baryc.x + - patch[1].pos * baryc.y + - patch[2].pos * baryc.z; - data.pos = UnityObjectToClipPos(vertex); - data.objPos = vertex; - data.worldPos = mul(unity_ObjectToWorld, vertex); - - return data; -} - // maxvertexcount == the number of vertices we create #if defined(_CLONES) [maxvertexcount(45)] diff --git a/tooner_outline_pass.cginc b/tooner_outline_pass.cginc index e8c4459..abf4da4 100644 --- a/tooner_outline_pass.cginc +++ b/tooner_outline_pass.cginc @@ -13,18 +13,6 @@ #include "tooner_scroll.cginc" #include "UnityCG.cginc" -struct tess_data -{ - float4 pos : INTERNALTESSPOS; - float2 uv0 : TEXCOORD0; - float3 normal : TEXCOORD2; -}; - -struct tess_factors { - float edge[3] : SV_TessFactor; - float inside: SV_InsideTessFactor; -}; - v2f vert(appdata v) { #if defined(_TROCHOID) @@ -83,99 +71,6 @@ v2f vert(appdata v) return o; } -tess_data hull_vertex(appdata v) -{ -#if defined(_OUTLINES) - float outline_mask = _Outline_Mask.SampleLevel(linear_repeat_s, v.uv0.xy, /*lod=*/3); - outline_mask = _Outline_Mask_Invert > 1E-6 ? 1 - outline_mask : outline_mask; - - float4 vertex = v.vertex; - vertex = mul(unity_ObjectToWorld, vertex); - const float3 normal = UnityObjectToWorldNormal(v.normal); - - // Perform scaling operation in world space so that object scale doesn't - // affect outline width. This is handy on avatars with a bunch of different - // gameobjects that have different scale. -#if defined(_EXPLODE) - if (_Explode_Phase <= 1E-6) { - vertex.xyz += normal * _Outline_Width * .1 * outline_mask; - } -#else - vertex.xyz += normal * _Outline_Width * .1 * outline_mask; -#endif - - // Transform back to object, then clip. - vertex = mul(unity_WorldToObject, vertex); - v.vertex.xyz = vertex.xyz; - - tess_data o; - o.pos = v.vertex; - o.normal = normal; - o.uv0 = v.uv0.xy; - - return o; -#endif // _OUTLINES -} - -tess_factors patch_constant(InputPatch<tess_data, 3> patch) -{ - tess_factors f; - -#if defined(_TESSELLATION) - float3 worldPos = mul(unity_ObjectToWorld, patch[0].pos); - float factor = _Tess_Factor; - if (_Tess_Dist_Cutoff > 0 && length(_WorldSpaceCameraPos - worldPos) > _Tess_Dist_Cutoff) { - factor = 1; - } -#else - float factor = 1; -#endif - - f.edge[0] = factor; - f.edge[1] = factor; - f.edge[2] = factor; - f.inside = factor; - return f; -} - -[UNITY_domain("tri")] -[UNITY_outputcontrolpoints(3)] -[UNITY_outputtopology("triangle_cw")] -[UNITY_partitioning("fractional_odd")] -[UNITY_patchconstantfunc("patch_constant")] -tess_data hull( - InputPatch<tess_data, 3> patch, - uint id : SV_OutputControlPointID) -{ - return patch[id]; -} - -[UNITY_domain("tri")] -v2f domain( - tess_factors factors, - OutputPatch<tess_data, 3> patch, - float3 baryc : SV_DomainLocation) -{ - v2f data; -#define DOMAIN_INTERP(fieldName) data.fieldName = \ - patch[0].fieldName * baryc.x + \ - patch[1].fieldName * baryc.y + \ - patch[2].fieldName * baryc.z; - DOMAIN_INTERP(uv0); - DOMAIN_INTERP(normal); - //DOMAIN_INTERP(tangent); - - float4 vertex = - patch[0].pos * baryc.x + - patch[1].pos * baryc.y + - patch[2].pos * baryc.z; - data.pos = UnityObjectToClipPos(vertex); - data.objPos = vertex; - data.worldPos = mul(unity_ObjectToWorld, vertex); - - return data; -} - // maxvertexcount == the number of vertices we create #if defined(_CLONES) [maxvertexcount(15)] |
