Attract-Mode Support Forum
Attract-Mode Support => Themes => Topic started by: Luke_Nukem on September 19, 2018, 11:26:58 PM
-
UPDATED: Split shaders in to own themes for easier viewing.
I ended up finally finishing off some other stuff I started years ago - namely, a small theme just to show videos using a few different types of CRT shaders.
Gitlab link (https://gitlab.com/Luke-Nukem/crt-shader-theme)
You'll need to play around with things to get nice settings for yourself.
Link to high quality photos of running on an 4:3 LCD machine (https://drive.google.com/open?id=1QVMXu5mfV1h4dXcEwQcYu8f35I5Mz55R)
-
Change "movie" to "snap", or nothing will be seen... 8)
-
Change "movie" to "snap", or nothing will be seen... 8)
Lol! It's been a while. I still have some 3 year old settings floating around.
-
Attached scaled photo of Lottes CRT shader - this is the better one, also used in flat_blue theme, but without the curvature or rounded corners.
-
Attached scaled photo of CGWG CRT shader - this is the "CRT" labelled one.
-
UPDATED: Split shaders in to own themes for easier viewing.
Attachment replaced in OG post. Also added to attractmode-extra, awaiting merge.
-
This is really nice, I'm planning to add some lotte shaders to my theme, for the "info" page where you can see a larger version of the game movie, adding this CRT effect would look great. I wish I had more time to dedicate to theme making, but real work needs to be done sometimes :D
-
This is really nice, I'm planning to add some lotte shaders to my theme, for the "info" page where you can see a larger version of the game movie, adding this CRT effect would look great. I wish I had more time to dedicate to theme making, but real work needs to be done sometimes :D
I've added yet another shader to the collection, a Halation style one. Which is sort of the cgwg one with extra effects. It really requires an input of a previous frame, which I can't get from AM unless I dive in to the source further.
No new archive, you'll need to get it from the git.
Sounds like your theme will be good!
-
I'm playing with your CGWG shader implementation (that's much better than my own CRT shader of course) but is there a way to have a transparent background instead of black?
-
I must not have noticed due to using a black background for testing. I'll see what I can come up with, ours probably missing the alpha channel.
-
probably missing the alpha channel.
Yes, indeed the last line of the fragment shader is:
gl_FragColor = vec4(mul_res*brightmult, 1.0);
so basically the alpha is disregarded.
-
I must not have noticed due to using a black background for testing. I'll see what I can come up with, ours probably missing the alpha channel.
I found how to do it: just change the last line of the fragment shader to:
gl_FragColor = vec4(mul_res, cval);
instead of
gl_FragColor = vec4(mul_res, 1.0);
-
I must not have noticed due to using a black background for testing. I'll see what I can come up with, ours probably missing the alpha channel.
I found how to do it: just change the last line of the fragment shader to:
gl_FragColor = vec4(mul_res, cval);
instead of
gl_FragColor = vec4(mul_res, 1.0);
Glad you found it yourself. Sorry I haven't had much time to update things yet.
-
You can also apply a similar modification to the Lotte shader, just replace the void function at the end with this:
void main(void)
{
#ifdef CURVATURE
vec2 pos = radialDistortion(texCoord);//CURVATURE
//FINAL//
gl_FragColor.rgb = Tri(pos) * Mask(gl_FragCoord.xy) * vec3(corner(pos));
#else
vec2 pos = gl_TexCoord[0].xy;
gl_FragColor.rgb = Tri(pos) * Mask(gl_FragCoord.xy);
#endif
#ifdef YUV
gl_FragColor.rgb = vec3(dot(YUVr,gl_FragColor.rgb), dot(YUVg,gl_FragColor.rgb), dot(YUVb,gl_FragColor.rgb));
gl_FragColor.rgb = clamp(ToSrgb(gl_FragColor.rgb), 0.0, 1.0);
#endif
#ifdef GAMMA_CONTRAST_BOOST
gl_FragColor.rgb=brightMult*pow(gl_FragColor.rgb,gammaBoost )-vec3(blackClip);
#endif
gl_FragColor.a = corner(pos);
}
-
any one know how to add a line to make these shaders work with the Fade module
thanks.......
-
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...
-
Tested on:
10.13.6 (17G3025)
iMac (27-inch, Mid 2011)
2.7 GHz Intel Core i5
12 GB 1333 MHz DDR3
AMD Radeon HD 6770M 512 MB
CRT-CGWG: pass
CRT-Halation: pass with errors
Failed to compile fragment shader:
ERROR: 0:1: '' : version '130' is not supported
Failed to compile vertex shader:
ERROR: 0:1: '' : version '130' is not supported
CRT-Lottes: pass
CRT-Lottes-Multipass: fail
Failed to compile vertex shader:
ERROR: 0:1: '' : version '130' is not supported
Failed to compile vertex shader:
ERROR: 0:1: '' : version '130' is not supported
-
CRT-CGWG: pass
CRT-Halation: pass with errors
Failed to compile fragment shader:
ERROR: 0:1: '' : version '130' is not supported
This is because of OpenGL support on MacOS, I got the same error in my tests. MacOS doesn't allow to mix versions of OpenGL, and furthermore AFAIK XQuartz only support OpenGL 1.2
-
CRT-CGWG: pass
CRT-Halation: pass with errors
Failed to compile fragment shader:
ERROR: 0:1: '' : version '130' is not supported
This is because of OpenGL support on MacOS, I got the same error in my tests. MacOS doesn't allow to mix versions of OpenGL, and furthermore AFAIK XQuartz only support OpenGL 1.2
Changing the version number in the shaders works fine for macOS
-
Changing the version number in the shaders works fine for macOS
Good to know! I know it's not good practice but I discovered that to keep portability it's better to develop for the older OpenGL standard...
-
My iMac that I had to take a loan out for is now officially obsolete due to Mac OS X changing video requirements. I wish Apple would stop all these GUI enhancements and kept it simple like OS9. I don’t need 10 ways to open an app. I would much prefer clicking shutdown and having an instant black screen like on my 333mhz and 433mhz macs with os9.
-
CRT-CGWG: pass
CRT-Halation: pass with errors
Failed to compile fragment shader:
ERROR: 0:1: '' : version '130' is not supported
This is because of OpenGL support on MacOS, I got the same error in my tests. MacOS doesn't allow to mix versions of OpenGL, and furthermore AFAIK XQuartz only support OpenGL 1.2
Changing the version number in the shaders works fine for macOS
If I change #version 130 to #version 120 on each shader with crt-lottes-multipass, I get the following errors:
Failed to compile fragment shader:
ERROR: 0:101: Invalid call of undeclared identifier 'texture'
Failed to compile fragment shader:
ERROR: 0:103: Invalid call of undeclared identifier 'texture'
ERROR: 0:309: Invalid call of undeclared identifier 'texture'
-
If I change #version 130 to #version 120 on each shader with crt-lottes-multipass, I get the following errors:
What if you get rid of the #version 120 line completely?
-
If I change #version 130 to #version 120 on each shader with crt-lottes-multipass, I get the following errors:
What if you get rid of the #version 120 line completely?
Commented out or removed:
Failed to compile fragment shader:
ERROR: 0:59: '==' does not operate on 'float' and 'int'
ERROR: 0:67: '==' does not operate on 'float' and 'int'
ERROR: 0:77: '==' does not operate on 'float' and 'int'
ERROR: 0:85: '==' does not operate on 'float' and 'int'
ERROR: 0:101: Invalid call of undeclared identifier 'texture'
Failed to compile fragment shader:
ERROR: 0:61: '==' does not operate on 'float' and 'int'
ERROR: 0:69: '==' does not operate on 'float' and 'int'
ERROR: 0:79: '==' does not operate on 'float' and 'int'
ERROR: 0:87: '==' does not operate on 'float' and 'int'
ERROR: 0:103: Invalid call of undeclared identifier 'texture'
ERROR: 0:309: Invalid call of undeclared identifier 'texture'
-
Ok just a quick update, I've noticed that as they are set sometimes the scanlines don't correspond 1:1 with the pixel resolution of the snaps. For the CGWG shader there are a lot of "resolution" parameter I can't get to grips with, but what's sure is that in the vertex shader there's a division by 200, so all snaps have 200 scanlines. I think you can pass the texture_height to that shader to fix this.
On the other hand I've found how to fix Lotte shaders with this respect. Notice that your layout file has this lines:
video.shader.set_param("color_texture_sz", vidSurf.width/4, vidSurf.height/4);
video.shader.set_param("color_texture_pow2_sz", vidSurf.width/4, vidSurf.height/4);
To make it work better I changed the first line so that it passes actual texture size to the shader, and also added support for vertical scanlines using the "vert" parameter. I didn't care to calculate the power of 2 texture for the other field, but it seems to work well anyway. Substitute the two lines with these:
video.shader.set_param("vert", (video.texture_width > video.texture_height ? 0.0 : 1.0));
video.shader.set_param("color_texture_sz", video.texture_width, video.texture_height);
video.shader.set_param("color_texture_pow2_sz", video.texture_width, video.texture_height);
In this way you'll get correct scanlines that are exactly the same number as the vertical resolution, while aperture mask will be calculated as always at full resolution.