jdolan / quetoo

Quetoo ("Q2") is a free first person shooter based on id Tech2. GPL v2 license.
http://quetoo.org
203 stars 28 forks source link

Re-implement simple global fog #662

Closed jdolan closed 2 years ago

jdolan commented 2 years ago

The volumetric fog does not look great across large distances, due to its finite sampling resolution. It's also a bit expensive for what could be a simple depth-based equation. We should re-introduce basic OpenGL 1.x style global fog , and support only the subset of fog_* attributes that make sense in worldspawn. If mappers want a full-level fog with noise and light absorption, they can add a brush-based misc_fog that spans the level for that purpose.

As part of this change, we should consider adding uniform variables to the lightgrid struct that indicate whether or not any fog exists on a level, any caustics exist on a level, etc. The shaders can be updated to not even sample for fog and caustics if none exist.

jdolan commented 2 years ago

@Panjoo We now have global OpenGL 1.x style fog via worldspawn:

"fog_density" "1"
"fog_color" "0.996 0.741 0.500"

quetoo043

The entities.def file in the develop data branch has been updated to reflect the current worldspawn properties (fog_color, fog_density, fog_depth_range). Here you go, sir!

Panjoo commented 2 years ago

Yeah now we're talking, nice job.

If mappers want a full-level fog with noise and light absorption, they can add a brush-based misc_fog that spans the level for that purpose.

This is also how you did ambient lighting in Quake4 and where every light was super expensive. Ah memories. I have not sync'd the files yet, but is this info on how to use volumetric fog also added to the entities.def?

On that note: what's the default _size value for the light_sun now? The old one was set to 256, but from looking at the results during tests I suspect it has been made much lower, around 32 or something?

jdolan commented 2 years ago

Yes misc_fog is well documented in entities.def. If you texture the entity in common/fog it will become CONTENTS_ATMOSPHERIC automatically. Or if you want underwater fog, turn your water brush(es) into a misc_fog and set the appropriate keys.

And yep! Default sun size is now 32, which provides more diffuse than the previous implementation did at 256.