[null,null,["อัปเดตล่าสุด 2022-09-26 UTC"],[[["\u003cp\u003eThe Lighting Estimation API analyzes images to understand scene lighting, allowing virtual objects to be rendered realistically within the scene.\u003c/p\u003e\n"],["\u003cp\u003eThis API enhances realism by mimicking lighting cues such as shadows, ambient light, shading, specular highlights, and reflections.\u003c/p\u003e\n"],["\u003cp\u003eTwo primary modes are available: \u003ccode\u003eENVIRONMENTAL_HDR\u003c/code\u003e for detailed lighting estimation and \u003ccode\u003eAMBIENT_INTENSITY\u003c/code\u003e for basic lighting adjustments.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eENVIRONMENTAL_HDR\u003c/code\u003e uses machine learning to analyze directional lighting, ambient spherical harmonics, and HDR cubemap for realistic rendering.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAMBIENT_INTENSITY\u003c/code\u003e estimates average pixel intensity and color correction for simpler use cases or objects with baked-in lighting.\u003c/p\u003e\n"]]],["The Lighting Estimation API enhances realism in AR by analyzing image lighting and providing data to mimic visual cues like shadows, ambient light, shading, specular highlights, and reflections. It offers modes like `ENVIRONMENTAL_HDR`, which utilizes directional lighting, ambient spherical harmonics, and HDR cubemaps for accurate object rendering, and `AMBIENT_INTENSITY` for simpler, less precise lighting. Developers configure these modes by overriding the `Config.LightEstimationMode` setting. These different settings help virtual objects fit more naturally into the real-world environment.\n"],null,["# Using Lighting Estimation with Sceneform models\n\nThe **Lighting Estimation** API analyzes a given image for discrete visual cues\nand provides detailed information about the lighting in a given scene. You can\nthen use this information when rendering virtual objects to light them under the\nsame conditions as the scene they're placed in, making these objects feel more\nrealistic and enhancing the immersive experience for users.\n\nLighting cues and concepts\n--------------------------\n\nHumans unconsciously perceive subtle cues regarding how objects or living things\nare lit in their environment. When a virtual object is missing a shadow or has a\nshiny material that doesn't reflect the surrounding space, users can sense\nthe object doesn't quite fit into a particular scene even if they can't explain\nwhy. This is why rendering AR objects to match the lighting in a scene is\ncrucial for immersive and more realistic experiences.\n\nLighting Estimation does most of the work for you by providing detailed data\nthat lets you mimic various lighting cues when rendering virtual objects.\nThese cues are **shadows** , **ambient light** , **shading** , **specular\nhighlights** , and **reflections**.\n\nWe can describe these visual cues like this:\n\n- **Ambient light.** Ambient light is the overall diffuse light that comes in\n from around the environment, lighting everything.\n\n- **Shadows.** Shadows are often directional and tell viewers where light sources\n are coming from.\n\n- **Shading.** Shading is the intensity of the light in different areas of a\n given image. For example, different parts of the same object can have\n different levels of shading in the same scene depending on angle relative to\n the viewer, and its proximity to a light source.\n\n- **Specular highlights.** These are the shiny bits of surfaces that reflect a\n light source directly. Highlights on an object change relative to the\n position of a viewer in a scene.\n\n- **Reflection.** Light bounces off of surfaces differently depending on whether\n the surface has specular (that is, highly reflective) or diffuse (not\n reflective) properties. For example, a metallic ball will be highly specular\n and reflect its environment, while another ball painted a dull matte grey will\n be diffuse. Most real-world objects have a combination of these properties --\n think of a scuffed-up bowling ball or a well-used credit card.\n\n Reflective surfaces also pick up **colors** from the ambient environment. The\n coloring of an object can be directly affected by the coloring of its\n environment. For example, a white ball in a blue room will take on a bluish\n hue.\n\nUsing Lighting Estimation modes to enhance realism\n--------------------------------------------------\n\nThe [`Config.LightEstimationMode`](/ar/reference/java/arcore/reference/com/google/ar/core/Config.LightEstimationMode) API has\nmodes that estimate lighting in the environment with different degrees of\ngranularity and realism.\n\n- [Environmental HDR mode](#sceneform-ehdr) (`ENVIRONMENTAL_HDR`). This mode\n consists of an API that allows realistic lighting estimation for directional\n lighting, shadows, specular highlights, and reflections.\n\n- [Ambient Intensity mode](#ambient-intensity) (`AMBIENT_INTENSITY`). This\n mode determines the average pixel intensity and the color of the lighting for\n a given image. It's a coarse setting designed for use cases in which precise\n lighting is not critical, such as objects that have baked-in lighting.\n\n- `DISABLED`. Disable `Config.LightEstimationMode` if lighting to match a\n given environment is not relevant for a scene or an object.\n\n | **Note:** When your app is using `Config.LightEstimationMode`, only significant changes to lighting or positioning of the device trigger updated effects.\n\n### Using `ENVIRONMENTAL_HDR` mode\n\n**`ENVIRONMENTAL_HDR`** mode uses machine learning to analyze the input\ncamera image and synthesize environmental lighting for rendering a virtual\nobject.\n\nThis mode combines directional lighting, ambient spherical harmonics, and an\nHDR cubemap to make virtual objects feel like they're physically part of a\ngiven scene:\n\n- **Directional lighting** analyzes the apparent light source for a given image.\n This kind of lighting adds reasonably positioned specular highlights, and\n casts shadows in a direction consistent with other visible real objects.\n\n- **Ambient spherical harmonics** get a realistic representation of the overall\n ambient light coming in from all directions in a scene. During rendering,\n this information is used to add subtle cues that bring out the definition of\n virtual objects.\n\n- An **HDR cubemap** captures the environmental lighting surrounding the virtual\n object. During rendering, this cubemap creates the reflection for the medium\n to high glossiness material.\n\nThe following image shows an example of a virtual object placed in a scene\nwith `ENVIRONMENTAL_HDR` enabled.\n\n#### Configure `ENVIRONMENTAL_HDR` mode for a Sceneform scene\n\nTo use `ENVIRONMENTAL_HDR` with a Sceneform scene, extend the `ARFragment`\nclass, and override the configuration as follows: \n\n @Override\n protected Config getSessionConfiguration(Session session) {\n Config config = new Config(session);\n config.setLightEstimationMode(Config.LightEstimationMode.ENVIRONMENTAL_HDR);\n return config;\n }\n\nTo see an example of how this works, see the [Solar System sample](//github.com/google-ar/sceneform-android-sdk/tree/v1.15.0/samples/solarsystem). (This sample implements\n`ENVIRONMENTAL_HDR` without using `ARFragment`.)\n\n### Using `AMBIENT_INTENSITY` mode\n\n`AMBIENT_INTENSITY` mode determines the average pixel intensity and the\ncolor correction scalars for a given image. It's a coarse setting designed for\nuse cases in which precise lighting is not critical, such as objects that have\nbaked-in lighting.\n\n- **Pixel intensity** captures the average pixel intensity of the lighting in a\n scene, for applying to a whole virtual object.\n\n- **Color correction scalars** detect the white balance for each individual\n frame, and allows you to color correct a virtual object so that it integrates\n more smoothly into the overall coloring of a scene.\n\n#### Configure `AMBIENT_INTENSITY` mode for a Sceneform scene\n\nTo use `AMBIENT_INTENSITY` with a Sceneform scene, extend the `ARfragment`\nclass, and override the configuration as follows: \n\n @Override\n protected Config getSessionConfiguration(Session session) {\n Config config = new Config(session);\n config.setLightEstimationMode(Config.LightEstimationMode.AMBIENT_INTENSITY);\n return config;\n }"]]