Jump to content


Photo

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

lightgem

  • Please log in to reply
5 replies to this topic

#1 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 8685 posts

Posted 30 May 2018 - 11:53 AM

Check this out:

https://www.youtube....Wk#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.thedar...ystem-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://stackoverflo...ss-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.c...y_the_dark_mod/
  • Bikerdude and ERH+ like this
Please visit TDM's IndieDB site and help promote the mod:

http://www.indiedb.c...ds/the-dark-mod

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

#2 demagogue

demagogue

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 5356 posts

Posted 31 May 2018 - 04:59 AM

Imitation is the sincerest form of flattery.


  • Bikerdude likes this
Posted Image

#3 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 19851 posts

Posted 31 May 2018 - 05:28 AM

Does that mean that TDM is now the new measuring paradigm when it comes to the first person stealth..?



#4 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1266 posts

Posted 31 May 2018 - 05:46 AM

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.



#5 Abusimplea

Abusimplea

    Member

  • Member
  • PipPip
  • 341 posts

Posted 31 May 2018 - 11:37 AM

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?



#6 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 8685 posts

Posted 31 May 2018 - 11:58 AM

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.c...ds/the-dark-mod

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





Also tagged with one or more of these keywords: lightgem

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users