Jump to content
The Dark Mod Forums

Feature request: emissive materials/volumetric lights


peter_spy

Recommended Posts

Thats awesome. Really fast work, man. I checked out the original test file and thats a pretty cool look, gives quite the sense of atmosphere with this simple light effect. This will look specially cool on street lights, with a bit of fog... Let me see if I get this right, is this volumetric light a real light (does it cast shadows like the example with the balls bouncing around, on that shader site)? So we could get real light shafts that light things dynamically?

Edited by RPGista
Link to comment
Share on other sites

Man that was fast and is a nice start! Now if i may, you could make it so the effect is stronger near the flame and gets softer as it gets way and perhaps implement some faint lens flares effect (optional) and imo it will be perfect!

 

https://1yearframes.files.wordpress.com/2011/03/1084_candle-light.jpg minus the lens flare.

Btw sorry for the physics lesson :P but because duzenko "asked", light halos is not 100% caused by volumetric lighting but some of it is, light halos or flares are also caused by light refracting inside your eye's, and spooks imo sun shafts or god rays is volumetric lighting, at least in real life it is, they are caused by the same thing, light dispersing around and illuminating small particulates (dust, ice, etc) in the air.

 

The always "trustworthy" wikipedia... ;P

 

https://en.wikipedia.org/wiki/Volumetric_lighting

 

 

It allows the viewer to see beams of light shining through the environment; seeing sunbeams streaming through an open window is an example of volumetric lighting, also known as crepuscular rays.

In volumetric lighting, the light cone emitted by a light source is modeled as a transparent object and considered as a container of a "volume": as a result, light has the capability to give the effect of passing through an actual three-dimensional medium (such as fog, dust, smoke, or steam) that is inside its volume, just like in the real world.

Edited by HMart
Link to comment
Share on other sites

Looks cool, so you kind of achieved the light bloom with volumetric light. The problem with that is we often need light source in a different place than the light model, so it's no too close to a wall for example. I assume we'd need to use a non-shadow casting light source for this effect + another light that would be a "proper" light source with shadows. That's at the cost of 2 overlapping lights hitting the same model, so I wouldn't use it like this. That example from wikipedia with light coming through a window might be a better test case.

Link to comment
Share on other sites

Thanks

 

 

Thats awesome. Really fast work, man. I checked out the original test file and thats a pretty cool look, gives quite the sense of atmosphere with this simple light effect. This will look specially cool on street lights, with a bit of fog... Let me see if I get this right, is this volumetric light a real light (does it cast shadows like the example with the balls bouncing around, on that shader site)? So we could get real light shafts that light things dynamically?

The halo on the screenshots is indeed drawn on top of each light, using that light's position. The lights are "regular", i.e. in this case it's the Closemouthed Shadow mission.

Now the halo here is a sphere just to start with something. For a shaft we would need to bind the light's falloff and projection. That's where it's starting to get costly but we should be let the user to turn it off depending on his GPU speed.

Technically it's possible to add shadows, but ATM I only know how to that with shadow maps. The stencil shadows only work with fragments that write to depth buffer (i.e. solid geometry) AFAIK.

 

 

Man that was fast and is a nice start! Now if i may, you could make it so the effect is stronger near the flame and gets softer as it gets way and perhaps implement some faint lens flares effect (optional) and imo it will be perfect!

 

https://1yearframes.files.wordpress.com/2011/03/1084_candle-light.jpg minus the lens flare.

Btw sorry for the physics lesson :P but because duzenko "asked", light halos is not 100% caused by volumetric lighting but some of it is, light halos or flares are also caused by light refracting inside your eye's, and spooks imo sun shafts or god rays is volumetric lighting, at least in real life it is, they are caused by the same thing, light dispersing around and illuminating small particulates (dust, ice, etc) in the air.

 

The always "trustworthy" wikipedia... ;P

 

https://en.wikipedia.org/wiki/Volumetric_lighting

 

Yeah, about the three physical effects (as far as I understand them)

  • Lens flare. Honestly, not sure how that fits the medieval first-person-look setting. Anticipating negative feedback - want some formal discussion first.
  • In-eye refraction. I must have experienced that myself, but can't remember what it looked like. And I'm not sure about the math behind that.
  • The air dust/fog. That's what I am focusing on with this shader.

The god-rays is all mumbo-jumbo for me. Something to make fun in the context of game-makers and nVidia marketing buzz. Consider me backward in that department.

 

 

Looks cool, so you kind of achieved the light bloom with volumetric light. The problem with that is we often need light source in a different place than the light model, so it's no too close to a wall for example. I assume we'd need to use a non-shadow casting light source for this effect + another light that would be a "proper" light source with shadows. That's at the cost of 2 overlapping lights hitting the same model, so I wouldn't use it like this. That example from wikipedia with light coming through a window might be a better test case.

The good thing is we can add the required position offset to volumetric center via light material parameters.

We should be able to use the same light for volumetric and everything else. In fact, if we want the shadows to be taken into consideration, I would go with single light for everything.

Now the approach I am following here does not duplicate on model interactions. It's using the light frustum triangles (12 in total). That's costly on the fillrate, but should not be a problem for proud GTX 1070+ owners (yet).

 

Could you add a custom-projection light to the test map? Something like the barn-window lights in Reap As You Sow. Using a custom light material as well.

https://www.istockphoto.com/photo/window-filled-with-clouds-casting-shadow-on-floor-gm844551658-138368127

  • Like 3
Link to comment
Share on other sites

Sure, I'll whip up something when I get back from work. Btw. I just checked the cost of a "glow non shadow casting light" + regular light source. That shouldn't be much of a problem. At least in the test scene the cost was just a few triangles more + one drawcall.

Link to comment
Share on other sites

There you go: https://we.tl/t-MXHnEiCrNx

 

I used _nofalloff instead of light falloff image for simplicity.

Oh no, the lamps are gone...

 

I can see 6 lights total in that room (well, 5 plus the ambient)

Do we want to add volume to all of them? Aslo, the projected floor light has a big gap before the window - should it be touching the window?

Link to comment
Share on other sites

Try this one, open the layers window (Ctrl+L), and uncheck the other_lights layer. You should see only the ambient_world and projection light. Other lights are non-shadows and they're there to fake light bounces a bit. I hid them, but I forgot that reloading the map unhides them ;)

 

https://we.tl/t-bSDmy2DoUU

Link to comment
Share on other sites

Incredible, very cool... I see interesting differences in the density along the light beam, giving it shape. Its funny that the project light used in the scene doesnt work now that you see the body of the light beam, we would need a proper light shaft that has the shape of the window's shilouette for it to work perfectly.

 

I wonder if the volumetric light/fog could be animated like in this other concept from that humus gentleman, it looks pretty cool: http://www.humus.name/index.php?page=3D&ID=70 . Is that something your shader would allow? Really liking where this is going.

Edited by RPGista
Link to comment
Share on other sites

Incredible, very cool... I see interesting differences in the density along the light beam, giving it shape. Its funny that the project light used in the scene doesnt work now that you see the body of the light beam, we would need a proper light shaft that has the shape of the window's shilouette for it to work perfectly.

 

I wonder if the volumetric light/fog could be animated like in this other concept from that humus gentleman, it looks pretty cool: http://www.humus.name/index.php?page=3D&ID=70 . Is that something your shader would allow? Really liking where this is going.

I'm walking about the same path, so it should allow that sort of animation at some point

Link to comment
Share on other sites

I can use r_singleLight for now

 

Here's how it looks with projection texture.

 

TODO: depth check.

 

Hmm, so using it like that doesn't make much sense. The projection image + volumetric light won't look good because of the shape and position of the projection light. Projection fakes the effect. To get best results, you'd have to make regular light and window with physical bars.

Link to comment
Share on other sites

 

Hmm, so using it like that doesn't make much sense. The projection image + volumetric light won't look good because of the shape and position of the projection light. Projection fakes the effect. To get best results, you'd have to make regular light and window with physical bars.

Right.

Or, you could fix the light frustum - resize and reposition.

Link to comment
Share on other sites

That in turn will make the projection image too skewed. Projection looks better when the light is pointed down almost vertically. And if you want to make the light shaft look good, you'd have to position the light behind the window, so it's lined up with it.

Link to comment
Share on other sites

you'd have to position the light behind the window, so it's lined up with it.

Can we try that?

Also, can you set different light materials to lights you want to show up a volumetric? Right now they all seem to use the lights/glowtest/window01 material.

Use the new "volumetric" keyword on that light material.

Link to comment
Share on other sites

I think this will be a better idea:

obraz.png

 

I made a quick model that has physical bars and I put a spotlight behind it, without any fake projections. This way it casts real shadows and it should look better with your current solution. If you resolved the depth problem, it should look almost perfect, I'd say :)

 

Here's the next version: https://we.tl/t-PKqElRhXo3

Link to comment
Share on other sites

I think this will be a better idea:

 

 

I made a quick model that has physical bars and I put a spotlight behind it, without any fake projections. This way it casts real shadows and it should look better with your current solution. If you resolved the depth problem, it should look almost perfect, I'd say :)

 

Here's the next version: https://we.tl/t-PKqElRhXo3

That could work, however hurtful for performance.

Please see the material remarks from post #44

Link to comment
Share on other sites

At which stage should I put the keyword?

lights/glowtest/light_shaft

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

Or:

lights/glowtest/light_shaft

{

{
volumetric
forceHighQuality
map lights/falloff_exp2
colored
zeroClamp
}
}

Edited by Judith
Link to comment
Share on other sites

Indeed. Real shadow projections are ideal, but very costly. Light projections are used exactly to simulate real projections in a much cheaper way. It is a bit of a head scratcher, because we dont really have a parallel light that has shapes (that we could contain in a "shaft"), and the spotlight trick usually works because you have the spotlight projecting the texture on the floor (with quite an angle since there usually isnt much space available), a second point light close by lighting the area to fake bounced light (optional), and often a patch model with a translucent texture coming from the window, to fake the volumetric light effect. At least thats the setup I think Ive seen done a few times in maps.

 

Would it be possible to apply this volumetric shader to patches/models? If yes, it would be possible to create patch/mesh shapes for any window, with the angle you want. But I have no clue if this is actually how this would be solved.

Edited by RPGista
Link to comment
Share on other sites

In the beginning, before the stages (option 1)

If you put it in a stage, it would mean making the stage volumetric (and I think we're not ready for per-stage processing)

 

Ok, I made the change, only the spot light uses the light_shaft material now, other lights use stock falloff_exp2. https://we.tl/t-lGvhXwFaYI

 

As for the performance, the window is 338 tris, shadow tris in that scene take up around 500. It's easier to use a physical model right now, as you don't have to line up things. Fake projection it will be a PITA anyway, since you'll have to make a window noshadows, carve some space behind to line up the light with projection etc. IMO the order of testing should be: 1) a physical model, 2) a plane with alphatest transparency, 3) a light with projection texture.

Edited by Judith
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

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 1 reply
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...