mvdevs / jk2mv

JK2MV - improved, modernized JK2 client and server
https://jk2mv.org
GNU General Public License v2.0
108 stars 33 forks source link

Problem with fog and sky #176

Open Yberion opened 3 months ago

Yberion commented 3 months ago

Hello,

Someone on JKCommunity's discord pointed out there might be a problem witht he following line:

It appear that the fix should be something like that:

if ( stage == 0 && !shader.sky && !shader.isSky ) {

I'm not sure about !shader.isSky as in the discord's conv they are talking about !issky and I don't know from where that comes from as it's not on jk2mv code.

The explaination is the following:

it causes sky to be drawn in front of transparent elemtns 
which ruins stuff like speed ghosts
or applied ent alpha
...
basically the place where SS_FOG is applied to stuff
but it shouldnt be applied to sky

Edit:

Additional context:

A: only one !issky check is needed

B: there is no issky in jk2mv code

A: well issky or sky, same thing
A: the check should be whether its a sky shader thats all

It seems that the following should be enough, said person A

if ( stage == 0 && !shader.isSky ) {
A: this is how it looks for me
A: sky, at least in my fork, is a skyParms_t struct
A: issky is a qboolean

I think OpenJK fixed it this way https://github.com/JACoders/OpenJK/blob/master/codemp/rd-vanilla/tr_shader.cpp#L3185

A: so openjk has a "fix" but it doesnt reference the qboolean issky but the sky struct. maybe it works by accident
A: right. it should be only !issky probably. maybe it still works with !sky because by default that struct evaluates to 0