Image Distortion Effect possible with Ceator-Defined Displayable?

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
gamedriver
Newbie
Posts: 20
Joined: Fri May 15, 2020 2:19 am
Contact:

Image Distortion Effect possible with Ceator-Defined Displayable?

#1 Post by gamedriver »

.
Hi to all RenPy powerusers,

I am looking for an ingame (=runtime) effect like this:

https://ibb.co/kxxQV2J

1) Some image which is shown in RenPy normally first.
2) The user clicks with the mouse pointer on any point on this image. As long as LMB is hold (or some condition like this) the image is distorted, depending on the movement of the mouse pointer.
3) The user can distort the image in any direction, like it is printed on an elastic rubber tissue.
4) When LMB is released, the image snaps back to normal condition.

I experimented a little with Creator-Defined Displayables, beginning with the example of the manual. At the moment my finding is that such pixelbased image manipulation are not possible in RenPy, only changing alpha and the like.

Am I right or do you think it may be possible to realize such an effect with a CDD?
Or by any other method avialable?

I found this about shaders:
https://github.com/valery-iwanofu/renpy ... /waves.rpy
Unfortunately my knowledge about shading is mediocre, so I am looking for another way, hopefully easier...
Ren´py rookie unlimited...

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

Re: Image Distortion Effect possible with Ceator-Defined Displayable?

#2 Post by _ticlock_ »

gamedriver wrote: Sun Aug 27, 2023 10:45 am Am I right or do you think it may be possible to realize such an effect with a CDD?
Or by any other method avialable?

I found this about shaders:
https://github.com/valery-iwanofu/renpy ... /waves.rpy
Unfortunately my knowledge about shading is mediocre, so I am looking for another way, hopefully easier...
Not sure if you can do this without using shaders (maybe using some image manipulation, pygame library, or other shaders). Here are a couple of examples that you may find useful:
https://github.com/Gouvernathor/renpy-C ... /tree/main
viewtopic.php?t=60668
Maybe you could do something similar, applying some scaling.

However, the correct way to do this is by using a shader and a CDD. The shader should do the distortion. Possibly, it should receive a touch point and drag vector. You can try to find something like that for the fragment shader. For CDD, the event method should update the touch point and drag vector, and in the render method, you can apply the shader to the image with the updated touch point and drag vector.

User avatar
gamedriver
Newbie
Posts: 20
Joined: Fri May 15, 2020 2:19 am
Contact:

Re: Image Distortion Effect possible with Ceator-Defined Displayable?

#3 Post by gamedriver »

Thanks, _ticlock_. This confirms my fear that I have to confront myself with the occult mysteries of the shader sciences...
Ren´py rookie unlimited...

Post Reply

Who is online

Users browsing this forum: Google [Bot]