Discuss Scratch

Crow_Boy08
Scratcher
1000+ posts

why does infinity color return grayscale?

awesome-llama wrote:

I can guess by looking at the code…
I haven't gone to the length of running it or debugging it, I am only reading it and guessing what the functions are doing with certain data.

One of the places that the effect blocks are implemented is in the sprite fragment shader.
https://github.com/LLK/scratch-render/blob/develop/src/shaders/sprite.frag

Here's the line responsible for changing hue and also setting the RGB colour afterwards. (hsv is a 3D vector here and the x component would be hue, u_color is the value from the colour effect)
hsv.x = mod(hsv.x + u_color, 1.0);
if (hsv.x < 0.0) hsv.x += 1.0;
gl_FragColor.rgb = convertHSV2RGB(hsv);

I assume what's happening is the modulo operator is not able to handle Infinity and so it returns something that ends up affecting the HSV to RGB conversion afterwards in an unexpected way.

Also here's the conversion code:
vec3 convertHue2RGB(float hue)
{
	float r = abs(hue * 6.0 - 3.0) - 1.0;
	float g = 2.0 - abs(hue * 6.0 - 2.0);
	float b = 2.0 - abs(hue * 6.0 - 4.0);
	return clamp(vec3(r, g, b), 0.0, 1.0);
}
vec3 convertHSV2RGB(vec3 hsv)
{
	vec3 rgb = convertHue2RGB(hsv.x);
	float c = hsv.z * hsv.y;
	return rgb * c + hsv.z - c;
}

So basically the r,g, and b are 0?
helloimScratchCat
Scratcher
48 posts

why does infinity color return grayscale?

helloimScratchCat
Scratcher
48 posts

why does infinity color return grayscale?

when green flag clicked
set [color] effect to (1/0)
IceCreamTub
Scratcher
1000+ posts

why does infinity color return grayscale?

I'm pretty sure this is just a result of the puter not knowing how to calculate infinity
colinmacc
Scratcher
1000+ posts

why does infinity color return grayscale?

It doesn't always work, it's not reliable. It depends on the device and on the browser type and version.
I used it once, but now I avoid it.
Comment_master29
Scratcher
1 post

why does infinity color return grayscale?

What is this topic even about?
Crow_Boy08
Scratcher
1000+ posts

why does infinity color return grayscale?

Comment_master29 wrote:

What is this topic even about?
This
set [Color v] effect to (join [Infinity] [])
jlnilocalsip
New Scratcher
100+ posts

why does infinity color return grayscale?

Do you guys not understand the absolute terror of grayscale in Scratch projects

Grayscale puts you in mind of the past. Film noir hardboiled detectives living rainfully in the lightlamped smoky streets seeing so many plotlines go wrong. Overly narrated newsreels depicting huddled masses and military marches from worlds on the brink of destruction. Boiled-laughter sitcoms with a thousand naive punchlines spilling from the mouths of redheads and honeymooners lost to the ages in the picture of a domestic life which never existed. A zeitgeist long gone which now walks intertwining our perceptions of what was and what should be like an infinite warped knot of time upon time. They are all lost souls now, two-fisted heroes of the past liverspotted and grayhaired, wheeled up to the podium at awards ceremonies and appearing in infomercials for social security. Grayscale gives you the nightmare of history from which we are all trying to wake.
Crow_Boy08
Scratcher
1000+ posts

why does infinity color return grayscale?

jlnilocalsip wrote:

Do you guys not understand the absolute terror of grayscale in Scratch projects

Blah blah blah
This is just an excuse to fix the “bug” ROFL

Last edited by Crow_Boy08 (Jan. 26, 2023 21:07:15)

RED-001-alt
Scratcher
1000+ posts

why does infinity color return grayscale?

jlnilocalsip wrote:

Do you guys not understand the absolute terror of grayscale in Scratch projects

Grayscale puts you in mind of the past. Film noir hardboiled detectives living rainfully in the lightlamped smoky streets seeing so many plotlines go wrong. Overly narrated newsreels depicting huddled masses and military marches from worlds on the brink of destruction. Boiled-laughter sitcoms with a thousand naive punchlines spilling from the mouths of redheads and honeymooners lost to the ages in the picture of a domestic life which never existed. A zeitgeist long gone which now walks intertwining our perceptions of what was and what should be like an infinite warped knot of time upon time. They are all lost souls now, two-fisted heroes of the past liverspotted and grayhaired, wheeled up to the podium at awards ceremonies and appearing in infomercials for social security. Grayscale gives you the nightmare of history from which we are all trying to wake.
I agree, I hate grayscale, it's so boring. How did people deal with that back then?
medians
Scratcher
1000+ posts

why does infinity color return grayscale?

It's kinda interesting that it returns different stuff based on what you're on lol

jlnilocalsip wrote:

Do you guys not understand the absolute terror of grayscale in Scratch projects

Grayscale puts you in mind of the past. Film noir hardboiled detectives living rainfully in the lightlamped smoky streets seeing so many plotlines go wrong. Overly narrated newsreels depicting huddled masses and military marches from worlds on the brink of destruction. Boiled-laughter sitcoms with a thousand naive punchlines spilling from the mouths of redheads and honeymooners lost to the ages in the picture of a domestic life which never existed. A zeitgeist long gone which now walks intertwining our perceptions of what was and what should be like an infinite warped knot of time upon time. They are all lost souls now, two-fisted heroes of the past liverspotted and grayhaired, wheeled up to the podium at awards ceremonies and appearing in infomercials for social security. Grayscale gives you the nightmare of history from which we are all trying to wake.
Scratch 2.0 jumpscare

Last edited by medians (Jan. 26, 2023 22:46:52)

Powered by DjangoBB