-
Notifications
You must be signed in to change notification settings - Fork 52
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
About setting widescreen fov parameter [question] #49
Comments
While waiting for someone capable of answering to you, maybe you may take a look to this: #37 (a different way to compute widescreen fov, which should not have a small problem that current implementation has got in case of cg_fov <>90). |
1.3f comes from wanting to check if the refdef has an aspect of 4:3 or wider (comes from 320 / 240, and to exclude widescreen processing a vert+ 5:4 mode like 1280x1024, which would be 1.25) As for the other, I think 73.739792 was from calculating against the cgame's assumed vertical FOV and that I couldn't get a divide working properly. A lot of it was trial and error on adapting older engoo code (which is either adapted from mh or quakespasm code) and attempting to apply that renderer-side for compatibility so it shouldn't affect gameplay. Also all the refdefs (viewports, etc) in the game go through that function and I had tried to make sure the widescreen fov only applies to the player view. A lot of my code is this messy as I've rarely had a second opinion whenever I commit stuff, especially back in 2014. Also, i'm not the best at math, and i'd like to learn how to do this better. This issue is better than that one pull request wrongfully implying i didn't have hor+ in the first place. This issue marks the first time i've had proper insightful feedback and critique on my now-4-years-old widescreen implementation code. |
Thanks for replies, it is very helpful. ryvnf's request is actually can be optimized as follow:
I hasty write a naive program to verify this. if set cg_fov = 90, both leilei and ryvnf's method will get the same results. width: 320, height: 240 width: 400, height: 300 width: 512, height: 384 width: 640, height: 480 width: 800, height: 600 width: 960, height: 720 width: 1024, height: 768 width: 1152, height: 864 width: 1280, height: 1024 width: 1600, height: 1200 width: 2048, height: 1536 width: 856, height: 480 width: 1280, height: 720 width: 1280, height: 768 width: 1280, height: 800 width: 1280, height: 960 width: 1360, height: 768 width: 1366, height: 768 width: 1360, height: 1024 width: 1400, height: 1050 width: 1400, height: 900 width: 1600, height: 900 width: 1680, height: 1050 width: 1920, height: 1080 width: 1920, height: 1200 width: 1920, height: 1440 width: 2560, height: 1600 width: 3840, height: 2160 But set cg_fov = 140 width: 320, height: 240 width: 400, height: 300 width: 512, height: 384 width: 640, height: 480 width: 800, height: 600 width: 960, height: 720 width: 1024, height: 768 width: 1152, height: 864 width: 1280, height: 1024 width: 1600, height: 1200 width: 2048, height: 1536 width: 856, height: 480 width: 1280, height: 720 width: 1280, height: 768 width: 1280, height: 800 width: 1280, height: 960 width: 1360, height: 768 width: 1366, height: 768 width: 1360, height: 1024 width: 1400, height: 1050 width: 1400, height: 900 width: 1600, height: 900 width: 1680, height: 1050 width: 1920, height: 1080 width: 1920, height: 1200 width: 1920, height: 1440 width: 2560, height: 1600 width: 3840, height: 2160 |
Excuse me, what do you mean with this sentence?
I suppose you meant "field of view" instead of "field of version", okay... But I still don't get what you mean... Maybe do you mean that you would prefer to be able to set a cg_fov corresponding to the horizontal fov you actually want to obtain on your screen, instead of the one you would have at 4:3 ratio? |
@The-Gig , thanks for feedback and sorry for my poor English written skills. I revise my comment, wish you could understand it. I am now doubt the necessary of the leilei's widescreen support code and ryvnf's widescreen support request. Because those patched code do not help the players get the best HFOV and VFOR parameter for As I puts it earlier, Both leilei and ryvnf's code are not useful with cg_fov = 90 setting by default, it does not help widescreen players get the best fov parameters for a specific display resolution. You have to turn cg_fov by youselves for best efficiency or for view effect. |
Your rewording of the previous post confirmed I understood correctly about that specific sentence, thanks. However, for me it's okay to just say "Cg_fov is the horizontal FOV with a 4:3 ratio. In case of widescreen, actual FOV will be larger". I'm sorry I get lost with the calculations, I'm not good with them. Hor+ may give an advantage to widescreen users (compared to 4:3 users) with the same fov (more horizontal view), but vert- gives them a disadvantage (less vertical view). Considering today widescreen is the norm, I'm okay with hor+... |
My implementation is intended to be mod compatible and cgame should not be changed for widescreen support. Here's an old gif of my implementation which had me feel certain about the hor+ FOV being correct I'm not removing widescreen. It should also be noted that John Carmack did consider widescreen hor+ in Q3 but decided against it because of the fov setting confusion that would possibly upset the "config enthusiast" playerbase
Letterboxing for non-wide. |
About suijingfeng's note that players cannot control or know actual fov, here's a small idea (take it for what it is, just an idea): what about adding a new command to output effective fov info to console?
Or maybe the output may be more verbose, also recapping some other related infos:
Well, at least players would have a way to know which is their actual FOV, while the reference cg_fov value would still refer to 4:3. About the "1.3f" thing in leilei's implementation, have I understood correctly how it works? |
@leilei- ryvnf claimed the implementation is flawed for cg_fov values not equal to 90. It appears you use cg_fov 90 in your GIF. I tried to replicate your example with cg_fov 130 and it appears ryvnf was correct. See for yourself: The vertical FOV changes between 640x480, 800x480 and 960x480 which it shouldn't in a correct implementation. |
@suijingfeng I used the |
This thread is more about question than issue. The following code is extracted from RE_RenderScene in tr_scene.c
It boil down to
because:
glConfig.windowAspect = glConfig.vidWidth / glConfig.vidHeight
is already computed previously, don't compute it every time in the main loop.parms.fovX = (atan (glConfig.vidWidth / (glConfig.vidHeight / tan ((parms.fovY * M_PI) / 360.0f))) * 360.0f) / M_PI
are equivalent toparms.fovY = (atan (glConfig.vidHeight / (glConfig.vidWidth / tan ((parms.fovX * M_PI) / 360.0f))) * 360.0f) / M_PI;
because:glConfig.vidWidth / glConfig.vidHeight = tan( parms.fovX * M_PI / 360) / tan( parms.fovY * M_PI / 360)
there no need to compute parms.fovY again, right?
I don't know how 1.3f and 73.739792 this two parameters comes from. Can someone tell something about that?
The text was updated successfully, but these errors were encountered: