• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 3D perspective projection and cameras

Shut

Member
I have a top down 3D projection set up and I'm trying to find a way to make views act normal. (similar to 2D/default behavior) Is there any solution to this? Right now, when using camera_set_proj_mat - view_x and y coordinates are messed up and return useless values.

1. Is there any way to return the behavior of default 2D views when using the 3D projection?

2. For some reason, when I'm trying to set up a scrolling tiled background, it doesn't repeat. Is this supposed to work differently when using 3D?

 

kraifpatrik

Member
1. What do you need view_x/y for in 3D? You are probably trying to do something that has to be handled differently in 3D.
2. Have you tried texture_set_repeat(true)?
 

Shut

Member
1. What do you need view_x/y for in 3D? You are probably trying to do something that has to be handled differently in 3D.
2. Have you tried texture_set_repeat(true)?
1. It's not just the coordinates that I need, but the behavior is also different from the default view, setting view/camera angle doesn't work, etc. I was just wondering if there was a way to keep the default view behavior.

2. I tried gpu_set_texrepeat(1), but that doesn't work.. even tried changing the sprite to 256x256 and giving it a seperate texture page.. I guess this also affected by the above problem.

 
M

Multimagyar

Guest
Things do work differently in 3D what exactly the behavior you looking for with view_x and y just the left top corner of the currently visible area? Keep in mind when you work in 3D you are working with a view that looks like a pyramid not a cuboid. Telling the top left corner is different but still possible. texture repeat just forces the texture onto it's own texture page so if the texture page coordinates are not normalized for the model or the ground or such it will loop instead of take bits and pieces of other sprites.
I don't think tiling works in 3D however I did not use tiling or tilesets for 3D development unless the tiles were 3D represented. you could just work around that with a rectangle that's the size of the area it has to cover (camera view in this case) and make a shader to take the camera coordinates and offset the texture coordinates so it looks like it's repeating but static in the same time.
 

Shut

Member
I wish there was a function just to leave the view stuff to default and just draw 3D projection, that's all I'm trying to achieve.
 
M

Multimagyar

Guest
That would be nice but I'm not sure how you would achieve that in 3D that simply unless we talk about huds which then the UI draw always stays to they absolute position regarding the application surface. Also don't forget that even tho we talk 3D here YoyoGames's focus as well as the support goes only as far as 2D. Best we really got is some handy dandy buffer handling and shaders. And in GMS2 finally matrix-vector multiplication. But honestly at that point it only takes just a "little bit" more effort to build your things up and running.
 

Shut

Member
I found some work around methods, but it's not as good as using the default view and as I keep adding new stuff, some of the functionality might break.. I'm not exactly asking for a new thing, just something that is already there, but give us an option to enable/disable that. It would make things much easier for those of us who want to create 2.5D games or just draw 3D models with perspective projection but not change the game play to 3D.
 
Top