When using .receivedLighting on an arView.environment in RealityKit it does not show lighting - arkit

I noticed that an arView (RealityKit) has the option insert: arView.environment.sceneUnderstanding.options.insert(.receivesLighting)
with .receivesLighting description it state: The .receivesLighting option means that the virtual lights will interact with real world surfaces causing them to shine. The properties of the mesh will be set to a default material.
This would mean it is possible to relight the real world. It is also indicated in apple's talk: https://developer.apple.com/videos/play/tech-talks/609/
However, experimenting with it and having a directional light and/or spotlight added to the AR environment will have no influence on the real-world surfaces. I am using iPad Pro/iphone Pro with LIDAR.
Any idea why not?

Related

How to optimize lights in Unity

I'm building a virtual exhibition platform in unity. There are about 50 stalls and I used a directional light and 124 point lights light up the scene. I didn't use any real time lighting, only baked lighting is used. But at runtime frames get dropped. when I inactivate all pointlights it works smoothly. How can I optimize lights?
You can improve your performance by doing the following,
Add Light Probes, this can minimize the number of point lights in use.
Change Render Mode to Auto, this will reduce the load significantly in your case as there are a lot of point lights in use.
Apply a culling mask, make sure the light affects only the required object in the stall.
Use Fake Shadow instead of using Soft Shadow.
Switch to URP or HDRP.
Alternate way :
Build and bake each stall separately in Blender or Maya. Then add them to unity. This way you don't need to add that many point lights and bake.
124 Point Lights that is a LOT of lights, but you could use Deferred Rending path on your Camera (but if you need VR I'm not sure its supported).. You can set the Point Lights to be Baked, use Baked lighting and light probes instead. Set everything that won't move in your scene to be Static objects (very top right corner box). also remember to go into Rendering -> Lighting and Generate the Lighting and look at the options presented there.
Light probes video

Light Baking Issue

Before I have real-time lighting because of the performance issue, I decided to do light baking for my 3d game.
So I have mark 3d environment as static because it remains on screen always without movement.
Also changed direction light mode to Mixed because I have few moving game objects too.
But after the baking process gets completed, I got this kind of output:
In above, you can see in the above image what happened with my environment after baking and I have also included light settings if you need it.
You have to enable lightmap UVs in your 3d imported model file.
I got this reply from one Unity forum member so exact wording, I am posting here:

What is the proper way to light a scene for the Hololens?

We have built an app for the Hololens that has 1 or 2 3D characters in the scene at any given time. What is the best practice for adding lighting to an AR scene for headsets like the Hololens? Should the scene be lighted at all?
So here's the thing with the Hololens:
Black is Transparent
This means that any shadows on objects will make the object fade out into transparency when viewed on the real device (the emulator does not show simulated environments). As such, environments should be brightly lit from a source that is a child of the main camera (you may still use a directional light pointing from above angle) and objects should not cast shadows (as it will appear that those shadows are punching holes in objects).
This also means that you will want textures that are brightly colored as well.
Brightly lit (real world) backgrounds will exacerbate the transparency effect (as the Hololens can't reduce incoming light).
You'll likely have to experiment to find something that works best for your project.

How to mask 3D Objects with Real-World-Objects in front of them? (Tango, Unity)

All the Tango Apps and Demos I have seen so far have one major limitation: 3D-Objects are always "on top" of the real world camera image. They are placed correctly in 3D space but a real object in front of the virtual object will not overlap it!
Question:
Is it possible to mask 3D objects or parts of them in realtime by real world objects in front of them?
In theory the 3D data deliverd by Tango sensors should be sufficient to do this. But I wonder if anyone has done it before or if there might be performance limitations that make this impossible? Thanks for your advice!
One approach is to use the 3D Reconstruction library (search "Unity How-to Guide: Meshing with Color") to pre-scan the environment, and then use this model to provide depth data when rendering the AR scene. Here's a video of an AR game that appears to use this technique. It's not perfect for sure, but it does sorta work.
This questions has been asked before.

Lighting an instantiated prefab, baked versus realtime

I'm generating a dungeon out of prefabs which means I design a room, save it in the resource folder and instantiate it at a random position with a random rotation while the game is running.
The problem I have is the lighting.
Because of the above mentioned generation process it has to be dynamic but it doesn't seem to work. Below you can see the comparison between a baked and realtime rendered room:
Baked (I also don't know where these strange lighting borders (on the walls), which are looking like someone painted the light with watercolors are coming from):
Realtime:
As you can see, the realtime room doesn't seem to reflect light in any way.
These are my lighting settings:
And this is my 'sun':
What am I doing wrong?
Your lighting settings have Ambient Light set to 0- with realtime lighting, this means nothing that can directly see the source of a light will be lit at all. The screenshot with baked lighting looks different because it has a baked lightmap.
If you're trying to get the real-time lighting to look exactly like the baked, soyy, but Unity refuses to bake lightmaps at runtime. The closest you can probably get is by setting your Ambient Light to a color and its intensity above zero. Playing around with Light Probes probably won't be much good, since you need to light an entire room in a vacuum.
An alternate solution, depending on how well you know Unity, would be to Frankenstein together different scenes, which is mentioned briefly in Unity's Intro to Global Illumination, though I can't find it anywhere else.
Relevant links:
Baked Lightmaps: http://docs.unity3d.com/Manual/GIIntro.html
Light Probes: http://docs.unity3d.com/Manual/LightProbes.html
Ambient Light: http://docs.unity3d.com/Manual/GlobalIllumination.html