Layers and Alpha Movie

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
thatGlobito
Newbie
Posts: 5
Joined: Thu Jul 20, 2017 8:53 pm
Projects: Vicky's Afterlife
itch: vickysafterlife
Contact:

Layers and Alpha Movie

#1 Post by thatGlobito »

Hello everyone!

This is Arthur from thatGlobito!

I have a few questions about layers and video, and searched everywhere to find a solution but eventually ended noticing there wasn't anything like what I was looking from (I went through de Documentation and the Forums without luck).

I'm trying to add a effect in Vicky's Afterlife that consists of a new layer above the master layer (character and background). The thing is... I want it to be a video. A video with transparency, to be precise.

I'm trying to go from here:

Image

To this:

Image

...It could perfectly be an image, but a video animation would work even better (artistically talking).
When I try to load the video, as it's done with images, I loaded it this way displaying it into a new layer I named "effect":

Code: Select all

play movie "alpha.mpg" onlayer effect
But then I get this error:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 371: could not parse statement.
    play movie "alpha.mpg" onlayer effect
                           ^

Ren'Py Version: Ren'Py 6.99.9.1168
That means that I can't display a video on a different layer that's not the master one... right? Is it because of the format? Or it's just that it's impossible to display video files on different layers?

That is the main question, but I have another one if there's a chance of the above working:

Can an alpha video work on Ren'Py at all? I gave a try exporting a test video from After Effects with no background, and exported it to .mpg since it's one of the formats that Ren'Py recognizes (MPEG2). Still, I don't know if it does well with alpha channels, since I can only plan the video between backgrounds, on the same layer.

I've been looking at the forums and the Documentation but I can't figure out a proper solution, so I came here for help! It would be great to hear your opinions and thoughts about this, and hopefully find a solution.

Thank you so much for reading this far!
- Arthur.

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Layers and Alpha Movie

#2 Post by mikolajspy »

You can try something like:

Code: Select all

add Movie(size=(1920, 1080))
    on "show" action Play("movie", "movies/test.mpg"
But I'm not sure if it would be above everything.
For transparency, I think you should take a look at Masks - https://www.renpy.org/doc/html/movie.ht ... ie-sprites
You can also define it as "sprite" like in link above and simply show it with for example zorder 5 to keep it above characters.

User avatar
thatGlobito
Newbie
Posts: 5
Joined: Thu Jul 20, 2017 8:53 pm
Projects: Vicky's Afterlife
itch: vickysafterlife
Contact:

Re: Layers and Alpha Movie

#3 Post by thatGlobito »

Thank you for replying!

Okay, so I tried to use that but it seems that it doesn't work either. It does work inside the options.rpy file when adding a video background to the main menu, but when adding it to the game, say, on a layer, I don't know if I'm doing it the wrong way or it just doesn't work:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 372: expected statement.
    add Movie(size=(1920, 1080))
             ^

File "game/script.rpy", line 373: end of line expected.
    on "show" action Play("movie", "alpha.mpg", loop=True)
              ^

Ren'Py Version: Ren'Py 6.99.9.1168
As for the masks, thank you so much! I'll take a look, let's see if it can help me.
- Arthur.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Layers and Alpha Movie

#4 Post by Divona »

Code: Select all

    show image Movie(channel="movie_effect", play="alpha.mpg") onlayer effect
IIRC, alpha doesn't work in Ren'Py though. You have to use alpha mask, which is another black and white (only alpha channel) video on top of the existing movie. For more information, see Movie Displayables and Movie Sprites.
Completed:
Image

Post Reply

Who is online

Users browsing this forum: No registered users