Jump to content

Question: about how to render many projected lights - without losing to much performance


photo

Recommended Posts

Hello,

 

I have some questions about a solution to render many projected lights and perhaps there is an alternative approach.

 

Right now, our general approach for lighting is divided into:

  • Point Lights (created as Billboards)
  • Spot Lights (currently as Projected Lights)

 

For the Point Lights, we tend to have quite high numbers in the visualized scenes (up to 60.000), and we have solved that pretty well so far, thanks to your support.

 

For the Spot Lights, we decided for an approach where we use Projected Lights and render them in to a light map, which is used by a single Projected Light.  This new projected light is placed 25.000 units above ground and has the light map assigned.  While this gives us the performance boost we want to see with the high number of projected lights we have, it comes with a disadvantage: We lose the information about the original source position of the projected lights used, thus everything is illuminated, even though it would be physically above the light source (of the original projected light used to create the light map).  Please note that we also need to update that light map dynamically, as we need to support switching some of the light points off and on dynamically, based on user input.

 

I have created some sample data (image and video) to visualize the problem, see :

problem.thumb.png.03641e0aa2b18ce20c4826c8dc2af903.png

overview:

overview.thumb.png.363f7fb32cc7bfda201226c420122e2c.png

 

Do you have suggestions of how to encode the source position (height) of the projected light into the light map to avoid illuminating objects that shouldn’t be?  Or do you have other possible solutions?

 

Looking forward to your feedback!

 

Regards,

Sascha

Link to comment

Hello Sascha,

Quote

For the Spot Lights, we decided for an approach where we use Projected Lights and render them in to a light map, which is used by a single Projected Light. 

Have you tried using real ProjectedLight in the NodeReference for each street light?

Engine can handle thousands of lights with shadows turned off.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Morbid, do you mean, the lights do perform better when they are node references themselves?

I have a lot of lights as well and they dont perform well as I copiied the lights in the editor.

Does it make a difference if I create a node reference and copy this reference?

Thx.
W.

Link to comment
Just now, werner.poetzelberger said:

Morbid, do you mean, the lights do perform better when they are node references themselves?

Engine batches lights quite good, however, it is viable only with the shadows turned off. I mentioned NodeReferences because it's easier to scatter them via Landscape Tool.

2 minutes ago, werner.poetzelberger said:

I have a lot of lights as well and they dont perform well as I copiied the lights in the editor.

What numbers and settings are we talking about?

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

About 50 Lights. Distances are between 200 and 500 as I need reflections in the water. They all dont have shadows turned on.

Mainly Omni lights and some Projected.

Ja, okay. 50 are not a lot, but I wonder if it is better as NodeReferences compared to actual copies.

 

Edited by werner.poetzelberger
Link to comment
57 minutes ago, morbid said:

Hello Sascha,

Have you tried using real ProjectedLight in the NodeReference for each street light?

Engine can handle thousands of lights with shadows turned off.

Thanks!

Hello morbid,

i think this is not applicable. 

i profiled this, please see attached the results:

baked:

baked.thumb.png.9724248a378db886915cc16d75dd17de.png

not baked:

non_baked.thumb.png.4a63b1abeb4d07e3edc46bec616abfcd.png

 

Regards,

Sascha

Link to comment
45 minutes ago, werner.poetzelberger said:

Ja, okay. 50 are not a lot, but I wonder if it is better as NodeReferences compared to actual copies.

With water and decent amount of transparent materials these lights optimizations are vanishing quickly :)

It's still possible to use in some cases thousands of lights.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

@sascha.schneider, @werner.poetzelberger

I was wrong about projected lights, sorry. Batching optimizations works for Omni Lights only.

For terrain and lights there are three possible solutions:

  1. Investigate how omni lights will work (shadows turned off)
  2. Consider using low-res Voxel Probe for light spots on the ground. Main drawback is the texture bake time.
  3. With the current approach it wouldn't work as you expect, unfortunately. There's no right way to mask some object from being lit up with a light source. You can try this hack:
    1. Go to material's state tab and change its Normal maps to "Object space" and enable normal rotated to camera flag. This will cause visual artifacts, but the mesh will be unlit.

I suggest researching first option thoroughly, it looks better than others for now. Omni lights will not provide the same visuals, but you can combine them with smaller number of projected lights. For instance, you can use projected lights only at the airport.

By the way, is it 2.11?

Thanks.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
1 minute ago, morbid said:

@sascha.schneider, @werner.poetzelberger

I was wrong about projected lights, sorry. Batching optimizations works for Omni Lights only.

For terrain and lights there are three possible solutions:

  1. Investigate how omni lights will work (shadows turned off)
  2. Consider using low-res Voxel Probe for light spots on the ground. Main drawback is the texture bake time.
  3. With the current approach it wouldn't work as you expect, unfortunately. There's no right way to mask some object from being lit up with a light source. You can try this hack:
    1. Go to material's state tab and change its Normal maps to "Object space" and enable normal rotated to camera flag. This will cause visual artifacts, but the mesh will be unlit.

I suggest researching first option thoroughly, it looks better than others for now. Omni lights will not provide the same visuals, but you can combine them with smaller number of projected lights. For instance, you can use projected lights only at the airport.

By the way, is it 2.11?

Thanks.

Yes it is 2.11, sorry for not mentioning it. 

Thank you for your investigation. I think option 3 -1  is not applicable, visual artifacts are not an option. For the other approaches  i will need some time to go through.

 

Many thanks for the quick answer and the solutions,

Sascha

Link to comment
×
×
  • Create New...