summaryrefslogtreecommitdiffstats
path: root/pbr.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-01-21 19:58:34 -0800
committeryum <yum.food.vr@gmail.com>2025-01-21 19:58:34 -0800
commit4ec13bd7513f29e16ab22b7ffe7d06724c92a912 (patch)
treee82920d170455fbfade69f7487ae5f6f4d0c1dd0 /pbr.cginc
parente2911359e5acf79beb5c8359145669b96a931ab0 (diff)
Clearcoat can disable texture normals
Also: * terrain gimmick * makes some hardcoded shit into params * add alternative normal evaluation methods * stochastic method gives best results without getting into analytic normals * add FBM noise texture slot to improve perf * add initial raytrace to sphere * stabilizes appearance as camera moves * add backtracking * eliminates sharp lines without sacrificing perf * fog 00 can render on a plane now, in addition to cylinder * add epilepsy protection filter
Diffstat (limited to 'pbr.cginc')
-rw-r--r--pbr.cginc9
1 files changed, 5 insertions, 4 deletions
diff --git a/pbr.cginc b/pbr.cginc
index c839dcc..3d74dc6 100644
--- a/pbr.cginc
+++ b/pbr.cginc
@@ -423,6 +423,7 @@ float4 getLitColor(
}
cc_mask *= cc_mask2_tmp;
#endif
+ float3 cc_normal = _Clearcoat_Use_Texture_Normals ? normal : i.normal;
// Diffuse specular
const float cc_roughness = max(1E-4, _Clearcoat_Roughness);
{
@@ -431,12 +432,12 @@ float4 getLitColor(
// https://google.github.io/filament/Filament.html
metallic = 0;
smoothness = 1.0 - _Clearcoat_Roughness;
- indirect_light.specular = getIndirectSpecular(i, view_dir, normal, smoothness,
+ indirect_light.specular = getIndirectSpecular(i, view_dir, cc_normal, smoothness,
metallic, worldPos, uv);
- const float3 l = reflect(-view_dir, normal);
+ const float3 l = reflect(-view_dir, cc_normal);
const float3 h = normalize(l + view_dir);
- const float NoH = dot(normal, h);
+ const float NoH = dot(cc_normal, h);
const float LoH = dot(l, h);
float Fc;
@@ -453,7 +454,7 @@ float4 getLitColor(
{
const float3 l = direct_light.dir;
const float3 h = normalize(l + view_dir);
- const float NoH = dot(normal, h);
+ const float NoH = dot(cc_normal, h);
const float LoH = dot(direct_light.dir, h);
float Fc;