Gizmo199
Member
I posted this on the sub-reddit but I figured id try here as well:
So I have a vertex buffer drawing a bunch of sprites that are stacked one on top of the other in a vertex buffer. Each sprite has a "height" that I put into the vertex_position_3d 'z' function. Now everything within the vertex buffer itself looks great! Its all depth sorted correctly. The problem is if I want an outside object (player object) to say walk in front or behind a tree it seems that the 'z' parameter in vertex buffers don't correlate to 'depth' like other objects do.
so for example my player is in between 2 trees. My player's depth is set to 0. Each tree individually has a stack of say 32 sprites (one on top of the other). So when I make my vertices I have the 'z' param set to each height accordingly per tree. So the base of the tree's 'z' is set to 0, the next sprite up is set to 1, next 2, ect. The problem is that if I say set my player's 'depth' to 3 he is drawn under EVERYTHING or visa versa wherein I set my players 'depth' to -3 he is drawn on top of EVERYTHING.
So my question is, how do vertex buffers handle the 'z' parameter in the function, because it seems that it is a completely separate thing from 'depth'. And as far as I thought, 'depth' was written to the z-buffer. So I am confused as to why it seems that every sprite in my vertex buffer is being drawn at 0 depth?
Thanks in advance! I hope this all made sense!
So I have a vertex buffer drawing a bunch of sprites that are stacked one on top of the other in a vertex buffer. Each sprite has a "height" that I put into the vertex_position_3d 'z' function. Now everything within the vertex buffer itself looks great! Its all depth sorted correctly. The problem is if I want an outside object (player object) to say walk in front or behind a tree it seems that the 'z' parameter in vertex buffers don't correlate to 'depth' like other objects do.
so for example my player is in between 2 trees. My player's depth is set to 0. Each tree individually has a stack of say 32 sprites (one on top of the other). So when I make my vertices I have the 'z' param set to each height accordingly per tree. So the base of the tree's 'z' is set to 0, the next sprite up is set to 1, next 2, ect. The problem is that if I say set my player's 'depth' to 3 he is drawn under EVERYTHING or visa versa wherein I set my players 'depth' to -3 he is drawn on top of EVERYTHING.
So my question is, how do vertex buffers handle the 'z' parameter in the function, because it seems that it is a completely separate thing from 'depth'. And as far as I thought, 'depth' was written to the z-buffer. So I am confused as to why it seems that every sprite in my vertex buffer is being drawn at 0 depth?
Thanks in advance! I hope this all made sense!