It is possible to mix 2d and 3d background in Game Maker?

J

joondoe

Guest
I'm wondering if it is possible to make 2d and 3d game in Game maker like Ori and the blind forest, this kind of stuff ?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
If I remember correctly, the backgrounds in Ori weren't 3d - just a particularly fancy layered parallax effect.

But yes, you can change projection to 3d, draw something, and change it back - via d3d_set_projection functions in GMS1 or camera functions in GMS2.
 
J

joondoe

Guest
thanks for your answer,
awesome for the Ori work if it is the case,
okay so it's not an hacky movement if I understand well it's adapted to Game Maker features?
 

Niels

Member
I believe Ori used the same effect for its parallax effect as hollow knight. This is done by using unity's perspective (3D)camera in a 2D room.


Would love to know if something like this is possible in gms2
 
L

Lonewolff

Guest
I believe Ori used the same effect for its parallax effect as hollow knight. This is done by using unity's perspective (3D)camera in a 2D room.


Would love to know if something like this is possible in gms2
Absolutely do able in GMS2.

You can switch between perspective and orthographic as much as you like during the render cycle.

What is going on in your attached image is actually quite trivial to do. If I get a chance in the next few days I might even throw something together to show how this can be done in GMS2.
 

Niels

Member
Absolutely do able in GMS2.

You can switch between perspective and orthographic as much as you like during the render cycle.

What is going on in your attached image is actually quite trivial to do. If I get a chance in the next few days I might even throw something together to show how this can be done in GMS2.
can't wait!
 
T

Taddio

Guest
Absolutely do able in GMS2.

You can switch between perspective and orthographic as much as you like during the render cycle.

What is going on in your attached image is actually quite trivial to do. If I get a chance in the next few days I might even throw something together to show how this can be done in GMS2.
That would be most awesome, this effect has nice potential!
 
T

Taddio

Guest
Will try that asap!
EDIT: Bro, this is just amazing! I can't believe you crammed such an amazing thing in a few lines of code in a single object, honestly.
I'm definately gonna be using this A LOT.
Thanks a lot!!
 
Last edited by a moderator:
L

Lonewolff

Guest
Will try that asap!
EDIT: Bro, this is just amazing! I can't believe you crammed such an amazing thing in a few lines of code in a single object, honestly.
I'm definately gonna be using this A LOT.
Thanks a lot!!
No problems at all :)
 

nesrocks

Member
This is really cool indeed. I'll try to understand the functions better later!

For a fun test replace:
Code:
xfrom += 3 * dir;

if(xfrom > 1000 || xfrom < 500)
    dir = - dir;
with:
Code:
xfrom = width-mouse_x;
yfrom = height-mouse_y;
By the way, you seem to have two instances of the obj_3d_controller object in the room. I figure only the one on layer main is necessary?
 
L

Lonewolff

Guest
By the way, you seem to have two instances of the obj_3d_controller object in the room. I figure only the one on layer main is necessary?
Oh is there? Must have been a mis-click. Yeah, just delete the extra one. ;)

[edit]
Ah, actually I remember duplicating one of the layers when making the scene, so it must have been the main layer I duplicated and that would have gone with it.
 
Last edited by a moderator:

sp202

Member
I can't figure out why the effect only affects objects on layers above the controller object's layer.
 
T

Taddio

Guest
I can't figure out why the effect only affects objects on layers above the controller object's layer.
Ehat do you mean? The only "bug" I found was if you go to the other side completely, the top layer STAYS the top layer, instead of becoming the back layer. I'm guessing it's possible to fix with using instances depth and one single layer, but didn't try it yet.
I spent a good chunk of the night messing with it and start to get the hang of it, it's reeeeeeally cool. Can use it subtle or for drastic effects, it's convincing
 

sp202

Member
If you add more layers in the room editor I found that the projection only affects layers that are above the controller object's own layer, otherwise they look like a regular orthogonal projection.
 
D

Deleted member 13992

Guest
I do this in 2D with fancy layer tricks. Directly inspired by Hollow Knight.

I draw each background layer (view-sized, and from the view) to its own surface. Both tile and object. Apply a shader to it to add depth-of-field/blur and shrink it down slightly towards the center of the surface. Then I stack the surfaces and I get a nice parallaxed depth-of-fielded scenery behind my foreground. The catch is, I had to make my own rendering control object. And some some manual "on layer draw start/end" scripts for the objects.

 

Niels

Member
Last edited:
L

Lonewolff

Guest
I can't figure out why the effect only affects objects on layers above the controller object's layer.
Yes, I found this as well when moving layers around in the layer list, etc. Seems to be a quirk GM's layer system.

For something more robust, I'd certainly recommend manipulating the layers with the matrix functions.
 
Top