[Question] Lights handling

  • Good day, I'm interested how lights created with plugin API (especially with prefabs) will be handled by the game. If I'm understanding correctly the game controls amount of active light on the scene, so will lights from prefabs also be included in that counter? Or they will be separate and creating too much prefabs with lights will cause massive lags?


    Another question is about light shadows, due to light behaviour from some objects I can suppose that shadows are not recalculated per frame, but when neighbour objects are updated. Will this behaviour be applied to prefab lights?


    And the third question - is it possible to make light and control it programmatically from plugin side? I saw some methods that are probably related to it (that adds components to game object), but looks like they are not finished


  • This screenshot looks amazing, well done! :wow::thumbup:


    About the lights, unfortunately the game does no specific handling for them, so lights spawned through the API are always in the scene. HDRP allows you to set a max view distance for lights (that could be defined in the prefab) and that setting should still work in the game though. Basically lights (without shadows) shouldn't be a huge issue because the game uses a deferred renderer... but HDRP lights are still relatively "expensive", so hundreds of active lights will have an impact. There is another limitation in HDRP: it can only render 63 lights per screen tile (exceeding this limit results in ugly artifacts)...


    Shadows are a bit more tricky though... by default they're dynamic (so no caching happens), but of course this has performance implications...


    We could maybe add a way to turn API lights into "managed lights" (so they're managed by the game and taken into account for the max amount of active lights in the scene) :thinking: That would also work for the shadow handling then... maybe a method on the Prefab class like setLightManaged(String path, boolean set); would be a good idea^^


    And the third question - is it possible to make light and control it programmatically from plugin side? I saw some methods that are probably related to it (that adds components to game object), but looks like they are not finished

    Hmm... it looks like the setComponent(); method on game objects doesn't work properly :wat: We'll fix that! But the setComponent(); method on Prefab should work (the ones that accept a "path" parameter). Just set path to null if you want to add the light to the main object^^


    Nevertheless, it's also our intention to add a dedicated "Light" game object where all relevant methods would be exposed ;)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!