• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows How to setup this 3d configuration in GMS2

JaimitoEs

Member
Hi all!
In my current 1.x project i just use matrix multiplications to get a 3d sidescroller projection.

Enabling z-buffer and this code in the draw event :

Code:
var v = matrix_build(0,0,z,yrotation,xrotation,zrotation,1,-1,1);
var p = matrix_get(matrix_projection);
var f  = matrix_multiply(v,p);
matrix_set(matrix_projection,f);
Well, in GMS2 i can´t figure how this simple matrices does not work in the same way. Basically i loose the depth buffer and all is drawn with the same depth-scale projection.

I´ve tried to manage this with the new camera system and the new matrices functions without good results.

A 3d guru-man can help me with this issue? This new system seems no logical for me surely cause the new dx11 rendering....

Guys, if you want free 3d paralax in GMS1, feel free to get this simple code to achieve this...
 
Last edited:

mMcFab

Member
Other than making sure you have enabled both gpu_set_zwrite_enable and gpu_set_ztest_enable, I can't suggest much. That should enable the zbuffer which, as you say, you've already done.
I'm going to be honest, I don't build projection matrices with normal transform matrices and use matrix_set, so I can't help directly if you want to keep your code the same way.
However, I'd recommend that you try this with cameras using camera_set_view_mat and camera_set_proj_mat as well as matrix_build_lookat and matrix_build_projection(_*). It's more readable this way for starters, and potentially easier to debug. You also don't have to rebuild a projection matrix every step.

If it helps, I also have a guide on basic 3D in GMS2 (link in signature)
 

JaimitoEs

Member
Other than making sure you have enabled both gpu_set_zwrite_enable and gpu_set_ztest_enable, I can't suggest much. That should enable the zbuffer which, as you say, you've already done.
I'm going to be honest, I don't build projection matrices with normal transform matrices and use matrix_set, so I can't help directly if you want to keep your code the same way.
However, I'd recommend that you try this with cameras using camera_set_view_mat and camera_set_proj_mat as well as matrix_build_lookat and matrix_build_projection(_*). It's more readable this way for starters, and potentially easier to debug. You also don't have to rebuild a projection matrix every step.

If it helps, I also have a guide on basic 3D in GMS2 (link in signature)

Thanks for your time! I already get into the new camera matrix functions, afaik the camera update script do the same building a matrix every step, but same issue with the depth objects (talking about visuals), i think the matrix library are very poor, i´ve already created a 3x3 matrix library and now with the in-build matrix functions i miss things like a more extended functions library (matrix_inverse, matrix_transpose, matrix get determinant etc)....Yes i can build my own scripts for this but, in build functions are apreciated too for the comunity.

So talking about the depth issue with objects and his assigned sprites, i´m waiting an oficial response from Yoyo... I Really think in this moment come back to GMS1 and don´t touch GMS2 until march.
 

Juju

Member
Why are you trying to translate and rotate the projection matrix? That makes absolutely no sense. You'd want to apply transforms to the world or view matrix.
 

JaimitoEs

Member
Why are you trying to translate and rotate the projection matrix? That makes absolutely no sense. You'd want to apply transforms to the world or view matrix.
Well, the variables "xrotation,yrotation and zrotation" are only for internal prupose and visualization, i can travel into my level-world and looking depth distances and other things... is not a final ingame function.... and playing with z projection i can fetch some tools with the Gui layer.. well, some experiments, problably doing all with the matrix world and views will be the next thing to do, but at the moment is this.. experiments...
 
Last edited:
Top