[HELP] How to do this portal view effect??

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
XHH
Citizen
Posts: 85
Joined: Thu Jun 20, 2013 6:43 pm
Location: US
Contact:

[HELP] How to do this portal view effect??

Post by XHH »

I've been looking all over for the name of this game that I saw some time ago. Gateways. Randomly just remembered the name, just like that. :'D

Anyways, there's a cool effect when you make a portal in the game. You can see a view of what's in the portal even though this is a 2D game.
Here is an image:
Image

Can this effect be acheived in Love2D and how?!?
I like to draw and program :)
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: [HELP] How to do this portal view effect??

Post by Murii »

I cant help you but i can say that this is achivable because mari0 aleardy done this.
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: [HELP] How to do this portal view effect??

Post by Xgoff »

my guess would be canvases + stencils + math
User avatar
XHH
Citizen
Posts: 85
Joined: Thu Jun 20, 2013 6:43 pm
Location: US
Contact:

Re: [HELP] How to do this portal view effect??

Post by XHH »

Xgoff wrote:my guess would be canvases + stencils + math
:o
What is a stencil?
I like to draw and program :)
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: [HELP] How to do this portal view effect??

Post by veethree »

XHH wrote:
Xgoff wrote:my guess would be canvases + stencils + math
:o
What is a stencil?
https://www.love2d.org/wiki/love.graphics.newStencil
User avatar
XHH
Citizen
Posts: 85
Joined: Thu Jun 20, 2013 6:43 pm
Location: US
Contact:

Re: [HELP] How to do this portal view effect??

Post by XHH »

Ok but that doesn't quite explain what a stencil is and how it can be used for something like this.
I like to draw and program :)
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: [HELP] How to do this portal view effect??

Post by Davidobot »

XHH wrote:Ok but that doesn't quite explain what a stencil is and how it can be used for something like this.
You would use it as a mask for the rendering.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [HELP] How to do this portal view effect??

Post by Jasoco »

It's very complicated. But in simple terms, the stencil masks the drawing area and you'd have to draw everything that's supposed to be in the portal view as well as everything else that's in the camera view. Plus all the math of figuring out where the portal is and should be showing.
Bobbias
Prole
Posts: 36
Joined: Sat Jun 29, 2013 1:26 pm

Re: [HELP] How to do this portal view effect??

Post by Bobbias »

You'd need to check if there are any portals that they player could see through.
Then you'd have to calculate all the angles for those lines on either side of the portal opening based on the angle between your character and the portal edges.
Then you'd have to create a stencil based on the where those lines are and stuff, so you can draw only to the parts of the screen that are "inside the portal".
Then you'd need to figure out how to draw what your character is supposed to see when he looks through the portal. Figuring this part out and actually drawing it is probably a real pain in the ass.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [HELP] How to do this portal view effect??

Post by Jasoco »

Especially if you have the portals facing each other so you see yourself in both and you end up with a recursion loop where it's just mirrored you's over and over. Like when you point a video camera at a monitor that's displaying what the video camera sees.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Semrush [Bot] and 4 guests