GMS 2 Perspective projection camera system, and issues with depth


Good evening all! I had developed a nice parallax "2.5d" camera system in GMS1. But the restructuring of VIEWS in GMS2 forced me to develop a new one. I stumbled across this example:

I love it's potential. I have a working prototype now using this method, and it looks great. This parallax effect utilizes layer depth, to act as a Z-axis. So if a layer is pushed waaay to the background (say depth = 20000), it will remain nearly stationary, giving a beautiful illusion of depth contrast. The problem arises though, that when an layer is set that far back, it gets very tiny as well. I tried to circumvent this by scaling the backgrounds to ridiculous sizes in the room editor, but this involves so much trial and error to get it visually correct. It also will make level editing extremely tedious moving forward, as zooming back into the room grid, it is polluted with pixelated background images.

So I am hoping that maybe I have missed something simple. Ultimately, I want what I place in the level editor, to be relatively close to the same size visually, in game. And I want that extreme depth between the background layer, and the main instance layer (depth 0), without having to scale layer assets to ridiculous sizes.

Thanks yall


Why even use a 3D camera for this? Programming in parallax w/o 3D is fairly simple. For example, you could just have each layer (or background, or whatever) shift its position to match the camera times some multiplier. The smaller the multiplier (< 1) the less it moves and the further away it looks. Same effect.

The only difference in effect you would see by doing that vs. the 3D camera method is the whole perspective projection thing (with stuff getting smaller the farther away it is) which you are trying to disable in the first place.

If I am misunderstanding and you do want that perspective effect but just not to that extreme, just don't give your backgrounds such extreme depths. You can also adjust your camera properties (like FOV) to help with this.


Yes thank you Binsk. Upon further thought, I am going to keep it more simple, and just use the multiplier method you mentioned. I just really like the idea of essentially painting levels in the room editor, and having it magically become 3d. But I would need a 3d editor to do so, which GM just isn't focused on. Unity would be more suited for that from my understanding. I'll leave this thread open for now, in case anyone else has some great ideas. Thanks for the feed back


Just to throw it in the mix... if you liked your old system and the only thing that messed up you was the change in views, view_xview and view_yview are still global variables and all you need to do is give them values each step so your existing code can continue as it was.

// End step