joshcamas Posted April 26, 2015 Share Posted April 26, 2015 Hey guys! Is it possible to get the light level in a certain area/position? I'm needing this for my stealth-based game! I'm also thinking of making it so in the dark people's pupils dialate, and in the light they shrink. Just for fun! xD Thanks! Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 26, 2015 Share Posted April 26, 2015 What do you mean by level of light? intensity according to the position? Sorry, I sometimes have trouble read depending my translator translates in French. Quote Link to comment Share on other sites More sharing options...
joshcamas Posted April 26, 2015 Author Share Posted April 26, 2015 intensity according to the position sounds correct, yeah! Quote Link to comment Share on other sites More sharing options...
Temechon Posted April 27, 2015 Share Posted April 27, 2015 I don't think it is possible right now Quote Link to comment Share on other sites More sharing options...
jahow Posted April 27, 2015 Share Posted April 27, 2015 Hey, Light is computed through vertex and fragment shaders, so the actual information is not really accessible outside of that. Depending on how your scene is set up and the type of your active lights, you can probably find out if a point is illuminated by casting a ray from this point to the active(s) light source(s), and see if that ray intersects something. If the ray does not collide with anything, then you can modulate the light level by distance for example. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 27, 2015 Share Posted April 27, 2015 Yes, you can probably create a function that approximately augmenteras the intensity of light depending on the distance. it is for you to create your own formula calculates and to experiment. Quote Link to comment Share on other sites More sharing options...
jerome Posted April 27, 2015 Share Posted April 27, 2015 I guess you are talking about spotlight or pointlight ? (as directional and hemispheric lights have infinite range, so constant intensity : http://babylondoc.azurewebsites.net/page.php?p=22071 ) Maybe you can simulate the local light intensity according to the distance of your mesh from the light origin (and/or the light decay if any) if nothing intersects the raylight between the mesh and the light origin. [EDIT] ooops, this duplicates Jahow's post, sorry. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.