FeralCompany / FeralMinimap

MIT License
0 stars 0 forks source link

Conflict with CullFactory due to usage of light culling masks #10

Open Zaggy1024 opened 3 months ago

Zaggy1024 commented 3 months ago

tl;dr: I'd recommend using RenderPipelineManager.beginCameraRendering event to modify the visibility of lights based on the camera being rendered instead of using culling masks, both to avoid conflicts with any other mods that decide to make use of the two unused layers, and to allow CullFactory to use culling masks to cull lights freely.

I got a report that CullFactory was printing some warnings from this line, and it turned out to be FeralMinimap's lights were causing it. It seems like it must be this line causing it to print that warning when the radar map's night vision light changes visibility, but it also prints a few other warnings for the other lights that are included in FeralMinimap.

CullFactory currently assumes that the Light.cullingMask property isn't touched by any other mods, since it's not available in the editor with HDRP, and therefore is unused by the base game and most mods. This allows it to avoid keeping track of the original culling mask for all the lights in the scene, when most or all of them will have 0xFFFFFFFFF as their mask. Light.enabled was my first choice for this, but for whatever reason, all the lights in the vanilla mansion interior are forcibly enabled every frame, so I had to switch to the culling mask instead.

With regard to using the last two unused layers, I was initially going to do the same for TwoRadarMaps until I found out about rendering callbacks that let me sidestep the issue of conflicts. I know that when people were working on mods that require a third person view (like the mirror mod), they initially were considering using those layers as well before they settled on the "enemies not rendered" layer instead, which leads me to believe it's likely that others will try to make use of them too.

FerusGrim commented 3 months ago

I will take a look at this, today. Thanks for the heads up and suggestion!

NakiriFox commented 3 months ago

Found the same problem, and after installing this mod, my FPS decreased by 20-30

FerusGrim commented 3 months ago

Found the same problem, and after installing this mod, my FPS decreased by 20-30

This issue has been fixed on the pending update, I'm just not quite ready to release.