Layered Side Image ghosting with dissolve transform

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
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Layered Side Image ghosting with dissolve transform

#1 Post by wyverngem »

I'm using a transform to dissolve when a new side character speaks. However, it has been creating this ghosting effect where the body layer will dissolve before the rest of the layered attributes leaving the face for seconds more. Is there a way to fix this, Here's my code.

Code: Select all

define config.side_image_change_transform = change_transform
transform change_transform(old, new):
    contains:
        old
        alpha 1.0
        linear 0.3 alpha 0.0
    contains:
        new
        alpha 0.0
        linear 0.3 alpha 1.0

Code: Select all

layeredimage side nina:
    xalign 1.0 ypos 575
    always "images/chars/nina/nina_base.png"
    group eyes:
        pos (125, 113)
        attribute open default:
            "nina_eyes_open"
        attribute glance:
            "nina_eyes_glance"
        attribute sad:
            "nina_eyes_sad"
        attribute laugh:
            "nina_eyes_laugh"
        attribute bright:
            "nina_eyes_bright"
        attribute closed:
            "images/chars/nina/blink.png"
    group face:
        pos (111, 73)
        attribute normal default:
            "nina_face_normal"
        attribute calm:
            "nina_face_calm"
        attribute cry:
            "nina_face_cry"
        attribute empty:
            "nina_face_empty"
        attribute laugh:
            "nina_face_laugh"
        attribute scowl:
            "nina_face_scowl"
        attribute smile:
            "nina_face_smile"
        attribute tears:
            "nina_face_tears"   

Code: Select all

image nina_eyes_open:
    "images/chars/nina/o.png"
    choice:
        pause 4
    choice:
        pause 9
    choice:
        pause 6
    "images/chars/nina/blink.png"
    pause 0.1
    "images/chars/nina/ob.png"
    pause 0.1
    repeat

User avatar
Nodus Tollens
Newbie
Posts: 15
Joined: Tue Oct 02, 2018 5:05 am
Projects: Mannequin Academy
itch: nodus-tollens
Contact:

Re: Layered Side Image ghosting with dissolve transform

#2 Post by Nodus Tollens »

Hello! I'm having a similar issue (sorry that I'm bumping with no solution :( ), the weirdest thing being that it did work well for some time, the delay was almost nonexistent, and it started with one character. In my case, it's the appearance of a side image that has 3+ layers. There's an illusion that kind of makes the character appear 'twice', one over the other.

I had to flatten the images and just use them separately... then this disease moved to another character's side image. Body + face work fine, but any other layer and there's this ghosting effect.

I changed absolutely nothing in those layered images structure, nor in the transition, ever since it used to work fine.

I tried using LayeredImageProxy, but it doesn't flatten the copied image. It does save a lot of code though :)

What might be causing the issue? My transition is:

Code: Select all

transform change_character(old,new):
    block:
        old
        alpha 1.0
        linear 0.1 alpha 0.0
    block:
        new
        alpha 0.0
        linear 0.1 alpha 1.0
I can't remember why, but it didn't work with contain.
Mannequin Academy
~ an Omegaverse drama/mystery VN ~

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Layered Side Image ghosting with dissolve transform

#3 Post by wyverngem »

I'm in the same boat still, and I think it is the transform I use too. I think that I'll just have to flatten the images and use stills instead of layers if I want to continue to use this transition effect.

User avatar
Nodus Tollens
Newbie
Posts: 15
Joined: Tue Oct 02, 2018 5:05 am
Projects: Mannequin Academy
itch: nodus-tollens
Contact:

Re: Layered Side Image ghosting with dissolve transform

#4 Post by Nodus Tollens »

Okay so I solved it by using Flatten() to combine old and new character side images. It doesn't seem to be affecting the performance, but it's described as an expensive operation, so I guess it has to be used with caution.

[edit] so the code looks like this:

Code: Select all

transform change_character(old,new):
    block:
        Flatten(old)
        alpha 1.0
        linear 0.1 alpha 0.0
    block:
        Flatten(new)
        alpha 0.0
        linear 0.1 alpha 1.0
One more thing I'd like to know is how to make the first part of the transition conditional (if changed to e.g. 1 second, in reality it takes two, the first second dissolving a nonexistent old side image...). I guess this might be a question for another topic, but if anyone knows, could you let me know or point me to a relevant topic?
Thank you :)
Mannequin Academy
~ an Omegaverse drama/mystery VN ~

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Layered Side Image ghosting with dissolve transform

#5 Post by wyverngem »

So I went ahead and put the Flatten in the code. It does work. There is no ghosting effects and the animation still blinks. Yet, a new issues is caused where the quality is noticeable different between the original and the face. -_- Wish I could help, but I don't really know.

User avatar
Nodus Tollens
Newbie
Posts: 15
Joined: Tue Oct 02, 2018 5:05 am
Projects: Mannequin Academy
itch: nodus-tollens
Contact:

Re: Layered Side Image ghosting with dissolve transform

#6 Post by Nodus Tollens »

Hm, maybe that's what was meant by "expensive"... I never noticed the loss, but I believe there might be some with larger sprites or side images. Thank you for the valuable information! I guess this thread could be marked as half-solved :D I wonder what caused this effect though, it wasn't noticeable before and I can't recall making any change that might affect it. Meh.
Mannequin Academy
~ an Omegaverse drama/mystery VN ~

User avatar
Zetsubou
Miko-Class Veteran
Posts: 522
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Layered Side Image ghosting with dissolve transform

#7 Post by Zetsubou »

I ran into this problem when first implementing layered images, but I'm afraid I don't remember the exact cause.
I think it was one (or all) of these configs: side_image_change_transform, side_image_same_transform, character_callback

IIRC, I removed those and instead used
define config.say_attribute_transition = dissolve
define config.say_attribute_transition_layer = "master"
to achieve an effect similar to what I had before
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Layered Side Image ghosting with dissolve transform

#8 Post by wyverngem »

Zetsubou wrote: Tue May 26, 2020 6:28 pm I ran into this problem when first implementing layered images, but I'm afraid I don't remember the exact cause.
I think it was one (or all) of these configs: side_image_change_transform, side_image_same_transform, character_callback

IIRC, I removed those and instead used
define config.say_attribute_transition = dissolve
define config.say_attribute_transition_layer = "master"
to achieve an effect similar to what I had before
So remove this:
Okay I added those two lines, commented out my old code, and deleted my cache. However, I don't see any changes.

Code: Select all

screen say(who, what, side_image=None, two_window=False):
    style_prefix "say"

    window:
        id "window"

        text what id "what"

        if who is not None:

            window:
                style "namebox"
                text who id "who"

    # If there's a side image, display it above the text. Do not display
    # on the phone variant - there's no room.
#    if not renpy.variant("small"):
    add SideImage() #xalign 1.0 yalign 1.0

Post Reply

Who is online

Users browsing this forum: No registered users