Noir-Style Shadow/Lighting Effects

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Katy133
Miko-Class Veteran
Posts: 700
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Noir-Style Shadow/Lighting Effects

#1 Post by Katy133 » Tue Apr 10, 2018 8:01 pm

I got help on how to do this in another thread, so I thought I'd share what I learned here.

Basically, the code allows you to do this:



It uses Alpha Masks to add lighting or shadows on top of sprites. Similar to a noir film.

Tutorial script I used:

Code: Select all

define s = Character("Sylvie")

transform easeinleft_transform:
     offscreenleft
     easein 1.0 left
     
transform easeinright_transform:
     offscreenright
     easein 1.0 right
     
transform gocenter_transform:
     easein 1.0 center
     
transform centertoleft_transform:
     center
     easein 1.0 left
     
transform centertoright_transform:
     center
     easein 1.0 right

# The game starts here.

label start:

    scene room_morning_light_on

    s "You've created a new Ren'Py game."
    
    s "You see this background? It's called \"room morning light on.\" It's by Uncle Mugen."
    
    #show expression AlphaMask("shadows", At("older man normal", easeinleft_transform)) as mask
    
    show sylvie blue normal at easeinleft_transform
    show expression AlphaMask("shadows", At("sylvie blue normal", easeinleft_transform)) as mask
    
    s "I'm Sylvie."
    
    show sylvie blue normal at gocenter_transform
    show expression AlphaMask("shadows", At("sylvie blue normal", gocenter_transform)) as mask
    
    s "I was in the Ren'Py tutorial game, \"The Question.\""
    
    s "Today, I'm using this video to show you how to use Alpha Masks in your Ren'Py visual novel."
    
    s "A sort of tutorial. I'll post a link to the script I'm using in the video's description."
    
    show sylvie blue normal at centertoleft_transform
    show expression AlphaMask("shadows", At("sylvie blue normal", centertoleft_transform)) as mask
    
    s "Did you know you can create a cool noir lighting effect? All you need is a png image with shadows..."
    
    show expression AlphaMask("light", At("sylvie blue normal", left)) as mask with dissolve
    
    s "Or coloured light."
    
    show sylvie blue normal at gocenter_transform
    show expression AlphaMask("light", At("sylvie blue normal", gocenter_transform)) as mask
    
    s "The Alpha Mask keeps the shadows and light only on me, rather than on the background."
    
    show expression AlphaMask("shadows", At("sylvie blue normal", center)) as mask
    
    s "They have to be semi-transparent..."
    
    show expression AlphaMask("hardshadows", At("sylvie blue normal", center)) as mask with dissolve
    
    s "Or you can use solid shadows for a super-noir, black and white look."
    
    show expression AlphaMask("shadows", At("sylvie blue normal", center)) as mask with dissolve
    
    s "The shadows look like window blinds, right?"
    
    show sylvie blue normal at centertoright_transform
    show expression AlphaMask("shadows", At("sylvie blue normal", centertoright_transform)) as mask
    
    s "I can walk around..."
    
    show sylvie green giggle
    show expression AlphaMask("shadows", At("sylvie green giggle", right)) as mask

    s "I can even turn and change my sprite seamlessly!"
    
    s "Hope this helps!"

    return
A copy of the files and art assets can be found here.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

User avatar
Andredron
Veteran
Posts: 402
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Noir-Style Shadow/Lighting Effects

#2 Post by Andredron » Fri Apr 13, 2018 5:23 pm

An interesting effect. I did everything in the old way - in the photoshop I drowned, now there is an example of how to program such effects. Thank you so much
I know, I'm writing terribly in English.

I'm writing a Renpy textbook (in Russian). https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Honest Critique

Post Reply

Who is online

Users browsing this forum: Uchiha Echinox