Legacy GM [SOLVED] 3D FPS GUI Display Issue

Anti-Icarus

Member
In following along an old tutorial on how to create a 3D FPS in GM:S, I've encountered an issue in which the GUI is not displaying properly. Here is an image of an FPS when it was made in GameMaker 8:

upload_2017-10-26_18-6-24.png

And here is a screenshot of the FPS I made in GameMaker: Studio:

GameMaker 3D display issue reduced size.png

As you can see, the GUI in the former does not display as well as the latter did. I'm sure I need to add something else to the code in my gun object's draw event but it's hard to say what. At the time of this writing, that code looks like this:

Code:
d3d_set_projection_ortho(0, 0, 640, 480, 0);
d3d_set_hidden(false);
draw_sprite_ext(spr_shotgun, -1, 0, 224, 2, 2, 0, c_white, 1);
draw_set_alpha(0.4);
draw_healthbar(5, 460, 100, 475, health, c_black, c_red, c_lime, 0, true, true);
draw_set_alpha(1);
d3d_set_hidden(true);
How can I get the GUI to display properly in 3D mode so that it won't come out all black?
 
EDIT:

I at first thought it had something to do with the draw colour, but then your 3d stuff should be black as well. Are you using any kind of lighting or fog?
 

Anti-Icarus

Member
EDIT:

I at first thought it had something to do with the draw colour, but then your 3d stuff should be black as well. Are you using any kind of lighting or fog?
Yes, I'm using fog as per the original instructions by Mark Overmars. That said, I set up the fog in the Create event of my player object like this:

Code:
d3d_start();
d3d_set_hidden(true);
d3d_set_lighting(false);
d3d_set_culling(false);
d3d_set_fog(true, c_black, 10, 300);
texture_set_interpolation(true);
 

Anti-Icarus

Member
Try disabling fog and set drawcolor to white before you draw the sprites
I disabled the fog and it appeared to do the trick. But where do I set the drawcolor to white before drawing the sprites? In the player object's Create event where the 3D is enabled in the first place?

And how would you enable a fog effect without impacting the GUI?
 

Anti-Icarus

Member
You set draw color above the draw sprite command.
Be fore drawing the sprites disable fog. Then re-enable it when all the sprites have been drawn.
Now which object would I need to be doing this in? The player object's Create event or the gun object's Draw event? The former initializes the 3D mode:

Code:
d3d_start();
d3d_set_hidden(true);
d3d_set_lighting(false);
d3d_set_culling(false);
d3d_set_fog(true, c_black, 10, 300);
texture_set_interpolation(true);
draw_set_alpha_test(true);
draw_set_alpha_test_ref_value(40);
The latter basically acts as what you might call the overlay for the player object's view in the 3D mode:

Code:
d3d_set_projection_ortho(0, 0, 640, 480, 0);
d3d_set_hidden(false);
draw_sprite_ext(spr_shotgun, -1, 0, 224, 2, 2, 0, c_white, 1);
draw_set_alpha(0.4);
draw_healthbar(5, 460, 100, 475, health, c_black, c_red, c_lime, 0, true, true);
draw_set_alpha(1);
d3d_set_hidden(true);
If you are referring to the later, is the draw color set above draw_sprite_ext and enable the fog after draw_set_alpha or d3d_set_hidden?
 

hamdrax24

Member
Note that you don't really have to set draw color since the default is white. But, including it allows for some simple effects, feel free to experiment.
 

Anti-Icarus

Member
Yes, draw color is set above draw_sprite_ext and enable fog after d3d_set_hidden
I just altered the gun object's Draw event so that the fog would be disabled before drawing the white color, effectively becoming this:

Code:
d3d_set_projection_ortho(0, 0, 640, 480, 0);
d3d_set_hidden(false);
d3d_set_fog(false, c_black, 10, 300);
draw_set_color(c_white);
draw_sprite_ext(spr_shotgun, -1, 0, 224, 2, 2, 0, c_white, 1);
draw_set_alpha(0.4);
draw_healthbar(5, 460, 100, 475, health, c_black, c_red, c_lime, 0, true, true);
draw_set_alpha(1);
d3d_set_hidden(true);
d3d_set_fog(true, c_black, 10, 300);
I
So in other words, I left the fog setting as it is in the player object's Create event while managing to have the GUI elements visible without the fog covering them up like it has been doing up to now. I've had trouble understanding what you were trying to say, but it all worked out in the end. So thank you for your assistance! I'll be looking forward to doing a few experiments with this FPS in the future.
 
Top