Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jasr_88 · Dec 27, 2019 at 12:31 AM · lightaugmented-reality

How do i get the correct light estimation in AR Foundation?

Hello, i'm working on a AR application and i try to implement the light estimation feature, nevertheless, a few months ago the information given by the ARCameraFrameEventArgs variable became a little weird:

lightEstimation: ( Avg. Brightness: 0.5368686, Avg. Color Temperature: , Color Correction: RGBA(1.013, 1.000, 0.953, 0.537), Avg. Intensity in Lumens: 1073.737)

Even if I focus my camera directly to the sun the "Avg. Brightness" value is never greater than 0.6, and the Color Correction values are too high for a RGBA form 0 to 1 and too low for a RGBA from 0 to 255.

i'm very confused since my app was working fine a few months ago, but now even the sample scene gives me this outputs in android and iOS.

this is the code i'm using (based on the AR foundation examples)

 using UnityEngine;
 using UnityEngine.XR.ARFoundation;
 
     public class LigthEstimation : MonoBehaviour {
          [SerializeField] private ARCameraManager arCameraManager;
          private Light mainLight;
     
          public float? Brightness { get; private set; }
          public float? ColorTemperature { get; private set; }
          public Color? ColorCorrection { get; private set; }
     
          private void Awake () {
               mainLight = GetComponent<Light> ();
          }
     
          private void OnEnable () {
               arCameraManager.frameReceived += FrameUpdated;
          }
     
          private void OnDisable () {
               arCameraManager.frameReceived -= FrameUpdated;
          }
     
          private void FrameUpdated (ARCameraFrameEventArgs args) {
               if (args.lightEstimation.averageBrightness.HasValue) {
                    Brightness = args.lightEstimation.averageBrightness.Value;
                    Debug.Log (">>>>" + Brightness.Value);
                    mainLight.intensity = Brightness.Value;
               }
     
               if (args.lightEstimation.averageColorTemperature.HasValue) {
                    ColorTemperature = args.lightEstimation.averageColorTemperature.Value;
                    Debug.Log (">>>>" + ColorTemperature.Value);
                    mainLight.colorTemperature = ColorTemperature.Value;
               }
     
               if (args.lightEstimation.colorCorrection.HasValue) {
                    ColorCorrection = args.lightEstimation.colorCorrection.Value;
                    Debug.Log (">>>>" + ColorCorrection.Value);
                    mainLight.color = ColorCorrection.Value;
               }
          }
     
     }

am i doing something wrong?

i'm using ARFoundation 2.2.2 (From Package Manager) in unity 2019.1.14f1 i'll appreciate any information

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Jasr_88 · Feb 27, 2020 at 11:27 PM

Well turns out that they modified this feature to include some others values like Light Direction and sphericalHarmonics now in ARFoundation Version 3.1.0 (preview4) the LightEstimation object have the following properties:

 LightEstimation.brightness
 LightEstimation.colorTemperature
 LightEstimation.colorCorrection 
 LightEstimation.mainLightDirection 
 LightEstimation.mainLightColor 
 LightEstimation.mainLightIntensityLumens 
 LightEstimation.sphericalHarmonics

As you can see, this is much more infromation than the given in the former versión (2.2.0 for example):

 Avg. Brightness
 Avg. Color Temperature
 Color Correction 
 Avg. IntensityInLumens

So if you where using a script similar to the showed in this tutorial:

https://youtu.be/nw6-U_mSvQQ

now instead of use colorTemperature or colorCorrection values for your main ligth, we need to use LightEstimation.mainLightColor and LightEstimation.mainLightDirection to achieve the desired effect

The problem is not thecnical or a bug is just the lack of documentation

Now days the example on https://github.com/Unity-Technologies/arfoundation-samples is working with this features, so now we have to hope that the code remains working the same way, or if its modified, wait 3 monts for a working example on the official repo.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

128 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

LightEstimation Values in AR Foundation 0 Answers

Cloud recognition in Vuforia 0 Answers

Directional light - Help 0 Answers

Need help with Flashlight Script 1 Answer

light intensity change with easing problem!! 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges