• 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 Disable 3d tile clipping?

Kyrieru

Member
If I use orthographic, I can't seem to stop tiles from clipping. Any attempt to "zoom in" seems to result in clipping, what's a good tutorial or general practice for working with orthographic and tiles?
 

Kyrieru

Member
I drew view_camera[0] to the screen.
Looks like in ortho mode the tiles are being culled based on how much the of the view is visible..
 

Attachments

Last edited:
I suspect you can fix this problem by setting the size of the view with matrix_build_projection_ortho().

So the idea here is to NOT change the size of the camera's view, but just to use matrix_build_projection_ortho and then asign the result as the camera's projection matrix.
 
Last edited:

Kyrieru

Member


Camera update script is just the look-at matrix and such. It seems to happen whether I change the camera or not.
 
So does it happen when you zoom only, or also just when changing the look-at view matrix?

It might be possible to fix this problem by bypassing the camera entirely, and resorting to matrix_set to set the view and projection matrices instead.
 

Kyrieru

Member


It happens as I move the camera around in various ways. Rotate, move XY, etc.
Everything is fine in perspective, it only happens in ortho.

How would I bypass the camera?
 
I could be way off with my theory that this is a problem with the camera trying to cull outside of the view.

Because it doesn't make sense that that should happen only with an orthographic projection. Because the camera doesn't know whether it is using a perspective or an orthographic projection, does it? So why would the culling work differently?

But the thing is it looks very much like a culling issue. We don't see z-fighting, or signs that it is a far or near plane clipping issue.
 

Kyrieru

Member
Well it's definitely not showing tiles, as if they are outside of a view.
I've tried everything I can to change ports back and fourth and change sizes, but I can't just can't get the tiles to stop being erased.

How do other people do it? Do they just not use tiles?
 
I've encountered a similar problem in GMS1. And the way I fix it is by making the 2d view, (which isn't used to actually draw anything in 3d), big enough to encompass all of the tiles or instances that should be visible in the 3d projection.

But it still doesn't make sense to me that changes to the view matrix would affect how gamemaker culls tiles. Does it analyze the view matrix to try to figure out what should be visible? I doubt that. Maybe you should show the entire code you are using for your camera and view.
 

Kyrieru

Member
What I showed above is pretty much all there is. Other than this
gpu_set_ztestenable(1)
gpu_set_zwriteenable(1)
view_enabled = 1;
view_set_visible(0, 1);

The only other stuff is the tiles, and a camera object which rotates around and is used for the look at matrix to refer to. (camera_ob)

How do you do the 2d fix you mentioned? I tried doing stuff like that in theory but either I didn't know enough to get it to work, or it just doesn't work anymore

This is what it looks like when I rotate in ortho, by the way.
https://i.gyazo.com/8f7728506feb134e0e75897385c5c8a0.mp4
 
The other video you posted was also an orthographic projection.

You should probably tag your thread GMS2, to hopefully get some GMS2 folks in here. I can tell you how I solved my problem in GMS1, but I'm not sure it applies in GMS2. All I did was make the 2d view (not port), or room if not using views, large enough to cover everything that I want to be visible. And then I use matrix_set to set the view and projection matrices.

Anyway, like i've said a couple times now, I'm not convinced my original theory (that it was a culling problem), is correct. Are you using a draw_clear() function anywhere?
 

Kyrieru

Member
Nope, I'm not.

What should I write specifically for doing it without a camera/view?
Any order I do it in, it just ends up looking the same as the above video.
 
Last edited:
Top