Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultwarp.glsl should use sin and cos, not just sin #226

Open
hemebond opened this issue Oct 10, 2023 · 1 comment
Open

defaultwarp.glsl should use sin and cos, not just sin #226

hemebond opened this issue Oct 10, 2023 · 1 comment
Labels
Quake Anything related to Quake I, addons, and mods for said game

Comments

@hemebond
Copy link

defaultwarp.glsl has the following code:

	vec2 ntc;
	ntc.s = tc.s + sin(tc.t+e_time)*0.125;
	ntc.t = tc.t + sin(tc.s+e_time)*0.125;

but should use cos for one of them to more closely match the original Quake water warp.

@Shpoike
Copy link
Contributor

Shpoike commented Oct 15, 2023

https://github.com/id-Software/Quake/blob/master/WinQuake/d_scan.c#L106-L107
both are using the same table. there is no 90-degree offset on either (eg to turn the sin to a cos).

r_turb_turb = sintable + ((int)(cl.timeSPEED)&(CYCLE-1));
see, sin.
sintable[i] = AMP + sin(i
3.14159*2/CYCLE)AMP;
(also AMP is 8
0x10000, and i ranges up to CYCLE=128(with extra slop for wrapping) so the table's validity is from 0 to 2PI radians aka the full 360 degree range in 128 levels)
which I suppose means it technically ranges from 0-16 instead of +/-8
so feel free to add ((8.0/64)=0.125) to match that small bias, but cos is wrong.

it should be noted that certain other engines (like QS) disregard the texture offsets completely - https://github.com/sezero/quakespasm/blob/master/Quake/gl_warp.c#L145-L146 disregards vecs[][3]
QS does not always do a good job of matching vanilla quake. water is one of these areas.

@Xylemon Xylemon added the Quake Anything related to Quake I, addons, and mods for said game label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Quake Anything related to Quake I, addons, and mods for said game
Projects
None yet
Development

No branches or pull requests

3 participants