traclabsar Posted January 16, 2020 Share Posted January 16, 2020 I have a Unity application that needs to record pupil dilation as an indicator of user stress levels. For this to be meaningful, it needs to be normalized relative to scene luminosity. I don't see any obvious way to measure overall luminosity short of adding up all the pixel values and dividing by the number of pixels. Is there system parameter that provides this value or an API call that does that calculates it? Link to comment Share on other sites More sharing options...
Corvus Posted January 16, 2020 Share Posted January 16, 2020 @traclabsar There is no system parameter or API that does this but it's possible to implement yourself. Here is a suggested solution: " The usual solution to this problem is to render the scene to a low res (like 4x4 or 8x8) texture/render target. Then you have the CPU loop over all the pixels in that texture and compute the average brightness." Source: https://answers.unity.com/questions/640447/detect-brightnessdarkness-of-a-scene.html Note: For performance reasons you probably don't want to measure all of the pixel values, it should suffice to render a low res texture. Link to comment Share on other sites More sharing options...
TheCervixClimber Posted November 1, 2021 Share Posted November 1, 2021 (edited) @traclabsarI was wondering whether you managed to implement the brightness measurement? I am in the exact situation you where last year. Looking forward to your reply! Edited November 1, 2021 by TheCervixClimber Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now