Performance issue with imagebutton hover and ATL on gl2

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
RyuuYukiyama
Newbie
Posts: 4
Joined: Mon Jun 27, 2022 9:39 am
Projects: Hero's Advent
Organization: Platier
itch: ryuuyukiyama
Contact:

Performance issue with imagebutton hover and ATL on gl2

#1 Post by RyuuYukiyama »

Hi all. So in my team's project we built a combat system scene with visual elements and imagebuttons. We wanted to apply color-effects / tint to the sprites along with ATL transitions, and so far we used im.matrixcolor to apply the highlight effect via BrightnessMatrix.
the imagebuttons are structured like this

Code: Select all

imagebutton:
	idle actor.sprite
	hover lit_up(actor.sprite)
	#other attributes
where lit_up is a wrapper function that applies BrightnessMatrix to the sprite.

It works well in gl1/angle1 renderer if the sprite is a raw image to begin with, but the problem is that we're also using Composite, which im.MatrixColor has a problem with for being displayables.

using ATL matrixcolor or feeding BrightnessMatrix into a Transform() displayable doesn't seem to work in gl1, in gl2 it works but we'd encounter this really strange lag on hover and any atl transitions of the sprites in the screen. Using Creator-Defined Displayables in gl2 also suffers from the same lag.

So my question is that is there a feasible fix or workaround for this?

Since ATL matrixcolor can pretty much achieves what we want with relative ease, but it is this lag that's preventing it from being a solid option.

(video for comparison)

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Performance issue with imagebutton hover and ATL on gl2

#2 Post by Imperf3kt »

im.matrixcolor is no longer recommended since the release of renpy 7.4
See this link for details on why.
https://www.renpy.org/doc/html/changelog.html#renpy-7-4

Use matrixcolor instead.
https://www.renpy.org/doc/html/atl.html ... atrixcolor
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
RyuuYukiyama
Newbie
Posts: 4
Joined: Mon Jun 27, 2022 9:39 am
Projects: Hero's Advent
Organization: Platier
itch: ryuuyukiyama
Contact:

Re: Performance issue with imagebutton hover and ATL on gl2

#3 Post by RyuuYukiyama »

Imperf3kt wrote: Tue Jun 28, 2022 12:32 am Use matrixcolor instead.
https://www.renpy.org/doc/html/atl.html ... atrixcolor
Yes, I am aware of ATL's matrixcolor. But that requires gl2 instead, and as I mentioned, using the gl2 renderer causes that strange lag as you can see in the video.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Performance issue with imagebutton hover and ATL on gl2

#4 Post by Imperf3kt »

Are you sure you were using matrixcolor and not im.matrixcolor?
Without any sample of the section where you use this, we cannot tell.

I ask, because according to the changelog, matrixcolor should be significantly faster, not slower.
While previous versions of Ren’Py supported the im.MatrixColor() image manipulator, the new property is much improved. The image manipulator would often take a large fraction of a second, making it too slow for real-time use, and was limited to single images. The new transform property is fast enough that it can be changed every frame if necessary, and can be applied to any displayable
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
RyuuYukiyama
Newbie
Posts: 4
Joined: Mon Jun 27, 2022 9:39 am
Projects: Hero's Advent
Organization: Platier
itch: ryuuyukiyama
Contact:

Re: Performance issue with imagebutton hover and ATL on gl2

#5 Post by RyuuYukiyama »

Currently we're using im.matrixcolor because it works with the GL1 renderer and does not cause any lag.

We would love to switch to ATL matrixcolor, but the issue here is that would require switching the renderer to GL2 and the imagebutton hovering has that significant lag on the GL2 renderer.

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Performance issue with imagebutton hover and ATL on gl2

#6 Post by PyTom »

What's the definition of lit_up?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
RyuuYukiyama
Newbie
Posts: 4
Joined: Mon Jun 27, 2022 9:39 am
Projects: Hero's Advent
Organization: Platier
itch: ryuuyukiyama
Contact:

Re: Performance issue with imagebutton hover and ATL on gl2

#7 Post by RyuuYukiyama »

PyTom wrote: Fri Jul 01, 2022 8:33 pm What's the definition of lit_up?

Code: Select all

def lit_up(image):
   x = im.MatrixColor(image, im.matrix.brightness(0.23))
   return x
but the issue is that in GL2 renderer, it still lags even if I use ATL matrixcolor like this:

Code: Select all

screen battle_portrait(actor):
   $ isHit = actor.isHit
	
   showif isHit:
      add actor.sprite:
         matrixcolor BrightnessMatrix(0.23)
   else:
      add actor.sprite

Post Reply

Who is online

Users browsing this forum: Google [Bot], Rhapsy