Announcement

Collapse
No announcement yet.

Help with ray tracing based on light intensity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with ray tracing based on light intensity

    Hi all. I'm starting to work on a stealth game prototype for a personal project. I'm wondering how can I achieve getting hit results based on the intensity of light? In other words, I'd like to keep my playable character hidden when he is in the shadows. He can't be detected from far, but if the enemy closes in, depending on the dynamic change in lighting, the enemy may or may not be able to see the player character. I guess, to help me get started with it, this is all I'd like to research on for now and as I build up on it, I might come up with more question.

    #2
    Originally posted by paploo View Post
    Hi all. I'm starting to work on a stealth game prototype for a personal project. I'm wondering how can I achieve getting hit results based on the intensity of light? In other words, I'd like to keep my playable character hidden when he is in the shadows. He can't be detected from far, but if the enemy closes in, depending on the dynamic change in lighting, the enemy may or may not be able to see the player character. I guess, to help me get started with it, this is all I'd like to research on for now and as I build up on it, I might come up with more question.
    +1, I've seen solutions to check whether or not a light source is directly shining on the player, but Id like to know more about the specific lighting intesity.
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      Would it kind of be a distance thing?
      As light intensity decreases the further you are from a source of light.
      YouTube Playlist of W.I.P game project - https://www.youtube.com/playlist?lis...XCXMLFckHVo_bV (May contain swearing, I'm Irish :P)

      Comment


        #4
        Inverse square fall off (assuming it's not the sun):

        intensity = 1/distance^2, then multiply by the current brightness of the light source actor itself to get something to work with.

        Comment


          #5
          This is what I did, the intensity variable is just a variable that controls the intensity of the light.
          Click image for larger version

Name:	lightvalue.png
Views:	1
Size:	117.1 KB
ID:	1080342

          Comment


            #6
            Thanks, I'm going to try this and update here with the progress.

            Comment


              #7
              So, I got this to work.
              Here's how I did it.
              Click image for larger version

Name:	DtUbBD9.png
Views:	1
Size:	310.5 KB
ID:	1080413

              And surprisingly the same works with Directional light as well.
              Click image for larger version

Name:	eYKnnMD.png
Views:	1
Size:	345.1 KB
ID:	1080414
              Last edited by paploo; 06-24-2015, 02:29 AM.

              Comment

              Working...
              X