Software renderer's lighting in GZDoom (and Zandronum)

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

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

Postby Gez » Sun Dec 30, 2012 7:18 am

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.
Gez
 
 
 
Joined: 06 Jul 2007

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

Postby Korshun » Sun Dec 30, 2012 7:44 am

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.
Korshun
 
Joined: 13 Dec 2012

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

Postby Graf Zahl » Sun Dec 30, 2012 7:47 am

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

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

Postby Nash » Sun Dec 30, 2012 8:20 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

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

Postby Enjay » Sun Dec 30, 2012 8:44 am

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
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

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

Postby leileilol » Sun Dec 30, 2012 10:36 am

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
leileilol
ダークエルフ!!!!!!!!!!
 
Joined: 30 May 2004
Location: GNU/Hell

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

Postby MG_Man » Tue Jan 01, 2013 1:27 pm

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
MG_Man
TarviS
 
Joined: 28 Jul 2007

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

Postby Nash » Tue Jan 01, 2013 1:46 pm

The banding changes with your view pitch. Think of it as a really low-res version of GZDoom's default fog.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

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

Postby Gez » Wed Jan 02, 2013 4:28 pm

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.
You do not have the required permissions to view the files attached to this post.
Gez
 
 
 
Joined: 06 Jul 2007

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

Postby Nash » Wed Jan 02, 2013 4:45 pm

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?
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

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

Postby Gez » Wed Jan 02, 2013 4:47 pm

No.
Gez
 
 
 
Joined: 06 Jul 2007

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

Postby Kate » Tue Jan 22, 2013 6:01 am

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

Code: Select allExpand view
[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 allExpand view
   #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.
User avatar
Kate
... in loving memory ...
 
Joined: 15 Jul 2003

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

Postby Gez » Tue Jan 22, 2013 7:24 am

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.
Gez
 
 
 
Joined: 06 Jul 2007

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

Postby Kate » Tue Jan 22, 2013 8:55 am

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 loving memory ...
 
Joined: 15 Jul 2003

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

Postby Kate » Tue Jan 22, 2013 9:52 am

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:
User avatar
Kate
... in loving memory ...
 
Joined: 15 Jul 2003

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 5 guests