Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - zpaolo11x

Pages: [1] 2 3 ... 12
1
Scripting / Re: Down and dirty filter
« on: Yesterday at 10:15:31 PM »
You just inspired me to add a variation on my "More of the same..." menu: not just from the same year, but from the same decade!

2
Themes / Re: help with controls on a theme
« on: October 15, 2018, 11:17:50 AM »
@zapaolo11x interesting. Do you have a layout of yours I can reference to understand why? I would have thought the other way around. List index can change, but it’s easy for lots of things to hook into a signal change and execute code with it.

My Arcadeflow theme uses this method, the layout is huge with a lot of stuff happening, I can craft a minimal version if you think it's useful. If I remember well, I didn't use "next game" "prev game" because I didn't like the transitions it triggered, therefore I'm using index++ with a custom method to take care of long keypresses.

3
Themes / Re: help with controls on a theme
« on: October 15, 2018, 08:02:06 AM »
this is what i use in my own themes, and just alter as needed


I do something similar but instead of signaling "next game" and "prev game" I just use fe.list.index++ or fe.list.index--. Why? I honestly don't remember, something to do with how transitions are managed when signaling instead of pressing keys.

4
Scripting / Re: Squirrel development environment
« on: October 15, 2018, 06:22:40 AM »
I just use Visual Studio Code with Squirrel Language Highlight extension by Richard Bowker, and Shader languages support by slevesque. I always run attract from the console and mostly use "print" commands for basic debug. Not the best but it works.

5
Themes / Re: Arcadeflow theme v 2.7 [Release] Updated 11 October 2018
« on: October 11, 2018, 05:17:48 AM »
Updated to 2.7 but it seems I'm unable to upload the archive... You can download it from github: https://github.com/zpaolo11x/Arcadeflow-AM-Theme/releases

UPDATE: I was able to upload the correct file in the first post

Main new feature of this version: you can define a custom resolution independent from your screen resolution. Good for testing purposes or if for whatever reason you need a different aspect ratio. In the picture a 4:3 layout on a 16:10 screen (with black pillars)

6
Scripting / Re: GLSL colorizer and color conversion routines
« on: October 09, 2018, 10:18:07 AM »
And this is a simple "desaturate" filter, it uses luminosity from HSL instead of HSV, it looks more natural in my opinion...

Code: [Select]
uniform sampler2D texture;

float luminosity( in vec3 c ){
float s = 0.0;
float l = 0.0;

float cMin = min( c.r, min( c.g, c.b ) );
float cMax = max( c.r, max( c.g, c.b ) );
l = ( cMax + cMin ) / 2.0;

if ( cMax > cMin ) {
float cDelta = cMax - cMin;
       
        //s = l < .05 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
s = l < .0 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
       
}
return float( l );
}


void main()
{   

vec2 uv = gl_TexCoord[0].xy;
vec4 t0 = texture2D(texture, uv);
float hsl0 = luminosity (t0.rgb);

gl_FragColor = vec4(vec3(hsl0) , gl_Color.a*t0.a);

}

7
Scripting / GLSL colorizer and color conversion routines
« on: October 09, 2018, 07:46:44 AM »
I jsut developed a small shader for colorizing, it uses HSL color space which looks much better than HSV. But in the code you can find some useful color conversion functions that you can use for many purposes like desaturation, hue rotation etc.

The shader requires an HSL vector of three values that are used for colorizing, plus a texture mix value if you want to blend (in RGB) the colorized with the default image.

Code: [Select]
uniform sampler2D texture;
uniform vec3 hsl;
uniform float texmix;

vec3 hsl2rgb( in vec3 c )
{
    vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );
    return c.z + c.y * (rgb-0.5)*(1.0-abs(2.0*c.z-1.0));
}

vec3 rgb2hsl( in vec3 c ){
  float h = 0.0;
float s = 0.0;
float l = 0.0;
float r = c.r;
float g = c.g;
float b = c.b;
float cMin = min( r, min( g, b ) );
float cMax = max( r, max( g, b ) );

l = ( cMax + cMin ) / 2.0;
if ( cMax > cMin ) {
float cDelta = cMax - cMin;
       
        //s = l < .05 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) ); Original
s = l < .0 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
       
if ( r == cMax ) {
h = ( g - b ) / cDelta;
} else if ( g == cMax ) {
h = 2.0 + ( b - r ) / cDelta;
} else {
h = 4.0 + ( r - g ) / cDelta;
}

if ( h < 0.0) {
h += 6.0;
}
h = h / 6.0;
}
return vec3( h, s, l );
}


vec3 rgb2hsv(vec3 c)
{
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

vec3 hsv2rgb(vec3 c)
{
    vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

void main()
{   

vec2 uv = gl_TexCoord[0].xy;

vec4 t0 = texture2D(texture, uv);
vec3 hsl0 = rgb2hsl (t0.rgb);

vec3 hsl1 = vec3(hsl.x,hsl.y,hsl0.z);

vec3 tch = hsl2rgb (hsl1);


gl_FragColor = vec4(mix(hsl.z*tch.xyz,t0.xyz,texmix) , gl_Color.a*t0.a);

}

This is a sample layout

Code: [Select]
local pic1 = fe.add_artwork("snap",0,0,400,400)
pic1.video_flags = Vid.ImagesOnly
pic1.preserve_aspect_ratio = false

local pic2 = fe.add_artwork("snap",400,0,400,400)
pic2.video_flags = Vid.ImagesOnly
pic2.preserve_aspect_ratio = false

local pic3 = fe.add_artwork("snap",800,0,400,400)
pic3.video_flags = Vid.ImagesOnly
pic3.preserve_aspect_ratio = false

local colorshader1 = fe.add_shader(Shader.Fragment,"colorizer.glsl")
colorshader1.set_texture_param("texture")
colorshader1.set_param("hsl",0.6,0.5,1.0)
colorshader1.set_param("texmix",0.0)
pic1.shader = colorshader1

local colorshader2 = fe.add_shader(Shader.Fragment,"colorizer.glsl")
colorshader2.set_texture_param("texture")
colorshader2.set_param("hsl",0.6,1.0,1.0)
colorshader2.set_param("texmix",0.0)
pic2.shader = colorshader2



8
Scripting / Re: GLSL gaussian blur without nested surfaces
« on: October 08, 2018, 07:10:05 AM »
Nicely done! I would add mipmap to reduce shimmering.

Absolutely right, I forget to add mipmap since it gave me issues with AM2.3, but now I can't even run AM 2.3 anymore on my Mac (uninstalled Homebrew) so I should embrace mipmapping completely :D

9
Scripting / Re: GLSL gaussian blur without nested surfaces
« on: October 08, 2018, 07:09:04 AM »
Consider that this solution is good if you only have to blur an image or a video, for more complex tasks the nested surfaces solution is probably more flexible. In my theme, I have two blurred pictures on a surface that are cross-faded, to use this method I'll have to add shaders to both pictures while now I just use shaders for the "parent" surface. Of course I could always add a cross-fade routine inside the shader but you get the point :D 

10
Scripting / GLSL gaussian blur without nested surfaces
« on: October 08, 2018, 02:19:10 AM »
Inspired by Oomek work with feedback trails, I put together a quick and dirty layout for gaussian blur using a similar trick without need for nested surfaces.

What do you think? It scales down the initial surface so it can work on a lower resolution instance of the picture, but has issues if you turn on aspect ratio (you should then pass the actual resolution to the shader using subimg.x and subimg.y).

Code:

Code: [Select]

local picwidth = 64.0
local su0 = fe.add_surface(picwidth,picwidth)
local su1 = fe.add_surface(picwidth,picwidth)

local pic = su0.add_artwork("snap",0,0,picwidth,picwidth)
pic.video_flags = Vid.ImagesOnly
pic.preserve_aspect_ratio = false

local sh0 = fe.add_shader( Shader.Fragment, "gauss_kernsigma_o2.glsl" )
local sh1 = fe.add_shader( Shader.Fragment, "gauss_kernsigma_o2.glsl" )

pic = su0.add_clone (pic)
sh0.set_texture_param( "texture",pic)
sh0.set_param("kernelData", 21.0, 3.0)
sh0.set_param("offsetFactor", 1.0/picwidth, 0.0)
sh0.set_param("reverse",1.0)
pic.shader = sh0

pic = su1.add_clone (pic)
sh1.set_texture_param( "texture",su0)
sh1.set_param("kernelData", 21.0, 3.0)
sh1.set_param("offsetFactor", 0.0, 1.0/picwidth)
sh1.set_param("reverse",0.0)
pic.shader = sh1

su0.visible = false
su1.set_pos (0,0,600,600)


shader:

Code: [Select]

uniform sampler2D texture;
uniform vec2 kernelData;
uniform vec2 offsetFactor;
uniform float reverse;

void main() {

    vec3 incrementalGaussian;
    incrementalGaussian.x = 1.0 / (sqrt(2.0 * 3.14) * kernelData.y);
    incrementalGaussian.y = exp(-0.5 / (kernelData.y * kernelData.y));
    incrementalGaussian.z = incrementalGaussian.y * incrementalGaussian.y;

    vec2 uv = gl_TexCoord[0].xy;
    if (reverse == 1.0) {
       uv.y = 1.0 - uv.y;
    }
    vec4 color = vec4(0.0);
    float kersum = 0.0;

    color += texture2D(texture, uv) * incrementalGaussian.x;
    kersum += incrementalGaussian.x;
    incrementalGaussian.xy *= incrementalGaussian.yz;


    for (float i = 1.0 ; i <=   (kernelData.x - 1.0)*0.5 ; i++) {
        color += texture2D(texture, uv - i * offsetFactor ) * incrementalGaussian.x;         
        color += texture2D(texture, uv + i * offsetFactor ) * incrementalGaussian.x;         
        kersum += 2.0 * incrementalGaussian.x;
        incrementalGaussian.xy *= incrementalGaussian.yz;
    }
   
    gl_FragColor = color/kersum;
}


11
Scripting / Re: Phosphor retention effect
« on: October 08, 2018, 01:30:17 AM »
My intention was to only show how can you get a previous frame and use it in the shader. What you will build on top of that is up to you.

This is very interesting... I'm thinking of a way to use it to do double pass shaders (without using nested surfaces that is), do you think it's possible? The stuff you can do with surfaces is amaznig :)

12
Scripting / Re: Nested surfaces and speed of update
« on: October 08, 2018, 01:12:41 AM »
I get 60 fps in all 3 modes.
i5 2500K, GTX 980
GPU usage respectively 1%,2%,3%

Seems fine, of course you can increase the number of tiles to see when everything starts to slow down. On my macbook pro it gets slower at level 3 with the current number of tiles, but that's due to the integrated graphics which has some limitations. I suspect that my Arcadeflow theme (which runs at ~45 fps on my late 2013 macbook pro with retina display) should run at full speed on a system like yours...

Thanks for the feedback!

13
Themes / Re: Theme to demonstrate CRT shaders
« on: October 05, 2018, 02:31:58 AM »
any one know how to add a line to make these shaders work with the Fade module
thanks.......

I don't know the fade module well enough, I guess that it uses alpha channel to fade objects... my experience is that if you apply alpha values to the "mother" surface it works, while on the image itself it doesn't...

14
Themes / Re: Arcadeflow theme v 2.6 [Release] Updated 2 October 2018
« on: October 02, 2018, 10:39:20 PM »
Another release! You're a machine!

LOL actually this should've been release 2.5, but I had the rotation option ready and I thought I was not going to fix frosted glass so soon... maybe I should use "minor" release numbers :D

15
Themes / Re: Arcadeflow theme v 2.6 [Release] Updated 2 October 2018
« on: October 02, 2018, 07:38:36 AM »
Arcadeflow 2.6 is out with a new "frosted glass" menu background!

Enjoy and report any bugs!

Pages: [1] 2 3 ... 12