Drawing order in the renderer
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Parallax
- DMwiki contributor
- Posts: 424
- Joined: Mon Aug 28, 2006 7:56 pm
- Location: Back in New Jersey
Drawing order in the renderer
I am trying to do some fancy stuff with wallsets and I'd like to know exactly what the renderer draws and in what order. To be more specific, here is a series of questions, in which we will assume that the party stands at (lev, 0, 0), facing East:
1) Are the default (for level lev) floor and ceiling always drawn? If so, are they always drawn first?
2) Are the visible tiles drawn as tiles, or based on the surfaces? For instance, if (lev, 2, 1) is a wall, are the 'pers' view and the 'side' view drawn one after another, or is the pers view drawn with the other pers view at that distance and the side view drawn later, along with the other side view and the front view that are at the same distance from the party?
3) If (lev, 2, 1) and (lev, 2, 0) are both walls, is the pers view of (lev, 2, 1) drawn, even though it won't normally be visible?
4) When are wallitems and flooritems drawn? Are they drawn even if they won't be seen? What about flooritems on tiles that currently walls? (wallitems on tiles that are currently open are obviously not drawn.)
5) Custom wallsets. Does the presence of custom wallsets on certain tiles affect the answers to question 1)?
6) Priority: If two flooritems are on the center of the same tile, which one gets drawn first? In particular, for doors, does the order of doorframe, door, doorbutton matter? Does the answer hold for two wallitems on the same subtile as well? What about flooritems on different subtiles of the same tile (like monsters leaving unmoveable corpses), is the drawing order dependent on the perspective as it is for regular items?
I realize that I could test for some of this myself, but I would not be certain that the results I get are general, and not due to the particulars of the situation. Testing for every orientation, in particular, would be very tedious.
1) Are the default (for level lev) floor and ceiling always drawn? If so, are they always drawn first?
2) Are the visible tiles drawn as tiles, or based on the surfaces? For instance, if (lev, 2, 1) is a wall, are the 'pers' view and the 'side' view drawn one after another, or is the pers view drawn with the other pers view at that distance and the side view drawn later, along with the other side view and the front view that are at the same distance from the party?
3) If (lev, 2, 1) and (lev, 2, 0) are both walls, is the pers view of (lev, 2, 1) drawn, even though it won't normally be visible?
4) When are wallitems and flooritems drawn? Are they drawn even if they won't be seen? What about flooritems on tiles that currently walls? (wallitems on tiles that are currently open are obviously not drawn.)
5) Custom wallsets. Does the presence of custom wallsets on certain tiles affect the answers to question 1)?
6) Priority: If two flooritems are on the center of the same tile, which one gets drawn first? In particular, for doors, does the order of doorframe, door, doorbutton matter? Does the answer hold for two wallitems on the same subtile as well? What about flooritems on different subtiles of the same tile (like monsters leaving unmoveable corpses), is the drawing order dependent on the perspective as it is for regular items?
I realize that I could test for some of this myself, but I would not be certain that the results I get are general, and not due to the particulars of the situation. Testing for every orientation, in particular, would be very tedious.
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Drawing order in the renderer
Not always drawn. They're only drawn if an override floor and/or ceiling are not set. In those cases, the override floor and/or ceiling are drawn. Otherwise, the level default floor and ceiling are drawn. In both cases, this is what is drawn first.Parallax wrote:Are the default (for level lev) floor and ceiling always drawn? If so, are they always drawn first?
They're drawn as tiles: first pers, then side; first left, then right, finally, the center wall is drawn.Parallax wrote:Are the visible tiles drawn as tiles, or based on the surfaces?
Yes. Due to the presence of masks and alpha transparency, DSB doesn't bother with any culling right now. If this becomes a speed issue somehow it could be made an option.Parallax wrote:is the pers view of (lev, 2, 1) drawn, even though it won't normally be visible?
Wallitems and flooritems are drawn at the end of the draw code for their particular tile. Floorflats are drawn first, then flooruprights. Flooritems on tiles that are currently walls are not drawn, but clouds are, just like DM.Parallax wrote:When are wallitems and flooritems drawn? Are they drawn even if they won't be seen? What about flooritems on tiles that currently walls? (wallitems on tiles that are currently open are obviously not drawn.)
Not really. If the tile has a custom floor or ceiling, that is drawn immediately after the level's base floor and ceiling are drawn.Parallax wrote:Custom wallsets. Does the presence of custom wallsets on certain tiles affect the answers to question 1)
In general, they're drawn in the order they are in the tile, which is to say, the last item added to the tile will be on the "top" and thus drawn first.Parallax wrote:If two flooritems are on the center of the same tile, which one gets drawn first?
No, there's a special hack in the renderer to keep this from being a headache. Doors and doorbuttons are automatically deferred to be drawn after doorframes, regardless of the tile order.Parallax wrote:In particular, for doors, does the order of doorframe, door, doorbutton matter?
Yes.Parallax wrote:Does the answer hold for two wallitems on the same subtile as well?
Flooritems that aren't in the center of the tile aren't drawn at all. If you need this, we can figure something out...Parallax wrote:What about flooritems on different subtiles of the same tile (like monsters leaving unmoveable corpses), is the drawing order dependent on the perspective as it is for regular items?
![Smile :)](./images/smilies/icon_e_smile.gif)
- Parallax
- DMwiki contributor
- Posts: 424
- Joined: Mon Aug 28, 2006 7:56 pm
- Location: Back in New Jersey
Re: Drawing order in the renderer
Thanks for the prompt answers!
If I understand correctly, the drawing proceeds as:
- Floor/ceiling on every tile, regardless of whether it is open or a wall. For each tile, only the actual wallset used on the tile is drawn, the default wallset is not used as an "undercoat" everywhere.
- From back to front, left before right before center, every tile is drawn. Wall tiles get the walls (if applicable), pers view (with its wallitems) before front view (with its wallitems), while open tiles get flooritems (flat, then upright) followed by the instances in subtiles.
This seems like it should avoid the most obvious glitches (all the ones I can think of right now.)
.
If I understand correctly, the drawing proceeds as:
- Floor/ceiling on every tile, regardless of whether it is open or a wall. For each tile, only the actual wallset used on the tile is drawn, the default wallset is not used as an "undercoat" everywhere.
- From back to front, left before right before center, every tile is drawn. Wall tiles get the walls (if applicable), pers view (with its wallitems) before front view (with its wallitems), while open tiles get flooritems (flat, then upright) followed by the instances in subtiles.
This seems like it should avoid the most obvious glitches (all the ones I can think of right now.)
Parallax wrote:is the pers view of (lev, 2, 1) drawn, even though it won't normally be visible?
I was thinking that, with transparency, this might become an issue. If there are transluscent walls, or a "panoramic" window spell, it might be desirable to not display surfaces that are in the bulk of the wall, as they would interfere with the view.Sophia wrote:Yes. Due to the presence of masks and alpha transparency, DSB doesn't bother with any culling right now. If this becomes a speed issue somehow it could be made an option.
Parallax wrote:If two flooritems are on the center of the same tile, which one gets drawn first?
Wouldn't it be the 'bottom' item, then, since drawing the second item on top of it may partially or totally mask it?Sophia wrote:In general, they're drawn in the order they are in the tile, which is to say, the last item added to the tile will be on the "top" and thus drawn first.
Parallax wrote:What about flooritems on different subtiles of the same tile (like monsters leaving unmoveable corpses), is the drawing order dependent on the perspective as it is for regular items?
I don't need it yet, and possibly never. instances can probably be made unpickable through other means. Don't bother with it unless you are bored out of your mindSophia wrote:Flooritems that aren't in the center of the tile aren't drawn at all. If you need this, we can figure something out...
![Wink ;)](./images/smilies/icon_e_wink.gif)
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Drawing order in the renderer
I don't really understand...Parallax wrote:I was thinking that, with transparency, this might become an issue. If there are transluscent walls, or a "panoramic" window spell, it might be desirable to not display surfaces that are in the bulk of the wall, as they would interfere with the view.
![Sad :(](./images/smilies/icon_e_sad.gif)
Er, yes.Parallax wrote:Wouldn't it be the 'bottom' item, then, since drawing the second item on top of it may partially or totally mask it?
![Embarassed :oops:](./images/smilies/icon_redface.gif)
- Parallax
- DMwiki contributor
- Posts: 424
- Joined: Mon Aug 28, 2006 7:56 pm
- Location: Back in New Jersey
OK, let's put our party back at (0, 0), facing East. Now, assume that (1,0) (directly in front of the party) is a wall, and that (1,1), the tile to the right of the first wall, is a wall as well.
The difference with standard DM is that these walls are not solid rock. The party is stranded on the plane of purple jell-O, and that's what all the walls are made of here. From a technical standpoint, all wall views are semi-transparent bitmaps (say, with an opacity of about 80 out of 256 or so.) Even though the wall in front of the party shows no sign of discontinuity as it goes to the right, there is now a "special plane" though it along which it is "cracked." That's the plane that marks the limit between the two wall tiles. In order to get the feeling that the wall is continuous, the pers1 view of (1,1) should not be drawn.
The difference with standard DM is that these walls are not solid rock. The party is stranded on the plane of purple jell-O, and that's what all the walls are made of here. From a technical standpoint, all wall views are semi-transparent bitmaps (say, with an opacity of about 80 out of 256 or so.) Even though the wall in front of the party shows no sign of discontinuity as it goes to the right, there is now a "special plane" though it along which it is "cracked." That's the plane that marks the limit between the two wall tiles. In order to get the feeling that the wall is continuous, the pers1 view of (1,1) should not be drawn.
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
I'm trying to follow this but it makes no sense. So a picture is required, W = wall, x = party.Parallax wrote:OK, let's put our party back at (0, 0), facing East. Now, assume that (1,0) (directly in front of the party) is a wall, and that (1,1), the tile to the right of the first wall, is a wall as well.
The difference with standard DM is that these walls are not solid rock. The party is stranded on the plane of purple jell-O...etc
Code: Select all
xW
W
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Ok, Gambit. Assume that "x" is the party, facing east. 1 and 2 are walls.
If the wallset is solid, everything looks just fine.
However, if the wallset has some transparency (or if these are blue hazes), the "perspective" view of wall 2 will be drawn underneath wall 1. It'll look like there's a crack in the plane, or something, because you'll see this perspective view of the wall going off into the distance (like you would if wall 1 didn't exist), because currently all views are drawn even if they'll be overlapped.
Code: Select all
x1
2
However, if the wallset has some transparency (or if these are blue hazes), the "perspective" view of wall 2 will be drawn underneath wall 1. It'll look like there's a crack in the plane, or something, because you'll see this perspective view of the wall going off into the distance (like you would if wall 1 didn't exist), because currently all views are drawn even if they'll be overlapped.
- Parallax
- DMwiki contributor
- Posts: 424
- Joined: Mon Aug 28, 2006 7:56 pm
- Location: Back in New Jersey
I understand that it's already a problem in original DM, and it even gets worse when you look at what happens on the next plane (if the space beyond the first wall is open, there is a wall-air interface there and a wall should be displayed (but it's not) but if there is a wall then the medium is continuous and no wall should be diplayed (but one is).* Additionally, (in the case where (2,0) is a wall) the opacity of the front0 view should increase since there is a "double wall". So yea, maybe the world is not ready for transparent walls.
Of course, when you add the window spell into the mix things get even more complicated, since the second wall's (2,0) front view should be diplayed inside the window (I mean the round, central area of the 'window' spell,) otherwise it appears as if the window had gone through both the (1,0) and (2,0) walls. What a pain.
*: Trying with a picture, for Gambit.
First, a single wall ('#' for surface, '.' for interior) in front of the party (tile limits marked with '+', '-' and '|', party members (facing East (i.e. right)) marked with '>')
And now the same party, in front of a wall with a two tile depth.
The interface between the two walls is technically gone, even though the renderer would still display it.
Of course, when you add the window spell into the mix things get even more complicated, since the second wall's (2,0) front view should be diplayed inside the window (I mean the round, central area of the 'window' spell,) otherwise it appears as if the window had gone through both the (1,0) and (2,0) walls. What a pain.
*: Trying with a picture, for Gambit.
First, a single wall ('#' for surface, '.' for interior) in front of the party (tile limits marked with '+', '-' and '|', party members (facing East (i.e. right)) marked with '>')
Code: Select all
+----+######
|> >|#....#
| |#....#
| |#....#
|> >|#....#
+----+######
Code: Select all
+----+############
|> >|#..........#
| |#..........#
| |#..........#
|> >|#..........#
+----+############
-
- Ee Master
- Posts: 688
- Joined: Mon May 07, 2001 7:00 pm
- Location: Indiana, USA
- Contact:
I'm still contemplating that. ![Wink ;)](./images/smilies/icon_e_wink.gif)
Truth be told, I have been working lately, and not just as a technician for the schools. Actually, I've been programming a 3-D modeling studio for LDraw, because none of those currently available have the features/user-friendliness I desire. But, it's a 3-D project, and while I'm quite familiar with the semantics and technical hoodoo behind 3-D graphics, I've done very little 3-D programming, so it's a chore.
Anyway, my point is, I want to take a break and step back into 2-D for a while. I'd been tossing between Lego-DM and another 2-D engine I want to actualize. Every time I come here to read up on the goings-on in the community, I lean quite a bit more toward the DM side. Wonder why. Anyway, Let me fiddled around in MLCad and Max a bit more and I'm sure I'll persuade myself to start work on it right away.
Thanks for the heads-up. Oh, and if it makes you feel any better Parallax, I knew what you were talking about from the start.
</offtopic>
![Wink ;)](./images/smilies/icon_e_wink.gif)
Truth be told, I have been working lately, and not just as a technician for the schools. Actually, I've been programming a 3-D modeling studio for LDraw, because none of those currently available have the features/user-friendliness I desire. But, it's a 3-D project, and while I'm quite familiar with the semantics and technical hoodoo behind 3-D graphics, I've done very little 3-D programming, so it's a chore.
Anyway, my point is, I want to take a break and step back into 2-D for a while. I'd been tossing between Lego-DM and another 2-D engine I want to actualize. Every time I come here to read up on the goings-on in the community, I lean quite a bit more toward the DM side. Wonder why. Anyway, Let me fiddled around in MLCad and Max a bit more and I'm sure I'll persuade myself to start work on it right away.
Thanks for the heads-up. Oh, and if it makes you feel any better Parallax, I knew what you were talking about from the start.
</offtopic>