Jump to content
The Dark Mod Forums

Recommended Posts

Posted

Though this is related to PBR as a component in getting it done right (like reflection probes) I thought it's an improvement of its own that's worth discussing. I don't know if this is implemented or estimated in some form, but working with light entities in my own FM's I haven't seen any spawnargs for it so I presume it's not.

At the moment lights in TDM act as zero-scale points, light sources have no actual radius. I know what you might be thinking: Of course lights have a radius, it's the box that decides how far a light shines and what it affects! What I'm referring to is not the range but the emission radius, representing the scale of the bulb itself: Think of it as a minimum radius... at the moment lights only have a maximum radius, the minimum is currently a point. In modern engines this affects both specularity and shadow softness as well as how the light is distributed.

Like most engines we shouldn't need anything more than a float describing the size of the bulb, a simple sphere ought to be enough... given we already work with radius boxes, we could instead use a separate box which would give us better control with unevenly shaped bulbs. Every default light entity should of course be updated to use this: Torches / candles would set it to the average size of their flame particles, gas / electric lamps should have it represent the scale of the light bulb or the lamp head.

If done right this can greatly improve our graphics and add more realism, but as with most things it's not going to be that simple. Also this would create changes to the lightgem in all FM's but very minuscule ones that shouldn't even be detectable. There's 3 different components I presume we have to tackle independently.

  1. Soft shadows: Shadowmap softness is probably the easiest, just add the average bulb radius to their value.
  2. Specularity: At the moment all lights seem to produce specular orbs of the same fuzziness on shiny surfaces. What we probably want is for lights that keep their min radius 0 to produce a fully sharp orb or dot, softness is added to each light's ball based on this radius.
  3. Light projection: The biggest aspect is changing how light is distributed, the projection texture / falloff material would emanate very differently. Everything inside the bulb would shine at the intensity of the center pixel and should start fading from the min radius toward the max, the projection texture would get slightly inflated like a balloon. The best solution (which also accounts for blur) seems like a 2D shader that copies the light texture onto itself at slightly different offsets to make it fuzzy: There's already a blur filter that does just that when you're underwater for example, we could to get away with doing the same thing to light textures using the min radius as the offset parameter. As lights typically don't change scale, this should be possible to do only once at map start rather than every frame including for moving lights like torches, this way we should have no performance loss.
Posted

As reference, here's a few Blender renders showing how light radius works there... for accuracy it's the Eevee engine which uses the same lighting technology as OpenGL (no raytracing). 0, 0.25, 0.5 in order:

0.png.83d18ef43d0d2dd0c1058fb7b3a3a958.png1.png.8571357db176c722b9f78ec1f183ed9f.png2.png.1751d4606eef90e75d9fcc3333d000c2.png

This shows what it's doing better, though like I said we could use another box like for the standard radius.

Screenshot_20230705_230305.jpg.846117746b02fe0c59841d58424ff7df.jpg

I believe Eevee simulates the light source at a random position within the sphere for every sample. Obviously this would murder our performance, hence why I'd use a shader to emulate this behavior in 2D on the light texture itself.

Posted (edited)

That indeed sounds useful, but those Eevee renders do seem to be more advanced than what TDM can do, like those reflections and shadows, seem to be way ahead, is that really simple OpenGL lighting? Seems more like some kind of modern PBR system.

Edited by HMart
Posted
12 minutes ago, HMart said:

That indeed sounds useful, but those Eevee renders do seem to be more advanced than what TDM can do, like those reflections and shadows, seem to be way ahead, is that really simple OpenGL lighting? Seems more like some kind of modern PBR system.

True: They're only meant to be representative, just a view of how big (non-zero-point) lights generally work. Lots of things TDM lighting can't do compared to a render engine, totally different system. Would be a nice part to have in some form and give us more realistic light: For instance the flame of a torch will be less sharp than that of a candle... if you're aware of this limitation and look closely at the two to compare them, you can see they both act as a dot of light and only the radius differs.

  • Like 1

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

    • Frost_Salamander

      @taaaki Wiki seems broken. Main page works but click any link and:

      · 0 replies
    • Goblin of Akenash

      Another goblin secrets episode on the way with the new update
      Focuses are:
      supporting 100% runs on shadow playstyles
      fixing the softlock
      and a tiny visual upgrade

      · 0 replies
    • STiFU

      Sorry for not being around enough lately. I am extremely busy at the moment. We are trying to build a home and the German bureaucracy is killing me! Meanwhile, child number 2 is underway. 🙂
      · 0 replies
    • cvlw

      Yo TDMers.
      It has been a while.  This past year or so I have encountered some tough family issues, became a grandfather, had a job change, and then Steam offered Dishonored and Dishonored 2 along with all DLC for like 5 dollars.  So... have played that.  What a game; highly recommend.
      I am looking to resume TDM activity soon.
      Clint
      · 2 replies
    • Airship-Ballet

      If anyone would like some ambient sounds for any of their work please do hit me up - I've tons of strings both physical and sampled that I love making loops with
      · 2 replies
×
×
  • Create New...