improve handheld light in third person, and on hands in firstperson

This commit is contained in:
Xonk
2026-01-14 22:47:36 -05:00
parent 7439a9db4e
commit 6e7324e7f6
2 changed files with 7 additions and 2 deletions
+4 -2
View File
@@ -1255,9 +1255,11 @@ void main() {
#if HANDHELD_LIGHTSOURCE_MODE > 0
// float flashlightshadows = SSRT_FlashLight_Shadows(shiftedViewPos, isDHrange, normalize(shiftedPlayerPos), interleaved_gradientNoise_temporal());
vec3 handheldViewPos = viewPos;
if(hand) handheldViewPos.z += 0.7;
Indirect_lighting += doHandHeldLight(
viewPos, slopednormal
handheldViewPos, slopednormal
#if defined HANDHELD_LIGHTSOURCE_SPECULAR && defined DEFERRED_SPECULAR
,mainHandPos, mainHandCol, offHandPos, offHandCol
#endif
+3
View File
@@ -140,6 +140,9 @@ void calculateFinishedPointLight(
inout vec3 handPos, inout vec3 lighting
){
if(lightLevel > 1e-6){
viewPos.z -= max((mat3(gbufferModelView) * playerLookVector).z,0);
// offset viewPos to match hand position
handPos = mat3(gbufferModelViewInverse) * (viewPos + handOffset) + gbufferModelViewInverse[3].xyz;