• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Fake 3D Depth Sorting Riddle

S

Sozidar

Guest
Since fake 3D is harsh on fps I've made so every world chunk generates one huge surface with all of the objects inside it, instead of drawing every object separately. It reduced draw calls by a lot, but now I am out of ideas on how to draw moving objects under or above some of the static fake 3d objects, since they are drawn by one huge surface. Attached image is trying its best to show what I mean. Any help on solving this problem is very much appreciated :oops:

https://imgur.com/ooB0PJk
 
With fake 3d, you're doing a lot of work to draw what actual 3d could draw about 1000 times faster, and with less difficulty.

Anyway, I think making use of the depth buffer is the easiest way to fix your problem. If all your fake-3d stuff is static, then you can put it on a vertex buffer, which, a) will make them draw much faster, and b) will let you easily set the z position of each "sprite". The downside is you'd need to make sure all the fake-3d stuff that you put into a single vertex buffer uses a single texture. You'll probably need to use a shader to assign the depth of moving objects.
 

Sabnock

Member
Since fake 3D is harsh on fps I've made so every world chunk generates one huge surface with all of the objects inside it, instead of drawing every object separately. It reduced draw calls by a lot, but now I am out of ideas on how to draw moving objects under or above some of the static fake 3d objects, since they are drawn by one huge surface. Attached image is trying its best to show what I mean. Any help on solving this problem is very much appreciated :oops:

https://imgur.com/ooB0PJk
Pretty cool though
 

Yal

šŸ§ *penguin noises*
GMC Elder
Can't you just draw everything to the surface in depth order using a priority queue?
 
S

Sozidar

Guest
With fake 3d, you're doing a lot of work to draw what actual 3d could draw about 1000 times faster, and with less difficulty.

Anyway, I think making use of the depth buffer is the easiest way to fix your problem. If all your fake-3d stuff is static, then you can put it on a vertex buffer, which, a) will make them draw much faster, and b) will let you easily set the z position of each "sprite". The downside is you'd need to make sure all the fake-3d stuff that you put into a single vertex buffer uses a single texture. You'll probably need to use a shader to assign the depth of moving objects.
Thanks for the suggestions, I dove into learning that stuff and managed to generate vertex buffers for voxel sprites and write a dead simple vertex shader. Performance is now just ridiculously fast. Also depth is not a problem anymore, since I already had a depth script, it just wasn't working with the method described in the first post, but now, when voxel objects are drawn separately, it works pretty good. Thank you so much! <3
 
Last edited by a moderator:
Top