How to achieve "Clipping Mask" effect? Dynamic gradient?

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
Gachapen
Newbie
Posts: 16
Joined: Sat Jan 14, 2023 12:48 pm
Contact:

How to achieve "Clipping Mask" effect? Dynamic gradient?

#1 Post by Gachapen »

I want to apply for example a gradient to a layeredimage, but not everything else. The layeredimage is on its own layer, is there a way to "clip mask" the gradient to only effect the pixels on a specific layer? My sprites have many different outfits, and there are 40 characters, so manually making a gradient for each possible combination is not feasible. For example, on a late afternoon I want to tint the sprites slightly orange without affecting bg with full screen tint. Surely many games have this feature, yet I cannot find any solutions. Thank you.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: How to achieve "Clipping Mask" effect? Dynamic gradient?

#2 Post by _ticlock_ »

Gachapen wrote: Mon Aug 07, 2023 2:26 pm I want to apply for example a gradient to a layeredimage, but not everything else. The layeredimage is on its own layer, is there a way to "clip mask" the gradient to only effect the pixels on a specific layer? My sprites have many different outfits, and there are 40 characters, so manually making a gradient for each possible combination is not feasible. For example, on a late afternoon I want to tint the sprites slightly orange without affecting bg with full screen tint. Surely many games have this feature, yet I cannot find any solutions. Thank you.
One option is to use detached layer. It is pretty close to "clipping mask" effect. This way you can apply transform to the images displayed on the detached layer. For example, tint the sprite/sprites without affecting bg:

Code: Select all

define config.detached_layers += [ "stage" ]
image the_stage = Layer("stage")

label late_afternoon:
    scene bg_scene
    show the_stage:
        matrixcolor TintMatrix("#fa0")
    show eileen onlayer stage
2) Another option is to use LayeredImageProxy(). You can apply different transform for each proxy image

3)You can also use attributes or conditionswitch to apply transform to particular elements of the layered image depending on the attribute/variable.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], jeffster, risukadekei