Author Topic: Theme to demonstrate CRT shaders  (Read 3128 times)

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 490
    • View Profile
    • My deviantart page
Re: Theme to demonstrate CRT shaders
« Reply #15 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...

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 939
    • View Profile
Re: Theme to demonstrate CRT shaders
« Reply #16 on: December 09, 2018, 05:46:34 AM »
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

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 490
    • View Profile
    • My deviantart page
Re: Theme to demonstrate CRT shaders
« Reply #17 on: December 09, 2018, 07:52:21 AM »
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

Luke_Nukem

  • Sr. Member
  • ****
  • Posts: 135
    • View Profile
    • Blogging about Rust lang
Re: Theme to demonstrate CRT shaders
« Reply #18 on: December 09, 2018, 10:19:19 AM »
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

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 490
    • View Profile
    • My deviantart page
Re: Theme to demonstrate CRT shaders
« Reply #19 on: December 10, 2018, 12:31:24 AM »
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...

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 939
    • View Profile
Re: Theme to demonstrate CRT shaders
« Reply #20 on: December 10, 2018, 03:21:28 AM »
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.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 939
    • View Profile
Re: Theme to demonstrate CRT shaders
« Reply #21 on: December 11, 2018, 05:30:01 AM »
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:

Code: [Select]
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'

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 490
    • View Profile
    • My deviantart page
Re: Theme to demonstrate CRT shaders
« Reply #22 on: December 11, 2018, 05:40:17 AM »

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?

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 939
    • View Profile
Re: Theme to demonstrate CRT shaders
« Reply #23 on: December 11, 2018, 12:01:36 PM »

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:

Code: [Select]
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'

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 490
    • View Profile
    • My deviantart page
Re: Theme to demonstrate CRT shaders
« Reply #24 on: February 13, 2019, 07:13:55 AM »
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:

Code: [Select]
        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:

Code: [Select]
        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.