Making 2.5d / Parallax backgrounds

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
ChroniclerOfLegends
Regular
Posts: 53
Joined: Thu Feb 16, 2017 5:57 pm
Projects: Scifi Non-Linear Visual Novel/Arcade/Adventure game. (No name yet)
Contact:

Making 2.5d / Parallax backgrounds

#1 Post by ChroniclerOfLegends »

I have seen a really cool effect in a couple of visual novels.

In them, along with static backgrounds, you will see backgrounds that are made up of multiple layers giving a somewhat 3d effect or 'pop-up book' effect
Interesting effects that can be done with this include:

Moving clouds on landscape backgrounds.
Panning across a room and 'foreground' objects moving at a different speed than background objects.

I am tinkering with ATL and trying to figure out how to do this efficiently.
(Specifically, I have a scene made up of two spaceships and a galaxy background. The galaxy is made of 4 layers for different distances.
I want to focus on one ship, and then pan from the left to the right with each layer moving different speeds, and end up focusing on the right ship.)

Has anybody messed with creating backgrounds like this before? I was looking for some advice.

I am curious if you can define the whole animation in one layered background image that you can then just show, or if you will have to make an entirely new ATL block every time you pan the scene.

The main difficulty I am having so far is trying to get the background and foreground images to start moving at the same time.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Making 2.5d / Parallax backgrounds

#2 Post by trooper6 »

Have you searched the forums for the word parallax?
For example:
viewtopic.php?t=47482
viewtopic.php?t=31201
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
ChroniclerOfLegends
Regular
Posts: 53
Joined: Thu Feb 16, 2017 5:57 pm
Projects: Scifi Non-Linear Visual Novel/Arcade/Adventure game. (No name yet)
Contact:

Re: Making 2.5d / Parallax backgrounds

#3 Post by ChroniclerOfLegends »

I had, but player controlled parallax or a starfield wasn't really what I was looking for.
I did end up finding an external tutorial that helped me out:
http://traumendes-madchen.com/blog/?p=1395
I hadn't ever heard of the 'contains' keyword for defining images.
I got it working exactly how I wanted like so:

Code: Select all

image testlayeredbackground:
        contains:
            xalign 0.0
            'bg_space_long_1'
            pause 1.5
            ease 2.5 xalign 0.60
        contains:
            xalign 0.0
            'bg_space_long_2'
            pause 1.5
            ease 2.5 xalign 0.70
        contains:
            xalign 0.0
            'bg_space_long_3'
            pause 1.5
            ease 2.5 xalign 0.80
        contains:
            xalign 0.0
            'bg_space_long_4'
            pause 1.5
            ease 2.5 xalign 0.90
        contains:
            xalign 0.2
            yalign 0.5
            'fg_ih_side_normal'
            pause 1.5
            ease 2.0 xalign -1.5
EDIT: Even though I ended up answering my own question, I thought I would leave what I figured out to make it easier for people to make easy animated backgrounds in the future if they happen upon this thread. I also figured out you can stack apply atl to create some pretty neat effects:
(Zoom out of focus on one object, pan across the background, zoom in focus on another object):

Code: Select all

image testlayeredbackground:
        parallel:
            zoom 1.5
            xalign 0.2 yalign 0.5 # location of first focus
            pause 1.5
            ease 2 zoom 1.0 # Zoom out
            pause 1.5
            ease 2 zoom 1.5 xalign 1.0 yalign 0.5 # location of second focus
        parallel:
            contains:
                xalign 0.0
                'bg_space_long_1'
                pause 3
                ease 2.5 xalign 0.65
            contains:
                xalign 0.0
                'bg_space_long_2'
                pause 3
                ease 2.5 xalign 0.75
            contains:
                xalign 0.0
                'bg_space_long_3'
                pause 3
                ease 2.5 xalign 0.85
            contains:
                xalign 0.0
                'bg_space_long_4'
                pause 3
                ease 2.5 xalign 1.0
            contains:
                xalign 0.2
                yalign 0.5
                'fg_ih_side_normal'
                pause 3
                ease 2.0 xalign -1.5
Last edited by ChroniclerOfLegends on Sat Jul 28, 2018 12:07 am, edited 1 time in total.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Making 2.5d / Parallax backgrounds

#4 Post by trooper6 »

Contains is ATL...you can read up more on it here: https://www.renpy.org/doc/html/atl.html ... t=contains
And Yay for getting you image to work how you want!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Google [Bot], tim640