Fog doesn't work with materials

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Fog doesn't work with materials

Post by Indecom »

Fog doesn't work with the new material system in place. This has been the case since it was introduced, and is still the case with 3.4.1. I managed to track down the offending line in the main.fp shader.

In main.fp at line 490

Code: Select all

if (uFogEnabled  >  0)
if you change this line to

Code: Select all

if (uFogEnabled != 0)
The fog will start working again.

Here's a pk3 that you can test this on.
http://www.mediafire.com/file/sdjcxg2we ... 1.pk3/file
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Fog doesn't work with materials

Post by _mental_ »

Do you mean this line? This change has no effect for me, the given map is rendered exactly the same.
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Fog doesn't work with materials

Post by Indecom »

Are you running a map with new materials and fog? Until I made that change fog literally refused to work.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Fog doesn't work with materials

Post by _mental_ »

I'm using your map.
Screenshot_Doom_20180708_172205.png
And you still didn't give the exact location of code the question.
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Fog doesn't work with materials

Post by Indecom »

I have, it's at line 490, not the line you have highlighted.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Fog doesn't work with materials

Post by _mental_ »

GZDoom 3.4.1 you mentioned has an empty comment in line 490 of main.fp file.
There is a reference to uFogEnabled variable in the next line although condition here is different.

What’s the version of GZDoom you are using?
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Fog doesn't work with materials

Post by Indecom »

My apologies. I was giving you the line while having forgotten that I agreed code above it. It's this segment right here.

Code: Select all

             //
			// colored fog
			//
			if (uFogEnabled < 0) 
			{
				frag = applyFog(frag, fogfactor);
			} 
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Fog doesn't work with materials

Post by Graf Zahl »

The new material system separates fog as diminishing light from fog as real fog. You cannot test for the latter when the former gets calculated in the material system.
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Fog doesn't work with materials

Post by Indecom »

in my experiences, I was getting no sort of effect from enabling or disabling fog when using the new material system. There wasn't any diminishing light off in the distance, nor was there any actual colored sector based fogging effect. So I made a small change in the main.fp and it started working, at least colored fog (which is what I was after) and with no hit to the frame rate. It sounds to me (a layman) like the effect was disabled or separated from the new material system. I'm not entirely sure if that's the case, as I said I'm a layman so I understood like 25% of what you said. Lol
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Fog doesn't work with materials

Post by Graf Zahl »

Fog works fine in your map, it just looks like the material effects and the fog cancel each other out in some places.
Easily verified by setting gl_fogmode to 0. Try with colored fog if you are not convinced.
Post Reply

Return to “Closed Bugs [GZDoom]”