Baked lighting (static object) in an AR Scene

From a great example video posted by @djayboy007007 , I noticed someone figured out how to place a static (baked lighting) object in an AR scene - how is this do-able?

I have always had the issue of the object needing to be marked as static which means it is not able to be placed or moved (obviously) in AR - any tips?

@rob_ice you need to check the object to be static and then baked the objects into prefabs. see below link for doing it

https://www.youtube.com/results?search_query=baking+prefabs

1 Like

Is this a problem if you are using the MakeContentAppearAt and moving the session origin? ie. you are not moving your static objects, but moving the AR Session Origin instead?

Thankyou! Neat workaround, will definitely be using that

If you guys are struggling to use baked Game Objects, it’s straightforward. Just change the placement script to set inactive game objects as active instead of placing prefabs. In the Update() function, when you instantiate a game object, you just activate your game object, and that’s it.

1 Like

You can set your content as non static and tick only static “Lighting static” options in the dropdown. This way you can bake lighting and still move the object. If you rotate you object relative to your light source then the lighting will obviously not update and be wrong.
Also note that static batching will not work with this approach.

We had a project where we wanted to move a complete scene inside our AR application (animated)
The main problem with the above approach is, that static batching will not work. This had an unbearable performance impact in our case. Our solution was quite simple. Tick everything in the static dropdown except “Batching static”.

Place this script at the root object of the static object group:

public class StaticMeshCombiner : MonoBehaviour
{
    private void Awake()
    {
        StaticBatchingUtility.Combine(gameObject);
    }
}

Now you can move the root object (not the chilrden) and static batching will still work.

Hope this helps!

Greetings
MSQ Tobi

4 Likes