diff options
| author | yum <yum.food.vr@gmail.com> | 2025-02-18 16:35:22 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-02-18 16:35:22 -0800 |
| commit | 547c6064f6a8ab2749f496ce7ea2856e8cc1bcda (patch) | |
| tree | 080e30ef69f9e4daa476e529c9f015bd2cf77fa8 /yum_pbr.cginc | |
| parent | 3087ea990dfea49c32a8a9d9f6ac9c1790817efc (diff) | |
Add matcaps and rim lighting
* Add min brightness
* MainTex and BumpMap can be independently tiled
* Fix outlines
* Remove lightDirTS (unused)
* Normalize i.normal in pixel shader
* Elide unused AO when locked
* Wrap lines at 80 columns
Diffstat (limited to 'yum_pbr.cginc')
| -rw-r--r-- | yum_pbr.cginc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/yum_pbr.cginc b/yum_pbr.cginc index 8b4d8e3..93c615d 100644 --- a/yum_pbr.cginc +++ b/yum_pbr.cginc @@ -1,8 +1,10 @@ #ifndef __YUM_PBR #define __YUM_PBR +#include "features.cginc" #include "filamented.cginc" #include "globals.cginc" +#include "texture_utils.cginc" struct YumPbr { float4 albedo; @@ -19,12 +21,16 @@ YumPbr GetYumPbr(v2f i) { #if defined(OUTLINE_PASS) result.albedo = _Outline_Color; - result.albedo.a *= tex2D(_MainTex, i.uv01).a; + result.albedo.a *= tex2D(_MainTex, + UV_SCOFF(i, _MainTex_ST, /*which_channel=*/0)).a; #else - result.albedo = tex2D(_MainTex, i.uv01) * _Color; + result.albedo = tex2D(_MainTex, + UV_SCOFF(i, _MainTex_ST, /*which_channel=*/0)) * _Color; #endif - float3 normal_raw = UnpackScaleNormal(tex2D(_BumpMap, i.uv01), _BumpScale); + float3 normal_raw = UnpackScaleNormal( + tex2D(_BumpMap, UV_SCOFF(i, _BumpMap_ST, /*which_channel=*/0)), + _BumpScale); float3x3 tangentToWorld = float3x3(i.tangent, i.binormal, i.normal); result.normal = normalize(mul(normal_raw, tangentToWorld)); @@ -35,7 +41,11 @@ YumPbr GetYumPbr(v2f i) { result.metallic = _Metallic; +#if defined(_AMBIENT_OCCLUSION) result.ao = lerp(1, tex2D(_OcclusionMap, i.uv01), _OcclusionStrength); +#else + result.ao = 1; +#endif return result; } |
