diff options
| author | yum <yum.food.vr@gmail.com> | 2026-01-20 22:15:09 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-01-20 22:15:09 -0800 |
| commit | a54b415ab89302cf1f74f78360595ec0eff8fc7b (patch) | |
| tree | 678cd3c8076c0c8995d6e1033f401738a22c1bea /2ner.cginc | |
| parent | d24a5d839bad7ae0a9a6525f7c4d30fa0877e073 (diff) | |
Push eyeVec into fragment
Diffstat (limited to '2ner.cginc')
| -rw-r--r-- | 2ner.cginc | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -187,8 +187,6 @@ v2f vert(appdata v) { #endif
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
o.objPos = v.vertex;
- o.eyeVec.xyz = o.worldPos - _WorldSpaceCameraPos;
- o.eyeVec.w = 1;
// These are used to convert normals from tangent space to world space.
o.normal = v.normal;
@@ -294,6 +292,8 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace f2f f = (f2f) 0;
f.binormal = cross(i.tangent, i.normal);
+ f.eyeVec = i.worldPos - _WorldSpaceCameraPos;
+ f.viewDir = normalize(f.eyeVec);
#if defined(_RAYMARCHED_FOG)
{
@@ -343,7 +343,7 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace _Raymarched_Fog_Density_Exponent,
#endif
};
- FogResult fog_result = raymarched_fog(i, fog_params);
+ FogResult fog_result = raymarched_fog(i, f, fog_params);
depth = fog_result.depth;
return fog_result.color;
}
@@ -441,7 +441,7 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace float2 debug;
ssao = get_ssao(i, tangentToWorld, debug);
#endif
- YumPbr pbr = GetYumPbr(i, tangentToWorld);
+ YumPbr pbr = GetYumPbr(i, f, tangentToWorld);
pbr.albedo.rgb *= ssao;
#if defined(META_PASS)
@@ -526,7 +526,7 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace YumLighting l = GetYumLighting(i, f, pbr);
#if defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS)
- applyMatcapsAndRimLighting(i, pbr, l);
+ applyMatcapsAndRimLighting(i, f, pbr, l);
l.diffuse = max(0, l.diffuse);
l.specular = max(0, l.specular);
#endif
|
