Page 1 of 1

Using layers, is it possible to make objects on specific layers always render behind others?

Posted: 07 May 2019, 01:19
by Nimono
I know most BGOs always render in the background, but what about the tiles with collision? Is there any way to mark them to always appear above or behind certain other layers, or is it solely dependent on the order you create them in the level?

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Posted: 07 May 2019, 08:39
by Hoeloe
It's actually more dependent on their position in the level, and more importantly, their render priority.

As of SMBX2 MAGLX3, you can use background.txt files to change the render priority of background objects, by setting the priority value.

This link shows you which values various objects are normally rendered at, so you can use it for comparison: https://wohlsoft.ru/pgewiki/LunaLua_Render_Priority

Layers are actually pretty badly named. They're more like tags that let you collectively hide and show, or move, groups of objects. They don't have anything to do with render order.

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Posted: 07 May 2019, 12:58
by Nimono
Hoeloe wrote: 5 years ago It's actually more dependent on their position in the level, and more importantly, their render priority.

As of SMBX2 MAGLX3, you can use background.txt files to change the render priority of background objects, by setting the priority value.

This link shows you which values various objects are normally rendered at, so you can use it for comparison: https://wohlsoft.ru/pgewiki/LunaLua_Render_Priority

Layers are actually pretty badly named. They're more like tags that let you collectively hide and show, or move, groups of objects. They don't have anything to do with render order.
Alright, thanks. So essentially, Blocks that are placed closer to the top-left of the level render before blocks that are placed closer to the bottom-right?

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Posted: 07 May 2019, 13:31
by Emral
Nimono wrote: 5 years ago
Hoeloe wrote: 5 years ago It's actually more dependent on their position in the level, and more importantly, their render priority.

As of SMBX2 MAGLX3, you can use background.txt files to change the render priority of background objects, by setting the priority value.

This link shows you which values various objects are normally rendered at, so you can use it for comparison: https://wohlsoft.ru/pgewiki/LunaLua_Render_Priority

Layers are actually pretty badly named. They're more like tags that let you collectively hide and show, or move, groups of objects. They don't have anything to do with render order.
Alright, thanks. So essentially, Blocks that are placed closer to the top-left of the level render before blocks that are placed closer to the bottom-right?
Yes, but there are some exceptions you can use to cheat the system to your advantage:
-Sizeable blocks will render behind all other blocks and even behind most BGOs. Only the furthest back BGOs (whose priority can be adjusted now) such as water will be behind sizeables.
-Lava renders in front of other blocks, as well as the player and all NPCs.
-You can use invisible blocks and textured BGOs to essentially get blocks to look like they rendered at whatever priority you desire.

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Posted: 07 May 2019, 13:48
by Nimono
Enjl wrote: 5 years ago Yes, but there are some exceptions you can use to cheat the system to your advantage:
-Sizeable blocks will render behind all other blocks and even behind most BGOs. Only the furthest back BGOs (whose priority can be adjusted now) such as water will be behind sizeables.
-Lava renders in front of other blocks, as well as the player and all NPCs.
-You can use invisible blocks and textured BGOs to essentially get blocks to look like they rendered at whatever priority you desire.
Oooh, yeah, I forgot about invis blocks! The only issue I have left with it is that BGOs still render behind normal blocks, which is unfortunate- I basically need a block to render behind a block, and then a BGO to render in front of these blocks, BUT no other blocks. For some reason, it's not working out that way- even position changes aren't making the later blocks render above the foreground BGOs set to just -65 priority... Am I doing something wrong?

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Posted: 07 May 2019, 14:14
by Emral
Nimono wrote: 5 years ago
Enjl wrote: 5 years ago Yes, but there are some exceptions you can use to cheat the system to your advantage:
-Sizeable blocks will render behind all other blocks and even behind most BGOs. Only the furthest back BGOs (whose priority can be adjusted now) such as water will be behind sizeables.
-Lava renders in front of other blocks, as well as the player and all NPCs.
-You can use invisible blocks and textured BGOs to essentially get blocks to look like they rendered at whatever priority you desire.
Oooh, yeah, I forgot about invis blocks! The only issue I have left with it is that BGOs still render behind normal blocks, which is unfortunate- I basically need a block to render behind a block, and then a BGO to render in front of these blocks, BUT no other blocks. For some reason, it's not working out that way- even position changes aren't making the later blocks render above the foreground BGOs set to just -65 priority... Am I doing something wrong?
BGOs are collectively drawn after blocks are drawn... so what I would do is have some invisiblocks with bgos drawn to like -67, bgos drawn to -66 and regular blocks on -65 as usual, if I understand what you're getting at correctly.

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Posted: 07 May 2019, 14:19
by Nimono
Enjl wrote: 5 years ago BGOs are collectively drawn after blocks are drawn... so what I would do is have some invisiblocks with bgos drawn to like -67, bgos drawn to -66 and regular blocks on -65 as usual, if I understand what you're getting at correctly.
...Ahhh, I think I get what you're saying now. Thank you!