Hybrid Renderer V2: Light probes not working on entities

Hello,
I use Hybrid Renderer 0.11.0 + URP 11.0.0 in my project.
It says here that for this combination light probes are supported.

But my light probes are only working on GameObjects, not entities. Do I have to add maybe a component to my entity to get it to work?

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.

1 Like

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):
7806540--986928--gameobject.PNG

When I move the cube into the subscene, it gets the BlendProbeTag like you said automatically, but still does not work :face_with_spiral_eyes: (in GameWindow):
7806540--986925--entity.PNG

And thats my light probe group (within subscene):
7806540--986934--upload_2022-1-13_19-37-36.png

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.

1 Like

Yap I see them at run time on my entity:

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.

1 Like

The sample scenes in HybridURPSamples in GitHub - Unity-Technologies/EntityComponentSystemSamples should contain a simple example of light probe usage.

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.

1 Like

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! :slight_smile:

But now the drawback is, that dynamic entities are pretty dark in the scene (obviously) :face_with_spiral_eyes:

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 :eyes:

100000001218704--1121384--clear.png

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.

Oh, then my experience was always the wrong/buggy one :smile:
But yep, this behaviour sounds way more reasonable actual

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?

(I’m on Entities 0.17.0; URP 10.3.2; HR V2 0.11.0-preview44. Unity 2020.3.11f1)

@Arnold_2013 Nope, I gave up.
But maybe it works with the new versions 0.50? I didn’t give it a try yet

1 Like

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 :rage:). The satellite dish is a game object. Everything looks fine - the point light on the lamp affects the dish and it casts a shadow.
8555975--1144292--upload_2022-11-1_18-33-58.png

Here it is after I attach convert-to-entity to the satellite dish and press play:

8555975--1144295--upload_2022-11-1_18-37-40.png

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)

8555975--1144298--upload_2022-11-1_18-39-7.png
Same result as with convert-to-entity.

Here’s the scene without the lamp

8555975--1144310--upload_2022-11-1_18-47-24.png
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.

1 Like

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

Its in the Docs, so no it might not be limited ;-). https://docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.51/manual/hybrid-renderer-versions.html

8558888--1144880--upload_2022-11-3_8-2-28.png
8558888--1144877--upload_2022-11-3_8-2-18.png

1 Like

But it was limited some time ago, don’t know if its changed already: No lights when using Hybrid Renderer 0.4.2

1 Like

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.

3 Likes

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.