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

KrossX 
Real addict
.........

...

Status:Offline
Date registered: 16.06.2008
Post:122
Send Message
...   Created on 26.01.2011 - 15:07Jump to top Quote this post Report this post Edit Delete


Basically, what I tried to do here is something that I do in Photoshop: Base and Base' being normal and copy of the same layer. Then, I apply blur on Base' and Overlay it on top of Base. This creates a kind of contrast + bloom effect which I quite like. A Gaussian blur would've been ideal, but what I could find were all multi pass.

The shader level here, controls the mix betwen Base and Base' in case it's too strong/dark (like the Metal Gear screenshot). The slight bloom can be noticed easier on FF8's screenshots text. The screenshots are in Off/Lv4 pairs.





SLF

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:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
 

uniform sampler2D OGL2Texture;
uniform vec4 OGL2InvSize;
uniform vec4 OGL2Param;

float overlay(float base, float blend)
{
    float result = 0.0f;
    
    if( base < 0.5f ) 
        result = 2 * base * blend;
    else
        result = 1 - (1 - 2*(base-0.5f)) * (1-blend);
        
    return result;
}

void main (void)
{               
    vec4 colorful = texture2D(OGL2Texture, gl_TexCoord[0].xy);
    
    float param = 4;
    const float invr2 = 0.70710678118654752440084436210485;    
    
    vec2 dx = vec2(param * OGL2InvSize.x, 0.0f);
    vec2 dy = vec2(0.0f, param * OGL2InvSize.y);
    
    vec2 dx2 = vec2(param * invr2 * OGL2InvSize.x, 0.0f);
    vec2 dy2 = vec2(0.0f, param * invr2 * OGL2InvSize.y);
    
    vec2 offset[8];
         offset[0] = -dx2-dy2;
         offset[1] = dx2+dy2;
         offset[2] = dx2-dy2;
         offset[3] = -dx2+dy2;
         offset[4] = dx;
         offset[5] = -dx;
         offset[6] = dy;
         offset[7] = -dy;
                
    vec4 blurry;
    
    for(int i=0; i<8; i++)        
        blurry += 0.6*texture2D(OGL2Texture, gl_TexCoord[0].xy + offset[i]);    
    for(int i=0; i<8; i++)        
        blurry += 0.3*texture2D(OGL2Texture, gl_TexCoord[0].xy + 2*offset[i]);        
            
    blurry += colorful;
    blurry *= 1/8.2f;
            
    vec4 result;
    
    result.r = overlay(colorful.r, blurry.r);
    result.g = overlay(colorful.g, blurry.g);
    result.b = overlay(colorful.b, blurry.b);
        
    param = (OGL2Param.z + 1) * 0.20f;
    
    gl_FragColor = colorful*(1-param) + result*param;        
}




SLV
Code:
1:
2:
3:
4:
5:
6:
7:
 

void main(void)
{    
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    gl_TexCoord[0] = gl_MultiTexCoord0;
}


[Dieser Beitrag wurde am 26.01.2011 - 15:07 von KrossX aktualisiert]





Signature


KrossX 
Real addict
.........

...

Status:Offline
Date registered: 16.06.2008
Post:122
Send Message
...   Created on 27.01.2011 - 22:08Jump to top Quote this post Report this post Edit Delete


Like previous but using Vivid instead of Overlay blending. Which also includes Burn and Dodge. The "darkening" of Vivid is very reduced otherwise it would be too dark even on low levels. Also, it uses a very costly blur.

SLF

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:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
 
uniform sampler2D OGL2Texture;
uniform vec4 OGL2InvSize;
uniform vec4 OGL2Param;

#define blur 4

float Burn(float base, float blend)
{
    float result = 0.0f;
    
    if(blend > 0.0f)
        result = 1 - (1-base) / blend;
        
    return result;
}

float Dodge(float base, float blend)
{
    float result = 1.0f;
    
    if(blend < 1.0f)
        result = base / (1-blend);
        
    return result;
}


float Vivid(float base, float blend)
{    
    float result = 0.0f;
    
    if( base < 0.5f ) 
    {
        result = base*0.9f + 0.1f*Burn(base, blend*2); // Burn(base, blend*2);
    }
    else
        result = Dodge(base, 2*(blend-0.5f));
        
    return result;
}

void main (void)
{                           
    float off = max(OGL2InvSize.x, OGL2InvSize.y) * 2;
    vec2 offset_x = vec2(off, 0.0);    
    vec2 offset_y = vec2(0.0, off);
    
    vec4 blurry;
    vec4 colorful = texture2D(OGL2Texture, gl_TexCoord[0].xy);
    
    float divisor = 0.0f;
    float full_div = 0.0f;
    
    for(int i=-blur; i<=blur; i++)
    for(int j=-blur; j<=blur; j++)
    {
        divisor = abs(i) + abs(j) + 1;
        full_div += 1.0/divisor;        
        blurry += texture2D(OGL2Texture, gl_TexCoord[0].xy + offset_x*i + offset_y*j) / divisor;
    }
                
    blurry /= full_div;
    
    vec4 result;
    
    result.r = Vivid(colorful.r, blurry.r);
    result.g = Vivid(colorful.g, blurry.g);
    result.b = Vivid(colorful.b, blurry.b);
    
    float param = (OGL2Param.z + 1) * 0.20f;
        
    gl_FragColor = colorful*(1-param) + result*param;
}





Signature


Erquint ...



...

Status:Offline
Date registered: 03.09.2013
Post:2
Send Message
...   Created on 03.09.2013 - 09:16Jump to top Quote this post Report this post Edit Delete


Photoshop-like overlay bloom is exactly what I was looking for.

I tried it and it works nice after I removed the "f" postfixes from floats which drove the parser crazy.

The second one though gives out too much vivid static noise all over the screen.


[Dieser Beitrag wurde am 25.08.2017 - 05:26 von Erquint aktualisiert]





Similarly threads:
Topics Created by Replies Boardname
TS Overlay DrSeus 7 nawadmin
TeamSpeak Overlay für TS2 Felan 0 xenor
Voice Overlay Nightspike 0 wowtempelritter
Teamspeak overlay 0 blasterxp
TSO - TeamSpeak Overlay HugoHastigMM 1 stonedhobbit
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