0 votes

I want to create 2D comic panel with parallax effect and clip content out of its margins.

EDIT: Basically I need parallax background inside a rectangular mask

For non parallax is quite simple with just control node - clip content, but it doesnt work for parallax layers

in Engine by (49 points)
edited by

1 Answer

0 votes

Dear mods: apologies for the accidental double post. Network shenanigans afoot.

One easy way would be to code the content directly so it doesn’t hit the margins. You can use something like a variable and then compare it to the screen size (or viewport) and adjust accordingly. People use it for player objects so you could use it for control nodes/UI elements.
Clamp can handle this, with the first argument being what you’re limiting, the second being the lowest possible value and the third is the maximum. May want to play with the value until you get the effect you want.
Something like:

example : (let’s assume your margin object is called myRectObject)

myRectObject.position.x = clamp(position.x, 0, screensize.x
myRectObject.position.y = clamp(position.y, 0, screensize.y

You can even export a variable to control the margin from the editor:

Export var marginVar = 1
myRectObject.position.x = clamp(position.x, 0, (screensize.x - marginVar)
myRectObject.position.y = clamp(position.y, 0, (screensize.y + marginVar)

You can assign a function like that to your objects and even change that number in the middle until you get the margin right.

Also, i love graphic novel style cutscenes. Hope your work goes well!

by (368 points)
edited by

From what I understand clamp would be for node position, but I would need to cut out pixels from the image, like you would in the viewport shader... basically just like the mask in photoshop

You mean like a windowed parallax scroll? Like a scrolling background inside the comic frames? (That sounds cool btw)

More like biding phone tilt to 2d camera so I can have some 3d effect with parallax layers on each panel.
Also have to consider that there might be more than one panel on the screen, so the panel content should be masked out

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.