A way to display images (or other displayables) with a DDLC-like glitch effect offsetting slices of the image laterally and optionally adding chromatic aberration effects on the glitched slices.
The project is here.
glitch is a function that can be used as a transform (because it takes a displayable as lone argument and returns a displayable).
Its 6 parameters are :
- child : the displayable (~= image) on which the effect is applied. This is the only required argument.
- randomobj : the random object used to generate the slices heights and offsets.
- chroma : boolean indicating whether or not to apply chromatic aberration effects to the glitched tranches. Defaults to True if the system can manage it (which needs gl2 or another model-based renderer to work).
- minbandheight : minimum height of a slice, in pixels. Defaults to 1.
- offset : a positive integer. The actual offset given to a glitched slice will be comprised between -offset and offset. Defaults to 30.
- crop : boolean indicating whether or not to crop the resulting image to make it fit the size of the original image. Defaults to False.
Then, you can define your glitched image as an image to show afterward, using image glitched = glitch("beautifulcharacter angry"), or you can also directly show it using show expression glitch("beautifulcharacter angry") as beautifulcharacter (I strongly recommand using the as clause).
You can also apply it as a transform, with show eileen at glitch or show eileen at renpy.curry(glitch)(chroma=False) or even show layer master at glitch.
The chromatic_offset transform can be used on a standalone basis, especially to apply it to the master layer with show layer master at chromatic_offset.
The aberration effect is applied laterally, on a technical note the the red, green and blue layers of the image are stretch horizontally and then offset laterally with different values.
It takes one optional parameter, chzoom, which determines by exactly how much the layers are stretched. At 1.0 the layers are not streched and the effect is invisible, at lower that 1.0 the left and right boundaries are visible on the sides of the image, so advised values are greater than but close to 1.0. Default is 1.01.
ChromaGlitch : show images with a DDLC-like glitch effect
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.
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.
-
- Newbie
- Posts: 23
- Joined: Thu Aug 06, 2020 9:27 am
- Github: Gouvernathor
- Discord: Armise#6515
- Contact:
- VimislikArt
- Regular
- Posts: 90
- Joined: Sun Mar 06, 2016 6:50 pm
- Projects: King of the Cul-De-Sac
- Deviantart: vimislikart
- itch: vimislikart
- Location: Rochester, NY
- Contact:
Re: ChromaGlitch : show images with a DDLC-like glitch effect
I absolutely love this effect, but I seem to be having trouble running it as an image definition or show it as an expression, and both of them seem to be tied to the issue that it can't process the image in the init phase?
I wrote up a bug report on github, but just in case, I'll include the important traceback lines here:
EXPRESSION:
And for the image definition:
I wrote up a bug report on github, but just in case, I'll include the important traceback lines here:
EXPRESSION:
Code: Select all
File "game/script.rpy", line 14, in script
show expression glitch("eileen happy") as eileen
File "renpy/ast.py", line 1197, in execute
show_imspec(self.imspec, atl=getattr(self, "atl", None))
File "renpy/ast.py", line 1153, in show_imspec
expression = renpy.python.py_eval(expression)
File "renpy/python.py", line 2276, in py_eval
return py_eval_bytecode(code, globals, locals)
File "renpy/python.py", line 2269, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "game/script.rpy", line 14, in <module>
show expression glitch("eileen happy") as eileen
File "game/glitch.rpy", line 16, in glitch
cwidth, cheight = renpy.render(child, 0, 0, 0, 0).get_size()
File "render.pyx", line 170, in renpy.display.render.render
File "render.pyx", line 222, in renpy.display.render.render
AttributeError: 'unicode' object has no attribute 'style'
Code: Select all
Full traceback:
File "renpy/bootstrap.py", line 331, in bootstrap
renpy.main.main()
File "renpy/main.py", line 560, in main
renpy.game.context().run(node)
File "game/script.rpy", line 8, in script
image glitched = glitch("eileen happy")
File "game/script.rpy", line 8, in script
image glitched = glitch("eileen happy")
File "renpy/ast.py", line 1027, in execute
img = renpy.python.py_eval_bytecode(self.code.bytecode)
File "renpy/python.py", line 2269, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "game/script.rpy", line 8, in <module>
image glitched = glitch("eileen happy")
File "game/glitch.rpy", line 16, in glitch
cwidth, cheight = renpy.render(child, 0, 0, 0, 0).get_size()
File "render.pyx", line 170, in renpy.display.render.render
File "render.pyx", line 205, in renpy.display.render.render
Exception: Displayables may not be rendered during the init phase.
Code: Select all
Windows-10-10.0.19041
Ren'Py 7.4.11.2266
SampleScript 1.0
Sat Jan 29 18:19:42 2022
-
- Newbie
- Posts: 23
- Joined: Thu Aug 06, 2020 9:27 am
- Github: Gouvernathor
- Discord: Armise#6515
- Contact:
Re: ChromaGlitch : show images with a DDLC-like glitch effect
Saw the issue first, lol !
For those wondering, it has partially been solved, partially been issued a workaround in the readme.
For those wondering, it has partially been solved, partially been issued a workaround in the readme.
- Pavel8694
- Newbie
- Posts: 4
- Joined: Sat Aug 06, 2022 11:51 am
- Completed: Gachimuchi: Become Dungeon Master, The Casino Incident.
- Organization: Meme Corporation
- itch: meme-corporation
- Contact:
Re: ChromaGlitch : show images with a DDLC-like glitch effect
Thank you so much for this script! Works flawlessly.
I want to find out if there is any way to make a glitch animation? I just thought she was here. (I didn't pass DDLC, so I don't know what this effect looks like there)
I want to find out if there is any way to make a glitch animation? I just thought she was here. (I didn't pass DDLC, so I don't know what this effect looks like there)
-
- Newbie
- Posts: 23
- Joined: Thu Aug 06, 2020 9:27 am
- Github: Gouvernathor
- Discord: Armise#6515
- Contact:
Re: ChromaGlitch : show images with a DDLC-like glitch effect
Yes, it's possible. You can use ATL for that, for example:
Use the randomkey parameter if you want to make the animation periodic : each value for randomkey will generate one specific glitch.
If you want the glitch to be randomly generated every time the animation reaches a glitch, you can remove the randomkey argument.
Code: Select all
image eileen glitched:
glitch("eileen happy", randomkey=23464843)
pause 0.2
glitch("eileen happy", randomkey=3747685)
pause 0.1
glitch("eileen happy", randomkey=85386865)
pause 0.3
repeat
If you want the glitch to be randomly generated every time the animation reaches a glitch, you can remove the randomkey argument.
Last edited by Gouvernathor on Fri Sep 02, 2022 8:23 pm, edited 1 time in total.
- Pavel8694
- Newbie
- Posts: 4
- Joined: Sat Aug 06, 2022 11:51 am
- Completed: Gachimuchi: Become Dungeon Master, The Casino Incident.
- Organization: Meme Corporation
- itch: meme-corporation
- Contact:
Re: ChromaGlitch : show images with a DDLC-like glitch effect
Thank you very much! I'll try it.Gouvernathor wrote: ↑Sat Aug 27, 2022 11:53 am Yes, it's possible. You can use ATL for that, for example:Use the randomkey parameter if you want to make the animation periodic : each value for randomkey will generate one specific glitch.Code: Select all
image eileen glitched: glitch("eileen happy", randomkey=23464843) pause 0.2 glitch("eileen happy", randomkey=3747685) pause 0.1 glitch("eileen happy", randomkey=85386865) pause 0.3 repeat
If you want the glitch to be randomly generated every time the animation reaches a glitch, you can remove the randomkey argument.
Who is online
Users browsing this forum: No registered users