Jump to content
The Dark Mod Forums

Feature request: emissive materials/volumetric lights


peter_spy

Recommended Posts

That first window in the test map already has a light behind it that is casting shadows through a window frame. If you add collision with geometry, you should see the difference there.

 

I wonder how this should be handled though, so it's not too complicated. Right now you can have volumetric light that does or doesn't cast shadows. Should we handle light shaft collision with geometry separately or maybe link it with noshadows spawnarg?

Link to comment
Share on other sites

Also, you can already use volumetric option with omni lights, either with light textures like falloff_exp2:

obraz.png

 

Or with your own projection textures:

obraz.png

 

Duzenko, I hope you will be able to clean up light frustum lines and the banding someday, but even with that, the whole thing looks pretty cool in motion :)

  • Like 1
Link to comment
Share on other sites

...

 

All in all, this is performance heavy effect and should be used sparingly, for strong light sources like floodlights, or to simulate sunlight / moonlight, but definitely not for every light or every window.

 

Yes this should be used like you said mostly on windows looking directly to the sun or moon, or used in some interior lights to simulate a dusty foggy environment or some magical effect, etc.

 

Btw occlusion by geometry is pretty much standard in all volumetric effects on other engines i've used, how they do that is beyond me but it proves is not impossible.

 

 

How unity handles occlusion with simple objects like walls.

 

http://saladgamer.com/vlb-doc/comp-dynocclusion/

Edited by HMart
Link to comment
Share on other sites

That first window in the test map already has a light behind it that is casting shadows through a window frame. If you add collision with geometry, you should see the difference there.

 

I wonder how this should be handled though, so it's not too complicated. Right now you can have volumetric light that does or doesn't cast shadows. Should we handle light shaft collision with geometry separately or maybe link it with noshadows spawnarg?

 

It would make sense to link it to "noshadows" I would think. AI models, for example, have textures with "noshadow" applied, and then use a shadow mesh. If the lights use the actual geometry, that would be a bigger performance hit.

 

It also saves having to modify who knows how many material shaders.

  • Like 1
Link to comment
Share on other sites

Okay, that makes sense. Lights with volumetric keyword should have the light shaft colliding with geometry by default. Now major use scenarios will be roughly like this:

 

1) Mapper uses volumetric light that collides wth geometry, like the in first window in the test map (most expensive option)

2) Mapper uses the same light, but uses noshadows spawnarg on selected geometry, like that window frame, along with custom projection texture (less expensive, and you can e.g. place a light behind opaque glowing window to create a light shaft)

3) Mapper uses volumetric light with noshadows spawnarg and the light shaft ignores geometry (least expensive option, might be useful e.g. in areas without AI, so it doesn't break the illusion much).

 

As for the performance, I haven't tested it much, but having several volumetric lights or sitting inside a volumetric light cone and looking at other lights didn't cause any problems. I saw a big performance drop when two or more volumetric shadow casting lights were overlapping, or when the player was inside the radius of more than one of them. That problem was gone once I used noshadows in all these lights.

Link to comment
Share on other sites

Other possibly interesting uses of volumetric light and projection textures in omni lights:

obraz.png

 

Also, as Duzenko mentioned, you can use volumetric keyword with intensity parameter, and it goes way higher than 0-1 range (I used, 10, 20, 40, 100, it all works). In practical terms, you could use such lights (along with noshadows, nospecular and nodiffuse) to imitate glow as well:

obraz.png

Edited by Judith
  • Like 4
Link to comment
Share on other sites

Duzenko, how's progress on light shaft colliding with geometry? It would be really cool to see that in action :)

In TODO but it should be easy.

I want to fix at least some of the remaining shadowmaps bugs first.

Have you got the transparent surfaces working yet with shadows? I'd want to get that done first.

Link to comment
Share on other sites

Alright, makes sense. Unfortunately no, I couldn't get transparency shadow maps to work, but I saw in your screenshot that it's there. I assume there's something wrong on my end, but I don't even know where to start looking.

I will need to test it on nvidia on my end at some point.

  • Like 1
Link to comment
Share on other sites

Ok, so this is definitely a problem on my end:

WARNING:shaderCompileFromFile(glprogs/interactionN.fs) validation
0(87) : error C7532: global function textureGather requires "#version 400" or later
0(87) : error C0000: ... or #extension GL_ARB_texture_gather : enable
0(87) : error C0000: ... or #extension GL_EXT_gpu_shader4_1 : enable
0(169) : warning C7533: global variable gl_FragColor is deprecated after version 120


WARNING:shaderCompileFromFile(glprogs/shadowMap.fs) validation
0(9) : error C7566: in blocks require #version 150 or later
0(9) : error C0000: ... or #extension GL_ARB_gpu_shader5 : enable
0(17) : warning C7533: global variable gl_FragColor is deprecated after version 120

Edited by Judith
Link to comment
Share on other sites

Some progress:

  • merged svn changes into the volumetric branch
  • shadow maps added to the volumetric light shader
  • the shader compilation errors from the post above were fixed before today

https://drive.google.com/file/d/0B9OoHSmkeSeNZWdyZFliQkNsVTA/view?usp=sharing

 

Known issues: shadow map cracks and volumetric light gaps along the light frustum edges.

post-3508-0-76870500-1538653375_thumb.jpg

  • Like 1
Link to comment
Share on other sites

There's also a visible difference between light intensity, while all lights share the same values:

What is your current light material setup?

 

 

Volumetric lights stopped working with r_shadows 1 though.

Not sure what is better - ignore stencil shadows or disable the volumetric lights when they're on.

Link to comment
Share on other sites

What is your current light material setup?

 

Here's latest version of the map https://we.tl/t-SGG1qKtFeR

 

I haven't changed much stuff. First light uses this material

lights/glowtest/light_shaft

{
	volumetric
    {
        forceHighQuality
        map    lights/falloff_exp2
        colored
        zeroClamp
	}
}

Second one uses projection texture, as it did before.

 

 

Not sure what is better - ignore stencil shadows or disable the volumetric lights when they're on.

 

Actually, stencil shadows seem to have better performance on my pc than shadow maps, at least for now. Shadow maps seem to be pretty GPU intensive right now.

Edited by Judith
Link to comment
Share on other sites

 

Here's latest version of the map https://we.tl/t-SGG1qKtFeR

 

I haven't changed much stuff. First light uses this material

lights/glowtest/light_shaft

{
	volumetric
    {
        forceHighQuality
        map    lights/falloff_exp2
        colored
        zeroClamp
	}
}

Second one uses projection texture, as it did before.

 

 

 

I believe the difference in light intensity is caused by different average brightness of textures/glowtest/lights/window_p2 and lights/falloff_exp2

Link to comment
Share on other sites

Okay, the difference is actually in light shaft intensity, you can tweak that by setting it to 2 or 3. So that's not a problem.

 

Remaining problems:

 

Banding when light shaft collides with geometry:

 

obraz.png

 

It also happens with projection textures, but to smaller extent. You said you could work with standard textures to improve this, and IMO that will be enough. By default, all lights use lights/squarelight1a.tga image for falloff. Other most commonly used option is _nofalloff parameter, I think that stands for lights/zol_nofalloff.tga. If you could decrease banding for these two falloff images, that would be sufficient for most situations.

 

And until shadowmaps get optimized, maybe it's a good idea to leave the light shafts compatible with stencil shadows too? Right now shadowmaps use most of my GPU, regardless of map size or shadow quality/radius. Similar case here: http://forums.thedarkmod.com/topic/19257-testers-and-reviewers-wanted-bfg-style-vertex-cache/page-12?do=findComment&comment=428236 where the GPU use is 99% most of the time.

  • Like 1
Link to comment
Share on other sites

Okay, the difference is actually in light shaft intensity, you can tweak that by setting it to 2 or 3. So that's not a problem.

 

Remaining problems:

 

Banding when light shaft collides with geometry:

AFAIK stencil shadows can't work with translucent materials (i.e. anything not writing to the depth buffer)

How bad is the banding when you disable post-processing and set gamma to 1?

Link to comment
Share on other sites

In terms of performance, I could render the scene below in 60 fps with stencil shadows. With shadow maps the performance goes down to 30 fps and temperature on my GPU gets high. Soft shadows quality is very high, map size is 512.

Stencil soft shadows is a dead end from my point of view. This particular scene is hardly a fair benchmark as well.

With shadow maps, try lowering the SS quality slider until you get back to 60.

  • Like 1
Link to comment
Share on other sites

I did some tests with shadow maps in full missions (like New Job or Volta), and with r_softShadowsQuality 14, r_softShadowsRadius 6, and r_shadowMapSize 512 the results are decent; the GPU use is between 40 and 70%. In that test scene however, GPU use is 99%. I'm guessing it's not shadow maps that are causing trouble here, but volumetric lights.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 6 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...