Legacy GM Trying to draw a sprite behind a 3d object

C

Christopher Rosa

Guest
1589434479310.png

I'm trying to draw a sprite behind a 3d object I can't figure it out, I found out how to draw a sprite behind all 3d objects but the clouds in the background is also a 3d ellipsoid so that wont work in this case. i draw the sprite as a 3d wall but i'd rather it be a sprite so all of the pixels are perfect because currently there some strange pixel placement because it's 3d instead of a sprite heres my code :
GML:
draw_set_alpha_test(true)
draw_set_alpha_test_ref_value(40)

d3d_transform_add_rotation_z(90);
d3d_transform_add_translation(x, y, z)
d3d_draw_wall(0,-1,1,0,1,-1,sprite_get_texture(spr_Emerald3dShine,0),1,1);
d3d_transform_set_identity();

draw_set_color(c_white);
d3d_transform_set_scaling(0.05,0.05,0.05);
d3d_transform_add_rotation_z(z+a);
d3d_transform_add_translation(x,y,z);
d3d_model_draw(Emerald_3d,0,0,0,sprite_get_texture(spr_Emerald3d_Tex,Emerald_3dAnim))
d3d_transform_set_identity();
 

Yal

šŸ§ *penguin noises*
GMC Elder
So basically, I've had the old GameMaker 8 for a few years and have made a decent amount of 2D games with it. Recently I've got GameMaker Studio (v1.4.1757) and have been learning how to code things in 3D using GML, so I'm trying to remake one of my old game engines.
I've now got some nice 3D platforms and blocks in the background, but here's the problem:

When the player's sprite moves in front of any background scenery, it for some reason makes the scenery invisible behind the sprite's size box thing. I've checked the actual sprite itself, which does have transparent edges, so it's a bit confusing... There's probably a really simple solution for this, or maybe just an extra option I needed to tick, or a few lines of code, but I'm stumped. I've used loads of simple 2D Drag-N-Drop stuff in the past, but I've never used 3D with GameMaker before xD Any help will be really appreciated! :)

(This is also my first time using these forums) View attachment 2785
You should probably move over to GMS2, GMS1 has been unsupported for a couple years now.

That said, transparency and 3D is a bit of a mess. The main reason things don't work out of the box is because 2D has depth-sorted drawing order, 3D doesn't, and it leads to issues where the behind-the-scenes drawing code realizes something is occluded... except the pixels that are in the way are in fact, transparent. I've had issues where a transparent polygonal object would block out ITSELF in weird ways, too. The only really reliable solution is to manually depth-sort your transparent objects and do several drawing calls, drawing transparent stuff last... but be aware that this will tank your performance if you do it too much (one big draw batch is faster than many small).

draw_set_alpha_test can help (since it makes fully transparent pixels not count as "in front of" stuff in the background) but it's not going to work for every case.
 
C

Christopher Rosa

Guest
yea i'm going to mover over to gms 2 they just made the d3d_functions obsolete. I don't understand why but either way I have to deal with it. Do you think all of the obsolete functions have a replacement?
 
Top