Software renderer's lighting in GZDoom (and Zandronum)

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Gez »

It's a known problem. It crashes on ATI and Intel GPU. If I were Graf I would have replaced 1.7.00 by the SVN revision where that was fixed and called it a hotfix; but all I can do is tell people to use the SVN builds.
Korshun
Posts: 52
Joined: Thu Dec 13, 2012 1:32 pm

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Korshun »

Graf Zahl wrote:Because for the software renderer fog and light are the same thing. If you draw a sprite fullbright you'd draw it without any fog.
So software renderer ignores fullbright in fog. Then a special OpenGL option is introduced to draw fullbright sprites without any fog. Question: why is it impossible to add the same option for software renderer? (I remember it was said in the thread about "force brightness in fog") (okay okay this is offtopic and I may be wrong on whenther it was said to be impossible)
Gez wrote:It's a known problem. It crashes on ATI and Intel GPU. If I were Graf I would have replaced 1.7.00 by the SVN revision where that was fixed and called it a hotfix; but all I can do is tell people to use the SVN builds.
Especially since GZDoom 1.7.0 has incorrect lighting parameters for "software" lightmode. It is too dark. SVN builds replicate software renderer's lighting exactly.
Last edited by Korshun on Sun Dec 30, 2012 7:53 am, edited 2 times in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Graf Zahl »

Gez wrote:It's a known problem. It crashes on ATI and Intel GPU. If I were Graf I would have replaced 1.7.00 by the SVN revision where that was fixed and called it a hotfix; but all I can do is tell people to use the SVN builds.

It has been christmas, for god's sake! I had more important stuff to do than to test a new build for release. I'll do it some time next week.
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Nash »

Just reporting that I notice the software lighting mode doesn't really play well with regards to dynamic lights and lighting on sprites/models... the dynamic lights doesn't seem to illuminate the actors.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Enjay »

Nash wrote:Just reporting that I notice the software lighting mode doesn't really play well with regards to dynamic lights and lighting on sprites/models... the dynamic lights doesn't seem to illuminate the actors.
Are you sure? This screenshot was taken with the software emulator active. Compare the two enemies. The one on the right is affected by the red glow from the powerup whereas the one on the left is out with the range of the light and not affected.

Image
User avatar
leileilol
Posts: 4449
Joined: Sun May 30, 2004 10:16 am
Preferred Pronouns: She/Her
Location: GNU/Hell

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by leileilol »

Korshun wrote:So software renderer ignores fullbright in fog. Then a special OpenGL option is introduced to draw fullbright sprites without any fog. Question: why is it impossible to add the same option for software renderer? (I remember it was said in the thread about "force brightness in fog") (okay okay this is offtopic and I may be wrong on whenther it was said to be impossible)
It's not impossible. All it would need is just applying the colormap table (for lighting) before the fog table to get shading and fullbright while maintaining fog, separating that from lighting so it's much less of a lighting hack. This would need to be an option though, since it's not something Hexen did. Likewise, it's also possible to draw sprites without any fog.

It'd be a bit of a performance loss when it's two lookup tables working together, and there are worse bottlenecks in zdoom
User avatar
MG_Man
Posts: 1401
Joined: Sat Jul 28, 2007 1:24 pm
Contact:

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by MG_Man »

This is cool! I have to wonder though, what does it look like when you look up and down? Is the light banding infinitely tall or is it made spherical?
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Nash »

The banding changes with your view pitch. Think of it as a really low-res version of GZDoom's default fog.
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Gez »

Nash wrote:
Gez wrote:I could make the banded/smooth softlight togglable by CVAR, but you still have to quit and restart GZDoom because there doesn't seem to be a simple way to recompile the shaders from a CUSTOM_CVAR.
YES PLEASE!!! :D
Here you go then.

Since there is no simple, non-hacky way of getting shaders to recompile when the CVARs are changed (and the only way to force recompilation is to quit and restart), I find this kinda useless, to be honest.
Attachments
shadercvars.zip
(1.34 KiB) Downloaded 59 times
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Nash »

From an end-user perspetive, it's no different than having to restart GZDoom to switch between OpenGL and software. I don't see the issue here.

So umm... I appreciate the patch but you are going to merge it into GZDoom aren't you? That's why you even raised the topic in the first place right?
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Gez »

No.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Kate »

Bumping this because I noticed a problem with the shader in the current GZDoom SVN:

Code: Select all

[06:25:26] «@Kate» okay found a problem with the new software lighting mode
[06:26:04] «@Kate» unlike software, the gl-software implies that 0 light level literally means “solid inky blackness” which makes it literally impossible to fight in
[06:26:39] «@Kate» in software you still had very faint outlines of enemies, so you could see them coming at you
I fixed this problem by changing how the clamping is applied in vec4 getLightColor in main.fp:

Code: Select all

	#ifdef SOFTLIGHT
		float newlightlevel = 1.0 - R_DoomLightingEquation(lightlevel, gl_FragCoord.z);
		color.rgb *= clamp(vec3(newlightlevel) + dlightcolor, 0.03125, 1.0);
	#endif
In specific, I changed the 0.0 in the final clamp to 0.03125, which is 8/256, or the shade that is closest to black in the doom palette. Well, it's actually (7,7,7), but I figured what they were going for is to have 8 be the lowest shade of color you can see, which is why you get spotted grey/black instead of just black. Changing this makes it possible to see in absolute darkness, so you actually have a fighting chance against enemies like you do in software mode.
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Gez »

Kate wrote:In specific, I changed the 0.0 in the final clamp to 0.03125, which is 8/256, or the shade that is closest to black in the doom palette.
Do you mean "closest to black without being black"? Palette indices 0 and 247 are both pure #000000. #070707 is index 8.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Kate »

Yeah, I mean index 8, because that's what shows up when you use the lowest colormap entry. For reference:
Spoiler:
This is with an Oblige level loaded, so no crazy colormaps, just vanilla doom 2. I set R_Visibility to 0 to force the use of the darkest colormap, to simulate absolute 0 lights so you can see the effect better.

Here, you can clearly see the outlines of a medikit, a zombieman, a bunch of the brighter textures like STARTAN panels, the UAC door, and the GREY* trimmings, and even a blue health bonus to my left using the darker shades of blue.

The solid black textures are METAL and the blue carpet, so of course due to palette limitations they turn solid black since there's not that many dark colors in the palette to begin with, but with GL they would be more visible since the shades can go that low.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: Software renderer's lighting in GZDoom (and Zandronum)

Post by Kate »

Actually, I decided to do a little more experimentation, and I found that 0.5882 is a lot closer to what software probably used as a lower cap. I figured this one out by looking at the colormap itself and doing some math.

So index 8 (dark grey) turns to index 0 (black) between indexes 98 and 99, so around 119 RGB. So now the math. Index 8 is 7 RGB, so doing some color difference to figure out the difference in scale, we find that 7 / 119 = 0.05882352941176470588235294117647, or 0.05882 rounded. so the lowest colormap is about 5.8% as bright as the fullbright colormap.

Trying those values on a texture, it seems to match more closely:
Spoiler:
Post Reply

Return to “General”