Layered background implementation

Posted: 26 Mar 2022 16:37
by ckastens

Many thanks for the tool, we currently have four projects in progress with Naninovel.

I have tried to use layered background implementations on every project to date and have had to switch to generic or create elaborate workarounds in all cases. There are some missing features and some bugs that should be addressed to make layered backgrounds much more useable. I'll list them in order of importance:

1) Animated layers don't mix with static layers - they are always rendered differently. It doesn't matter what z-ordering or layer ordering is used, the animated layers always end up in front. It would be very nice to be able to have animated and static layers working together in any order.

2) There is no toggle to render layered backgrounds in perspective - they always render to texture/ortho. It would be nice to have the option to use perspective camera with layered backgrounds.

3) Can't apply commands to individual layers. It would be extremely useful to be able to tint or offset individual layers, but these commands effect the entire background, always. This forces the user to create multiple backgrounds for each layer that will be moved or tinted.

4) Multiple layered backgrounds in the same scene don't sort properly. Even if given proper z-ordering or layer ordering, the first background enabled in the scene is always rendered first. This is a minor nuisance, but would be nice if fixed.

Thanks for your time.


Re: Layered background implementation

Posted: 26 Mar 2022 19:40
by Elringus

Hi, Thanks for the suggestions!

  1. Layered actors are sorted based on Sorting Order specified on Sprite Renderer and z-position, no matter animated or not. That said, the order is determined on initialization. Make sure you're not changing the order at runtime.
  2. That is by design. Layered concept is not applicable for perspective mode; use either generic or custom implementations.
  3. I'd recommend creating a custom command for that; I don't think there is a one-fit-all solution here. For example, you can use a state machine (eg, a Unity animator) or modify the layers directly via C# scripts or visual scripting.
  4. I'm not aware of such issue. Please contact support on Discord and we'll look into that.

Re: Layered background implementation

Posted: 27 Mar 2022 20:54
by ckastens
Elringus wrote: 26 Mar 2022 19:40

Layered actors are sorted based on Sorting Order specified on Sprite Renderer and z-position, no matter animated or not. That said, the order is determined on initialization. Make sure you're not changing the order at runtime.

This has never worked for me and I've tried to get it working in multiple projects. I posted an example yesterday in the support forum. The problem is that animated layers are rendering in z-space while all other layers are rendered to texture (1.17). I sent a video which clearly shows the animated layers in z-space and other layers rendered to background.


Re: Layered background implementation

Posted: 27 Mar 2022 21:19
by Elringus

All the sprite renderers in the layered actor prefab are rendered to a single texture; they're not treated differently in that regard.


Re: Layered background implementation

Posted: 28 Mar 2022 08:22
by idaot

I was unable to reproduce the problem you brought up in Discord during the weekend. If you could share the animation setup or dm me the prefab with the graphics, I'll have a look again.