If you convert from GameObjects or use RenderMeshUtility.AddComponents, the required components should get added automatically. If not, you should add one of AmbientProbeTag, BlendProbeTag or CustomProbeTag.
Thanks for your reply @JussiKnuuttila !
Unfortunately this still does not work. I tried it with a very simple cube (lit material).
As Gameobject (in GameWindow):
When I move the cube into the subscene, it gets the BlendProbeTag like you said automatically, but still does not work (in GameWindow):
And thats my light probe group (within subscene):
The object which is throwing the shadow is also in the subscene and static (via lightmap).
And the directional light (just 1) is outside the subscene and not an entity.
Do you see the SH coefficient components (BuiltinMaterialPropertyUnity_SHAr) on the entity at run time? Those should get added automatically by the light probe system. If those are missing, that would cause light probes to not work.
Btw I also use SRP and Unity 2021.1.15f1. But I guess there are still so many variables… so many potential things I may do wrong. Is there maybe an example project for light probes & ecs?
Reading through your message again, it’s possible that the issue is related to the shadow caster also being inside the subscene.
There is a known limitation in the current version, where light baking (both light maps and light probes) is unable to take entities into account during baking. To work around this, light baking should be performed with all subscenes opened so the source GameObjects are visible to the light baking. The resulting light maps and probes should then be usable by the entities when the subscenes are closed again.
It’s also worth noting that 2021.1 is not an officially supported Unity version with Hybrid Renderer or DOTS, so it is possible that using it will cause extra problems.
Thanks @JussiKnuuttila !
I tested the Unity example for Light Probes, this time with the correct Unity Version.
But for me, I needed light probes mainly for shadows, and these lightmaps in the example did not include any shadows thrown by these spheres.
I could only bake them, if I changed the light-mode to “baked”. In my own project with Unity 2021.1 it worked also with “mixed”. But at least, with this mode (baked) the light probes for shadows finally worked -also for my own project!
But now the drawback is, that dynamic entities are pretty dark in the scene (obviously)
And something not related to the topic: In the example project I encountered the problem that the objects from the subscene are still visible in the scene view (the spheres), even when the subscene was closed
If the subscene is closed, then any objects in it are converted to entities and are rendered in the scene view as entities, using Hybrid Renderer. Opened subscenes are rendered either as GameObjects (authoring state) or entities (runtime state) depending on LiveLink settings.
Thx for the post, I ran into the same issue. Using “baked” lightsource the light probes work, but now my dynamic objects don’t cast shadows anymore.
Have you by any chance found a way to get mixed light to work with light probes?
This is weird. I have tried all kinds of settings, but for the life of me, I cannot get lighting to apply to entities that are in subscenes.
Below is a lamp prefab in subscene that has a point light source attached to it. The terrain is a game object (because DOTS has no solution for terrain yet ). The satellite dish is a game object. Everything looks fine - the point light on the lamp affects the dish and it casts a shadow.
Here it is after I attach convert-to-entity to the satellite dish and press play:
Yuck. The light clearly doesn’t work on the satellite dish entity, but it works fine on the terrain game-object. Strangely, the shadow is being cast by the lamp though.
Now here’s the scene with the satellite dish in a subscene (with the subscene closed or in play-mode)
Same result as with convert-to-entity.
Here’s the scene without the lamp
You can see that the shadow is being cast by the sun instead of the lamp. So why do shadows cast by point lights work on entities, but the entities don’t reflect the point light?
I’m using entities 0.51 and I’ve tried for hours tweaking settings trying to find something that works. Tried with and without light probes, real-time and baked light maps, and so many other things.
For URP you are only allowed 1 realtime directional light. All other lights don’t work. (they work on terrain, because its a game object). I don’t use HDRP, but there multiple lights are allowed I think.
I am using a point light for the lamp - not a directional one. Are you sure about that limit? I thought the URP limitation was something like a max of 4 (some people say 8?) light contributions per mesh and 256 per camera. So whenever an object is rendered it use the 4 closest light sources and ignore any other lights that are in range. In my example above, I have one directional light (the sun) and one point light. So it seems to me that satellite dish should be lit by the lamp’s point light.
But something is preventing the lamp from contributing to the light of meshes on entities… and allowing it for meshes on game objects. It’s strange.
If you using 2021LTS or later and using Deferred Rendering (as opposed to Forward Rendering) you aren’t limited to 1 realtime directional light and can use point lights with URP
DOTS 0.51 does not officially support local lights with URP.
Entities 1.0 will officially support local lights in URP, but only when the URP Forward+ rendering mode is used. The rendering mode can be selected in the URP Renderer Asset.
With both versions, URP Deferred might partially work. What is likely to happen is that basic lighting and shadows will work, but reflection probes do not. Also, it is important to note that this combination is not officially supported.
The reason behind all of this is that URP relies on the same built-in light lists and reflection probe setup as the built-in render pipeline does. This special built-in setup is built around GameObjects, and is incompatible with the BatchRendererGroup rendering path that is used by Entities Graphics. One reason for this is that such setup requires position information for each rendered instance, which is not always available with BatchRendererGroup.
Both HDRP and URP Forward+ implement lighting completely in screen space, without requiring special per-object setup, which is why they are the fully supported modes. URP Deferred uses screen space lighting, but still uses the built-in reflection probes, so those will not be correctly applied.
Thanks JussiKnuutila. Switching to URP deferred got the basic lighting and shadows working for my entities, and for now I’m not too concerned about reflection probes. I didn’t know about the deferred mode until now, and I like the idea that it uses hardware acceleration to improve speed - so I hope that sometime soon after 1.0, deferred mode will be supported as well.