• 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!

3D someone help me about d3d_end()?

K

KaiXtr

Guest
Hello Friends,Let's Contextualize...

I'm Creating a Space Shooter game,I will talk more about this project in the future. So,in the introduction of the game,in tribute to the Star Wars franchise,I made this sign:

but I the sign is just a background with some stripes,I want to create a text,so the first question is:

*How I make a 3D floor with text like texture?I need use something like this code?
Code:
d3d_draw_floor(room_width-275,-1600,7,room_width-150,0,7,background_get_texture(my text]),60,60)
and there are the second question:the entire game is 2D,just this part and maybe other scenes are in 3D,and you use the d3d_end() code to end the 3D,yep?

so,I use this code in an Alarm Event,check out:

Destroy Instance:Obj_camera
Destroy Instance:Obj_mode7
Execute Code:
Code:
d3d_end()
room_next(1);
instance_destroy();
But when this happen,just a black screen of darkness and empty,I tried to make the Obj_camera stop the d3d before,but without remove the background,and changing the background colour to green,and what happens is that the view looks match more big than before and the background returns to 2D,but the background colour continues green.

and this are my second question:

*How I change a 3D room to a 2D room?

somebody help me!:(
 

Attachments

Hi, you don't need to use d3d_start or d3d_end for this.

It is enough to set up a perspective projection with a tilted camera, and then after drawing the text, if necessary, to return to an orthographic projection.

Code:
    d3d_set_projection_ext( 0, 600, 250, 0, 0, 0, 0, -1, 0, 60, room_width/room_height,1,10000);
    draw_set_halign(fa_center);
    draw_set_valign(fa_center);
    draw_text_ext(0,text_y,text, -1, 500);
    text_y -= 1;
    d3d_set_projection_ortho(0,0,room_width,room_height,0);
in this example I'm setting the perspective camera to look at (0,0,0) from the location (0,600,250).

I can also set the text colour using

draw_set_colour( c_yellow );

and if I want to have the text fade into blackness, then I can use d3d_set_fog

d3d_set_fog( true, c_black, 800, 1400);

If you don't know how to use any of these functions or what arguments to provide them, look it up in the manual.

Be aware that in GMS1, as the text gets further away from the camera, it will flicker and there will be banding. There is a marketplace asset that might help with this. In GMS2, I believe, you can adjust the texture filtering to mitigate the problem.
 
Last edited:
Top