Skip to content

Commit

Permalink
Change MDL light direction to world X + Z
Browse files Browse the repository at this point in the history
to match QS more closely.

Note: QS also quantizes yaw and ignores pitch, while IW doesn't (closer to WinQuake).
  • Loading branch information
andrei-drexler committed Oct 15, 2024
1 parent f82be55 commit 2b7dd17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Quake/gl_shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -1127,10 +1127,10 @@ ALIAS_INSTANCE_BUFFER
" vec3 lerpedVert = (worldmatrix * vec4(mix(pose1.pos, pose2.pos, inst.Blend), 1.0)).xyz;\n"
" gl_Position = ViewProj * vec4(lerpedVert, 1.0);\n"
" out_pos = lerpedVert - EyePos;\n"
" vec3 shadevector;\n"
" shadevector.x = normalize(worldmatrix[0].xyz).x;\n"
" shadevector.y = normalize(worldmatrix[1].xyz).x;\n"
" shadevector.z = normalize(worldmatrix[2].xyz).x;\n"
" // transform world X and Z axes to local space\n"
" mat3 orientation = mat3(normalize(worldmatrix[0].xyz), normalize(worldmatrix[1].xyz), normalize(worldmatrix[2].xyz));\n"
" orientation = transpose(orientation);\n"
" vec3 shadevector = (orientation[0] + orientation[2]) / sqrt(2.0);\n"
" float dot1 = r_avertexnormal_dot(pose1.nor, shadevector);\n"
" float dot2 = r_avertexnormal_dot(pose2.nor, shadevector);\n"
" out_color = clamp(inst.LightColor * vec4(vec3(mix(dot1, dot2, inst.Blend)), 1.0), 0.0, 1.0);\n"
Expand Down

0 comments on commit 2b7dd17

Please sign in to comment.