diff options
| author | yum <yum.food.vr@gmail.com> | 2026-03-31 14:51:18 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-03-31 14:51:28 -0700 |
| commit | e595ed41ef130d9883a9f9a4b9566c285f0abde3 (patch) | |
| tree | 66422cffc796e937ec322aa328151cb5f788df84 | |
| parent | 38c22e393570433bf343c74cf69a1b5542de6c57 (diff) | |
Put maintex burley tiling into optional branch; add optional rotation feature
| -rwxr-xr-x | 3ner.shader | 17 | ||||
| -rw-r--r-- | burley.cginc | 10 | ||||
| -rwxr-xr-x | features.cginc | 2 | ||||
| -rwxr-xr-x | globals.cginc | 4 | ||||
| -rwxr-xr-x | pbr.cginc | 3 |
5 files changed, 31 insertions, 5 deletions
diff --git a/3ner.shader b/3ner.shader index 4ec5b47..b60eb7d 100755 --- a/3ner.shader +++ b/3ner.shader @@ -693,8 +693,21 @@ Shader "yum_food/3ner" _Burley_Tiling_Input_Scale("Input scale", Range(0, 1)) = 0.5 _Burley_Tiling_Output_Scale("Output scale", Range(0, 1)) = 0.5 _Burley_Tiling_Blend_Gamma("Blend gamma", Range(0.1, 8)) = 2.0 - _Burley_Tiling_Maintex("Base color", 2D) = "white" {} - _Burley_Tiling_Maintex_LUT("Base color LUT", 2D) = "white" {} + + //ifex _Burley_Tiling_Rotation_Constraint_Enabled==0 + [HideInInspector] m_start_Burley_Tiling_Rotation_Constraint("Rotation Constraint", Float) = 0 + [ThryToggle(_BURLEY_TILING_ROTATION_CONSTRAINT)] _Burley_Tiling_Rotation_Constraint_Enabled("Enable", Float) = 0 + _Burley_Tiling_Rotation_Constraint("Rotation freedom", Range(0, 1)) = 1 + [HideInInspector] m_end_Burley_Tiling_Rotation_Constraint("Rotation Constraint", Float) = 0 + //endex + + //ifex _Burley_Tiling_Maintex_Enabled==0 + [HideInInspector] m_start_Burley_Tiling_Maintex("Base color", Float) = 0 + [ThryToggle(_BURLEY_TILING_MAINTEX)] _Burley_Tiling_Maintex_Enabled("Enable", Float) = 0 + _Burley_Tiling_Maintex("Base color", 2D) = "white" {} + [Gradient] _Burley_Tiling_Maintex_LUT("Base color LUT", 2D) = "white" {} + [HideInInspector] m_end_Burley_Tiling_Maintex("Base color", Float) = 0 + //endex //ifex _Burley_Tiling_Ambient_Occlusion_Enabled==0 [HideInInspector] m_start_Burley_Tiling_Ambient_Occlusion("Ambient Occlusion", Float) = 0 diff --git a/burley.cginc b/burley.cginc index ac225d7..1ca870f 100644 --- a/burley.cginc +++ b/burley.cginc @@ -80,8 +80,14 @@ BurleyPatchTransform burley_make_patch_transform(float2 uv, float2 uv_dx, float2 float2 sample_dx = uv_dx * (0.5f * input_scale); float2 sample_dy = uv_dy * (0.5f * input_scale); // Rotate. - float theta = hash31_ff(tile_rand3) * TAU; - float2x2 rot = float2x2(cos(theta), -sin(theta), sin(theta), cos(theta)); + float theta = hash31_ff(tile_rand3) * TAU - PI; +#if defined(_BURLEY_TILING_ROTATION_CONSTRAINT) + theta *= _Burley_Tiling_Rotation_Constraint; +#endif // _BURLEY_TILING_ROTATION_CONSTRAINT + float s; + float c; + sincos(theta, s, c); + float2x2 rot = float2x2(c, -s, s, c); local_uv = mul(rot, local_uv); sample_dx = mul(rot, sample_dx); sample_dy = mul(rot, sample_dy); diff --git a/features.cginc b/features.cginc index 1d3d1d1..57c2191 100755 --- a/features.cginc +++ b/features.cginc @@ -242,11 +242,13 @@ //ifex _Burley_Tiling_Enabled==0 #pragma shader_feature_local _BURLEY_TILING +#pragma shader_feature_local _BURLEY_TILING_MAINTEX #pragma shader_feature_local _BURLEY_TILING_AMBIENT_OCCLUSION #pragma shader_feature_local _BURLEY_TILING_HEIGHTMAP #pragma shader_feature_local _BURLEY_TILING_SMOOTHNESS #pragma shader_feature_local _BURLEY_TILING_SMOOTHNESS_INVERT #pragma shader_feature_local _BURLEY_TILING_NORMAL +#pragma shader_feature_local _BURLEY_TILING_ROTATION_CONSTRAINT //endex #endif // __FEATURES_INC diff --git a/globals.cginc b/globals.cginc index cd676d1..ded978b 100755 --- a/globals.cginc +++ b/globals.cginc @@ -630,6 +630,10 @@ texture2D _Burley_Tiling_Maintex; texture2D _Burley_Tiling_Maintex_LUT; #endif // _BURLEY_TILING +#if defined(_BURLEY_TILING_ROTATION_CONSTRAINT) +float _Burley_Tiling_Rotation_Constraint; +#endif // _BURLEY_TILING_ROTATION_CONSTRAINT + #if defined(_BURLEY_TILING_AMBIENT_OCCLUSION) texture2D _Burley_Tiling_Ambient_Occlusion_Map; texture2D _Burley_Tiling_Ambient_Occlusion_Map_LUT; @@ -190,11 +190,13 @@ void apply_burley_tiling(inout Pbr pbr, inout float3 normal_tangent) { #if defined(_BURLEY_TILING) float3 weights = _burley_ctx.weights; +#if defined(_BURLEY_TILING_MAINTEX) float4 patch_0 = burley_sample_patch(_Burley_Tiling_Maintex, _burley_ctx.patch_0); float4 patch_1 = burley_sample_patch(_Burley_Tiling_Maintex, _burley_ctx.patch_1); float4 patch_2 = burley_sample_patch(_Burley_Tiling_Maintex, _burley_ctx.patch_2); float4 gaussian_blend = patch_0 * weights.x + patch_1 * weights.y + patch_2 * weights.z; pbr.albedo.xyz = burley_degaussianize(_Burley_Tiling_Maintex_LUT, burley_apply_soft_clipping(gaussian_blend.rgb, weights)); +#endif // _BURLEY_TILING_MAINTEX #if defined(_BURLEY_TILING_SMOOTHNESS) float4 patch_0_smoothness = burley_sample_patch(_Burley_Tiling_Smoothness_Map, _burley_ctx.patch_0); @@ -218,7 +220,6 @@ void apply_burley_tiling(inout Pbr pbr, inout float3 normal_tangent) { normal_tangent.xy *= _Burley_Tiling_Normal_Strength; normal_tangent = normalize(normal_tangent); #endif // _BURLEY_TILING_NORMAL - #endif // _BURLEY_TILING } |
