Pete´s Messageboard... No ISO/BIOS requests!

Homepage Members Register Login Search Old board


Neuer Thread ...


AuthorTopics » Book an abo for this threadClose Thread Move Thread Fix the thread Print view Delete this thread

80T 



...

Status:Offline
Date registered: 22.06.2011
Post:4
Send Message
...   Created on 22.03.2014 - 02:47Jump to top Quote this post Report this post Edit Delete


Is it possible to convert this vsh/fsh shader from PPSSPP emulator to vp/fp or slv/slf for OGL2 ?
It's a nice CRT shader with pseudo NTSC filter (R&G color bleed) simulated interlacing effect and kind of a "rollbar" effect. Very nice for low res games.

Source: http://forums.ppsspp.org/showthread.php … 6#pid61986

crt.vsh

Code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
 
attribute vec4 a_position;

attribute vec2 a_texcoord0;

varying vec2 v_texcoord0;


void main() {
    v_texcoord0 = a_texcoord0;
    gl_Position = a_position;

}


crt.fsh
Code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
 
// Retro (CRT) shader, created to use in PPSSPP.

#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif

void main()
{
    // scanlines
    int vPos = int( ( v_texcoord0.y + u_time.x * 0.5 ) * 272.0 );
    // ^ ^ 240.0 for most PS1 games... ?
    // Though resolution in PS1 games tends to vary... ?
    float line_intensity = mod( float(vPos), 2.0 );
    
    // color shift
    float off = line_intensity * 0.001;
    vec2 shift = vec2( off, 0 );
    
    // shift R and G channels to simulate NTSC color bleed
    vec2 colorShift = vec2( 0.001, 0 );
    float r = texture2D( sampler0, v_texcoord0 + colorShift + shift ).x;
    float g = texture2D( sampler0, v_texcoord0 - colorShift + shift ).y;
    float b = texture2D( sampler0, v_texcoord0 ).z;
    
    vec4 c = vec4( r, g * 0.99, b, 1 ) * clamp( line_intensity, 0.85, 1 );
    
    float rollbar = sin( ( v_texcoord0.y + u_time.x ) * 4 );
    
    gl_FragColor.rgba = c + (rollbar * 0.02);
}


From what I've learned, PPSSPP uses single pass shaders so the above it's a single pass shader and can be ported to Pete's OGL2... ?


Note 1:

"int vPos = int( ( v_texcoord0.y + u_time.x * 0.5 ) * 272.0 );"

272 = PSP vertical resolution...


Note 2:

"u_time.x" seems to be an application specific parameter or something... ?
Code:
1:
2:
3:
4:
 
u_time.x: Current time in seconds, not connected to emulator frame rate (so will not react to "unthrottle" (holding tab))
u_time.y: 0.0-1.0 increasing, wrapping every game time second
u_time.z: Current time as a count of 60ths of a game time second
u_time.w: Same as z but wrapping (game time)





Signature
Get things right or don't bother at all


Similarly threads:
Topics Created by Replies Boardname
CRT-2 from PPSSPP (aka scanlines shader) Jeneko 0 pete_bernert
Natural Vision Shader + AA Shader v2.o = Best Shader for 2d !! zaykho 16 pete_bernert
TT-01 E M-Conversion zu verkaufen DDBen 5 rccdresden
Bilder zu Episode 28: Conversion Torri 14 torri
Conversion: Browning M1917A1 -> M1917 (1.Wk) Wollhodden 18 fubar
Neuer Thread ...





Masthead

This forum is a free service of razyboard.com
Do you want a free forum in less than two minutes? Then click here!



blank