#3352 posted by Joel B on 2018/04/03 02:50:32
I am pretty sure that in Quakespasm (or GL Mark V) the gl_texture_anisotropy setting does affect even gl_nearest_mipmap_linear texturing in some way. Don't have the details handy though.
#3353 posted by mh on 2018/04/03 06:09:31
GPUs uses the farthest vertex distance
That's not true.
With a GPU, mipmap level selection is (1) per fragment, NOT per vertex or per polygon, and (2) based on the screen space derivatives of each fragment.
For fixed pipeline hardware selection is described in the GL spec, e.g for GL 1.4 on page 145: https://www.khronos.org/registry/OpenGL/specs/gl/glspec14.pdf
#3354 posted by mankrip on 2018/04/03 06:52:27
By "per fragment" you mean trilinear filtering?
I'm on mobile, can't easily search for the specific post where I saw the info.
(2) based on the screen space derivatives of each fragment.
Which means that for polygons that aren't parallel to the camera plane, the texels farther away from the camera gets smaller, so the texel on the vertex farthest away will determine which mipmap to use. That's how I understood it.
What I'm talking about is a comment about the differences between trilinear filtering, anisotropic filtering and why the walls on hardware-accelerated engines gets blurry when seen from an angle. I don't remember the exactly thread, but the comment was somewhat recent.
#3355 posted by mankrip on 2018/04/03 07:17:54
Okay, here's the exact quotes:
winquake's mipmapping was based purely upon the distance (and texinfo+screensize+d_mipcap).
on the other hand, opengl decides which mipmap to use based upon the rate of change of the texcoords - or in other words surfaces that slope away from the view are considered more 'distant' and thus get significantly worse mipmaps.
glquake and winquake have _very_ different mipmapping rules, and glquake just looks blury in about every way possible...
Also Worth Adding...
#3143 posted by mh [137.191.242.106] on 2017/11/22 18:29:07
...that in hardware accelerated versions of Quake, mipmap level selection is not normally something that the programmer has control over; this is done by fixed function components in the graphics hardware.
#3356 posted by mankrip on 2018/04/03 07:20:34
The first quote is the #3140 posted by Spike [86.151.115.97] on 2017/11/22 17:55:03.
#3357 posted by mh on 2018/04/03 08:00:59
No, forget about vertexes, they're not relevant. Likewise distances: Not relevant.
Per fragment is not trilinear.
In OpenGL a "fragment" is a collection of values used to produce a final output; please read https://www.khronos.org/opengl/wiki/Fragment for more info.
Texture coords (NOT texture lookups) are linearly interpolated between the per-vertex and per-fragment stages. Those interpolated coords are then used for mipmap level selection and texture lookup, which may have linear or nearest filtering applied.
In shader speak,
in vec2 texcoords;
Vec2 ddx = dFdx (texcoords);
Vec2 ddy = dFdy (texcoords);
Vec4 color = textureGrad (texcoords, ddx, ddy);
And that will give you the same result as the GPU's automatic miplevel selection.
The important message however is that miplevel selection in hardware is NOT per-vertex or per-Surface, because the fragment shader stage just doesn't have access to that info. It's per-fragment; per-pixel if that's easier (even if not 100% correct) terminology.
This is all public information; it shouldn't need to be explained.
#3358 posted by mankrip on 2018/04/04 17:34:08
mh: Yes, I didn't try to learn exactly how it works, but it was enough to give an answer that despite being not technically correct, points to the right place where the cause is: the GPU mipmap selection algorithm. This way Poorchop knows that it's not a fault of the texture mode or screen scaling algorithm used by QuakeSpasm.
I was just trying to help so the guy won't waste his time messing around with every cvar trying to fix it. In this sense, my answer should give the proper results.
And yes, I recognize I'm way more dumb than I should be when it comes to hardware rendering, but it's not my field. There's no future for me in it. I only learn what I need to know about it from an user perspective.
Render Gun In Lienar Or Nearest
#3359 posted by anonymous user on 2018/04/05 01:28:48
Problem Solve !
Yet Another Controller Question!
Is there a way to designate a specific controller in QS?
I just got a lovely Hori Fighting Controller that I use for old d-pad based games and emulation.
Problem is that it's plugged in whereas my analogue controller is wireless. It seems that QS only reads the first controller recognised by Windows or something.
When I boot up QS it only responds to my plugged in controller and I can't find a way to get QS to read what has now become my 'second' controller.
PS: Just a FYI that the Nightlies page has a 502. :)
#3361 posted by ericw on 2018/04/09 00:58:17
At the moment it's hardcoded to use the "first controller in the list" returned by SDL.. agree this would be a good / easy thing to improve.
I don't know what would be a good way to store it in a cvar - just the controller index would work I guess, as long as the OS returns them in a consistent order across reboots.
re: Nightlies, thanks.. rebooted.
Do you think that sometime in the future you'll create a menu for controller options? Maybe if players can easily change things in a menu it wouldn't be such an issue if they did have to occasionally change the CVAR.
Of course, I've really no idea how much work it is to add menu stuff in Quake... Just curious. :)
Potential Code Snippet Donation
#3363 posted by Baker on 2018/04/12 14:20:42
in_sdl.c -> IN_StartupJoystick ...
Replace "for (i = 0; i < SDL_NumJoysticks(); i++) { ... }" block with following.
{
qboolean do_second = COM_CheckParm ("-controller2")
qboolean found_first = false;
for (i = 0; i < SDL_NumJoysticks(); i++)
{
const char *joyname = SDL_JoystickNameForIndex(i);
if ( SDL_IsGameController(i) )
{
const char *controllername = SDL_GameControllerNameForIndex(i);
gamecontroller = SDL_GameControllerOpen(i);
if (gamecontroller)
{
if (do_second && !found_first) {
found_first = true;
continue; // skip to the next one
}
Con_Printf("detected controller: %sn", controllername != NULL ? controllername : "NULL");
joy_active_instaceid = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller));
joy_active_controller = gamecontroller;
break;
}
else
{
Con_Warning("failed to open controller: %sn", controllername != NULL ? controllername : "NULL");
}
}
else
{
Con_Warning("joystick missing controller mappings: %sn", joyname != NULL ? joyname : "NULL" );
}
}
}
Hipnotic Rogue could just add -controller2 to the command line.
...
#3364 posted by Baker on 2018/04/12 14:27:07
Someone in the QuakeDroid thread asked for controller support for Android ...
Was about to implement controller support from a SDL2 development blog, then realized if it didn't use the same key names, behaviors and such as Quakespasm would be a missed opportunity.
Short version is that I spent some time researching the differences between the initialization in Quakespasm vs. what I read on the SDL2 development blog, and ended up reading this section of code several times.
#3365 posted by ericw on 2018/04/12 22:02:08
Cool, I hope the QS controller code is useful. I'm biased but I really like how it turned out (pretty clean integration with the engine, playable out of the box, defaults went though a lot of player testing - i.e. cubic easing, the deadzone implementation.)
Here is the initial commit that shows the changes outside of in_sdl.c: (mostly just adding K_ABUTTON and K_BBUTTON to the menu code.)
https://sourceforge.net/p/quakespasm/code/1293/
I made some further tweaks which I think were restricted to in_sdl.c. Let me know if anything is unclear.
(Thanks for the -controller2 code snippet, that seems like a good starting point for multi contorller support)
#3366 posted by Baker on 2018/04/13 05:56:58
Should you have use for it, @insideqc I posted something for "Quakespasm Ticket #27" (Unix path) that isn't rocket science but perhaps will save you 5-10 minutes.
Go to sv_main.c line 1432 (SV_SpawnServer) and applying that to the sv.model_precache[1 + i] (modifying it) *should* in theory solve the problem for models.
Might need to hit pr_cmds.c PF_precache_sound and pr_cmds.c PF_precache_model. And sv_main.c @SV_StartSound and sv_main.c @SV_ModelIndex
Rough blue print.
/If you decide that is worth addressing at all. The counter-argument is that this falls at the doorstep of the mapper -- the mapper fixes the map and re-releases the map. There are myriads of ways a mapper can foobar a map, perhaps the right answer is "Not going to protect mapper from self".
Thanks
#3367 posted by ericw on 2018/04/13 08:55:16
Yeah, it's a grey area. If winquake.exe and QS on Windows accept it, that's a good argument for accepting the backslashes on Unix OSes, but it should be a developer warning on all platforms (realistically most maps are only tested on Windows before release).
#3368 posted by szo on 2018/04/13 09:56:48
If winquake.exe and QS on Windows accept it,
that's a good argument for accepting the backslashes
on Unix OSes,
I disagree, we shouldn't have to fix mapper screw-ups.
Not going to protect mapper from self
This is how I see it.
#3369 posted by Baker on 2018/04/13 10:17:47
Plus what about mixed case filenames -- say some guy does a upper case file name that happens to match a lower case on in a pak on accident and Windows ignores it ... but Linux should do what?
Trying to protect mappers from their own choices ultimately leads to choices with unexpected consequences.
/Anyway, just throwing out a thought.
#3370 posted by ericw on 2018/04/13 11:03:30
fair point, I guess this kind of compatibility hack also indirectly forces other engines to apply the same patch. A developer warning would be good though.
Ericw
#3371 posted by Kinn on 2018/04/14 12:55:13
I do want to implement this at some point!
Zomg, sorry I seem to have missed this post, but that is great news :D
The faster / more natural / software faithful way of doing it is to ignore colored lighting and use the colormap.lmp just like software, having the fragment shader read the textures as 8-bit
I'd happily live without coloured lighting just for the true software look, although it's worth having a gander at how FTE does it, which somehow does the proper 8-bit palette look, but then it can still get tinted by coloured lighting afterwards, which neatly avoids the colours getting mangled.
@ericw
#3372 posted by Baker on 2018/04/15 09:51:04
The way Quakespasm's SDL2 controller support works totally doesn't work on Android (at least not as of SDL2 2.0.8 - March 1 2018).
That being said, SDL2's controller support for Android appears to be better than in the past.
I think SDL2 used a "Steam/desktop computer mentality" to the controller support for Android, and then started to gravitate towards using the existing controller support already that is part of Android (which from accounts I have read, works outstandingly well).
I may yet get some sort of Android SDL2 controller support to work (I have 6 buttons working, no axis working, several buttons not working).
I think SDL2 has done a tremendous job on Android.
Now I think I understand why the SDL2 blog and your code were different.
Anyway, just wanted to provide some feedback to as to how that went. Should I get it to work, having your skeleton of cvars/deadzone stuff will have been very useful even despite SDL2 Android wiring differences.
#3373 posted by Joel B on 2018/04/21 22:40:59
I've got a question about an issue that is suuuuper minor -- but I'm curious so I'll go ahead and post it.
When quitting the game, or when using the menu to start a new singleplayer game while you already have a game active, Quake will pop up an "are you sure" dialog that waits for you to press Y before continuing.
Something I've noticed when using Steam streaming with Quakespasm is that the dialog will be visible on the monitor of the PC that is running the game, but it won't be visible on the TV that the game is being streamed to (through Steam link). On the TV it looks as if the game has frozen up. But you can still of course press Y (or ESC) and things work as expected.
(I'm not sure if this happens with other Quake engines too.)
This is not anything I'm losing sleep over, but do you have any guesses off the top of your head why that dialog doesn't make it to the streamed display?
#3374 posted by metlslime on 2018/04/22 21:40:17
might be drawn to the back buffer and then the buffers aren't getting swapped before the game stops to wait for input?
Does the same thing happen if you try to start a new game from the single player menu while a map is loaded?
#3375 posted by metlslime on 2018/04/22 21:41:18
oh, reading a bit more closely... maybe the streaming to a TV doesn't update the most recent frame? It's one frame behind somehow?
#3376 posted by Baker on 2018/04/22 22:20:40
Nah, what is likely going on is that the screen is blocking in Quakespasm, like it was in FitzQuake and original Quake before it.
So anything that depends on a normal frame or normal event process isn't going to happen.
(A counter-example: in Mark V very recent builds, the dialog screen is not blocking -- you could stare that the dialog screen all day and, for instance, not disconnect from a server. It might be like that in FTE also, I wouldn't be surprised. I may have even got the idea from FTE and then forgot.)
|