GMS 2 Fake 3D Depth Sorting Riddle

Sozidar

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
 
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?
 

Sozidar

Member
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:
Top