Jump to content
The Dark Mod Forums

Pretty Neat. Some did Octahedron "Darkmod" style lightgem capture in Unreal Engine


nbohr1more

Recommended Posts

Check this out:

 

https://www.youtube.com/watch?v=P1j7lwvGRWk#action=share

 

For the past little while I've been working on a light detection method for use in a stealth game like the Splinter Cell or Thief games. I wasn't happy with most of the other implementations I saw as most of them used raycasting the distance from light sources and didn't seem all that accurate. So, after reading up on how The Dark Mod did their light detection (http://forums.thedarkmod.com/topic/18882-how-does-the-light-awareness-system-las-work/) , I decided to try and implement a similar system in UE4. After a lot of work I finally got it where I like it, mostly.

 

It works by having a SceneCapture focused on an octohedron located in the same space as the player. The capture is sent to a RenderTarget which then has every pixel scanned and the brightness of each pixel calculated. The brightness value of the brightest pixel is then returned for whatever you may need it for (eg AI visibility calculations). I've also considered averaging the brightness of every pixel instead of simply returning the brightest pixel, but I haven't tried it yet. In the video, you can see an example of how you might display the lighting information to the player in the form of a progress bar. There's also debug information in the form of a raw float value, and a display of the RenderTarget. Advantages over the "common" implementations (ie raycasting):

 

This method takes into account the color of a light source. Some colors will make the player more visible than others. The "perceived luminescence" method from here was used: https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color

This method works with indirect light bouncing. With raytracing method, the easiest way to implement it was if the line of sight to the player was broken, the player was completely hidden. This would look very unrealistic if there was a lot of bounced light behind the object blocking the line of sight.

This method works with pretty much any light source, including spotlights.

 

Some of the current limitations:

 

It's only as accurate as your Volumetric Lightmap. During testing I had a lot of problems with directional light being cast on the player even though he was indoors. I also had to increase the settings of the Volumetric Lightmap quite a bit to get it to be accurate enough for my tastes, eg next to doorways.

 

I'm pretty happy with it at the moment, though it's a shame I had so much trouble with directional lights having their indirect bounce applied to the character through walls. Any comments or suggestions on how to improve the system are welcome.

https://www.reddit.com/r/unrealengine/comments/8hcfwy/light_detector_method_inspired_by_the_dark_mod/

  • Like 1

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Lightgem calculations are/were performance heavy in TDM, and simplifying those leads to better performance, so I guess the idea is or was quite expensive. Maybe that's less important for modern engine. Either Thief 1-3 devs found a cheaper way of doing this, or their approach was different. Actually it would be interesting to read about that :)

 

Btw. Obs recently posted a few alternative light visibility meters implemented in UE4, not sure which thread it was.

Link to comment
Share on other sites

How does TDM calculate the lightgem?

Does it use Raycasting from each lightsource to some different points of the player model (adding ambient light as base brightness) and then averaging the measurements?

 

Nope. It works very similar to the above implementation.

 

Step 1) Create a subview

Step 2) Replace the player model with an Octahedron

Step 3) Relocate the player camera inside the Octahedron

Step 4) Point the camera at the sky

Step 5) Generate all shadow casting geometry and the lightgem octahedron

Step 6) Render all lights that aren't in the culling logic range for a camera inside a noshadows surface to a Pixel Buffer Object (PBO)

Step 7) Read the PBO and find the brightest pixel then assign that as the lightgem level.

Step 8) Apply biases like speed, weapon drawn, crouch to change the lightgem level

Step 9) Point the camera at the ground

Step 10) Repeat steps 5 and 6

Step 11) Repeat step 8 but factor the previous lightgem value in the biasing (make sure that the brightest value wins)

Step 12) Return to the standard view

 

The only raycasting we do is for AI looking at the targets. The light-level is derived via rendering a simplified version of the scene

at a low resolution to a PBO.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

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

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • 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.
      · 4 replies
    • 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
×
×
  • Create New...