Author Topic: Post-processing  (Read 60164 times)

0 Members and 1 Guest are viewing this topic.

Offline Angelus

  • 210
  • The Angriest Angel
I replaced the content of the post-v.sdr and tried it again, but no joy, nothing happens.
I attach the debug log, and i marked the "interessting section".



Code: [Select]

==========================================================================
DEBUG SPEW: No debug_filter.cfg found, so only general, error, and warning
categories can be shown and no debug_filter.cfg info will be saved.
==========================================================================
FreeSpace version: 3.6.11
Passed cmdline options:
  -spec_exp 11
  -ogl_spec 82
  -spec_static 1
  -spec_point .6
  -spec_tube .5
  -ambient_factor 40
  -mipmap
  -missile_lighting
  -glow
  -nomotiondebris
  -spec
  -normal
  -3dshockwave
  -post_process
  -ballistic_gauge
  -dualscanlines
  -orbradar
  -targetinfo
  -3dwarp
  -ship_choice_3d
  -weapon_choice_3d
  -mod mediavps
  -fps
Building file index...
Found root pack 'C:\Games\FreeSpace2\mediavps\MV_Complete.vp' with a checksum of 0x31df7754
Found root pack 'C:\Games\FreeSpace2\FS2OGGcutscenepack.vp' with a checksum of 0x84396e99
Found root pack 'C:\Games\FreeSpace2\multi-mission-pack.vp' with a checksum of 0x377695e0
Found root pack 'C:\Games\FreeSpace2\multi-voice-pack.vp' with a checksum of 0xd50e7442
Found root pack 'C:\Games\FreeSpace2\root_fs2.vp' with a checksum of 0xce10d76c
Found root pack 'C:\Games\FreeSpace2\smarty_fs2.vp' with a checksum of 0xddeb3b1e
Found root pack 'C:\Games\FreeSpace2\sparky_fs2.vp' with a checksum of 0x164fe65a
Found root pack 'C:\Games\FreeSpace2\sparky_hi_fs2.vp' with a checksum of 0xa11d56f1
Found root pack 'C:\Games\FreeSpace2\stu_fs2.vp' with a checksum of 0xd77da83a
Found root pack 'C:\Games\FreeSpace2\tango1_fs2.vp' with a checksum of 0x4c25221e
Found root pack 'C:\Games\FreeSpace2\tango2_fs2.vp' with a checksum of 0x86920b82
Found root pack 'C:\Games\FreeSpace2\tango3_fs2.vp' with a checksum of 0x705e8d71
Found root pack 'C:\Games\FreeSpace2\warble_fs2.vp' with a checksum of 0xd85c305d
Searching root 'C:\Games\FreeSpace2\mediavps\' ... 4 files
Searching root pack 'C:\Games\FreeSpace2\mediavps\MV_Complete.vp' ... 5253 files
Searching root 'C:\Games\FreeSpace2\' ... 87 files
Searching root pack 'C:\Games\FreeSpace2\FS2OGGcutscenepack.vp' ... 10 files
Searching root pack 'C:\Games\FreeSpace2\multi-mission-pack.vp' ... 110 files
Searching root pack 'C:\Games\FreeSpace2\multi-voice-pack.vp' ... 307 files
Searching root pack 'C:\Games\FreeSpace2\root_fs2.vp' ... 157 files
Searching root pack 'C:\Games\FreeSpace2\smarty_fs2.vp' ... 10 files
Searching root pack 'C:\Games\FreeSpace2\sparky_fs2.vp' ... 3027 files
Searching root pack 'C:\Games\FreeSpace2\sparky_hi_fs2.vp' ... 1337 files
Searching root pack 'C:\Games\FreeSpace2\stu_fs2.vp' ... 2355 files
Searching root pack 'C:\Games\FreeSpace2\tango1_fs2.vp' ... 32 files
Searching root pack 'C:\Games\FreeSpace2\tango2_fs2.vp' ... 15 files
Searching root pack 'C:\Games\FreeSpace2\tango3_fs2.vp' ... 10 files
Searching root pack 'C:\Games\FreeSpace2\warble_fs2.vp' ... 52 files
Found 15 roots and 12766 files.
AutoLang: Language auto-detection successful...
Setting language to English
TBM  =>  Starting parse of 'mv_strings-lcl.tbm' ...
Initializing OpenAL...
  Using 'Generic Software' as OpenAL sound device...
  OpenAL Vendor     : Creative Labs Inc.
  OpenAL Renderer   : Software
  OpenAL Version    : 1.1

... OpenAL successfully initialized!
Failed to init speech
Initializing OpenGL graphics device at 1024x768 with 32-bit color...
  Initializing WGL...
  Requested WGL Video values = R: 8, G: 8, B: 8, depth: 32, double-buffer: 1
  Actual WGL Video values    = R: 8, G: 8, B: 8, depth: 32, double-buffer: 1
  OpenGL Vendor     : ATI Technologies Inc.
  OpenGL Renderer   : Radeon HD 2600 XT (Omega 3.8.442)
  OpenGL Version    : 2.1.7169 Release

  Using extension "GL_EXT_fog_coord".
  Using extension "GL_ARB_multitexture".
  Using extension "GL_ARB_texture_env_add".
  Using extension "GL_ARB_texture_compression".
  Using extension "GL_EXT_texture_compression_s3tc".
  Using extension "GL_EXT_texture_filter_anisotropic".
  Using extension "GL_ARB_texture_env_combine".
  Using extension "GL_EXT_compiled_vertex_array".
  Using extension "GL_EXT_draw_range_elements".
  Using extension "GL_ARB_texture_mirrored_repeat".
  Using extension "GL_ARB_texture_non_power_of_two".
  Using extension "GL_ARB_vertex_buffer_object".
  Using extension "GL_ARB_pixel_buffer_object".
  Using extension "GL_SGIS_generate_mipmap".
  Using extension "GL_EXT_framebuffer_object".
  Using extension "GL_ARB_texture_rectangle".
  Using extension "GL_EXT_bgra".
  Using extension "GL_ARB_texture_cube_map".
  Using extension "GL_EXT_texture_lod_bias".
  Using extension "GL_ARB_point_sprite".
  Using extension "GL_ARB_shading_language_100".
  Using extension "GL_ARB_shader_objects".
  Using extension "GL_ARB_vertex_shader".
  Using extension "GL_ARB_fragment_shader".
  Unable to find extension "GL_ATI_shader_texture_lod".
  Found special extension function "wglSwapIntervalEXT".

  Max texture units: 8 (8)
  Max elements vertices: 2147483647
  Max elements indices: 16777215
  Max texture size: 8192x8192
  Can use compressed textures: YES
  Texture compression available: YES
  Using trilinear texture filter.
... OpenGL init is complete!
Size of bitmap info = 705 KB
Size of bitmap extra info = 40 bytes
ANI cursorweb with size 24x24 (25.0% wasted)
GRAPHICS: Initializing default colors...
SCRIPTING: Beginning initialization sequence...
SCRIPTING: Beginning Lua initialization...
LUA: Opening LUA state...
LUA: Initializing base Lua libraries...
LUA: Beginning ADE initialization
ADE: Initializing enumeration constants...
ADE: Assigning Lua session...
SCRIPTING: Beginning main hook parse sequence....
Wokka!  Error opening file (scripting.tbl)!
TABLES: Unable to parse 'scripting.tbl'!  Error code = 5.
SCRIPTING: Inititialization complete.
SCRIPTING: Splash screen overrides checked
SCRIPTING: Splash hook has been run
SCRIPTING: Splash screen conditional hook has been run
Using high memory settings...


??????????????????????????????

Compiling post-processing shader ->  post-v.sdr / post-f.sdr ...
Vertex shader failed to compile:
Vertex shader failed to compile with the following errors:
ERROR: 0:55: 'pow' : no matching overloaded function found
ERROR: 0:61: 'pow' : no matching overloaded function found
ERROR: 0:65: 'pow' : no matching overloaded function found
ERROR: 0:77: 'assign' :  cannot convert from 'float' to '3-component vector of float'
ERROR: 0:78: 'lerp' : no matching overloaded function found
ERROR: 0:78: '=' :  cannot convert from 'const float' to '4-component vector of float'
ERRORERROR! Unable to create vertex shader!
Wokka!  Error opening file (interface.tbl)!
WMCGUI: Unable to parse 'interface.tbl'!  Error code = 5.



???????????????????????????????


TBM  =>  Starting parse of 'mv_effects-sdf.tbm' ...
TBM  =>  Starting parse of 'mv_adveffects-sdf.tbm' ...
ANI 2_radar1 with size 209x170 (33.6% wasted)
Windoze reported 16 joysticks, we found 1
Current soundtrack set to -1 in event_music_reset_choices
TBM  =>  Starting parse of 'mv_music-mus.tbm' ...
TBM  =>  Starting parse of 'mv_advmuzzle-mfl.tbm' ...
Wokka!  Error opening file (armor.tbl)!
TABLES: Unable to parse 'armor.tbl'!  Error code = 5.
TBM  =>  Starting parse of 'mv_effects-wxp.tbm' ...
TBM  =>  Starting parse of 'mv_adveffects-wxp.tbm' ...
BMPMAN: Found EFF (exp20.eff) with 64 frames at 35 fps.
BMPMAN: Found EFF (ExpMissileHit1.eff) with 44 frames at 30 fps.
BMPMAN: Found EFF (exp05.eff) with 47 frames at 20 fps.
BMPMAN: Found EFF (exp06.eff) with 48 frames at 20 fps.
BMPMAN: Found EFF (exp04.eff) with 60 frames at 20 fps.
BMPMAN: Found EFF (Maxim_Impact.eff) with 23 frames at 30 fps.
ANI Lamprey_Impact with size 80x80 (37.5% wasted)
BMPMAN: Found EFF (Gmuzzle.eff) with 5 frames at 30 fps.
BMPMAN: Found EFF (PWmuzzle.eff) with 4 frames at 30 fps.
BMPMAN: Found EFF (Rmuzzle.eff) with 4 frames at 30 fps.
BMPMAN: Found EFF (Bmuzzle.eff) with 5 frames at 30 fps.
TBM  =>  Starting parse of 'mv_tech-wep.tbm' ...
TBM  =>  Starting parse of 'mv_models-wep.tbm' ...
TBM  =>  Starting parse of 'mv_effects-wep.tbm' ...
TBM  =>  Starting parse of 'mv_adveffects-wep.tbm' ...
TBM  =>  Starting parse of 'mv_trails-shp.tbm' ...
TBM  =>  Starting parse of 'mv_tech-shp.tbm' ...
TBM  =>  Starting parse of 'mv_models-shp.tbm' ...
TBM  =>  Starting parse of 'mv_dragon-shp.tbm' ...
TBM  =>  Starting parse of 'mv_adveffects-shp.tbm' ...
TBM  =>  Starting parse of 'mv_escort-hdg.tbm' ...
TBM  =>  Starting parse of 'mv_effects-str.tbm' ...
loading animated cursor "cursor"
ANI cursor with size 24x24 (25.0% wasted)
Ships.tbl is : VALID
Weapons.tbl is : VALID
cfile_init() took 931
Got event GS_EVENT_GAME_INIT (49) in state NOT A VALID STATE (0)
ANI cursor.ani with size 24x24 (25.0% wasted)
Frame  0 too long!!: frametime = 0.306 (0.306)
Got event GS_EVENT_QUIT_GAME (5) in state GS_STATE_INITIAL_PLAYER_SELECT (37)
Freeing all existing models...
... Log closed, Wed Aug 12 00:23:06 2009




EDIT: checked the first post, again and now i have to ask what do i have to do to enable fbo?
I tried to google it, and it seems ATI cards have trouble with it ( at least the drivers ).
« Last Edit: August 11, 2009, 05:43:59 pm by Angelus »

 

Offline Hery

  • 26
First implementation of film grain that Google found:
Code: [Select]
#define FLAG_GRAIN
#define FLAG_BLOOM
#define FLAG_DISTORT_NOISE
#define FLAG_SATURATION
#define FLAG_CONTRAST

uniform sampler2D tex;

uniform float timer;

#ifdef FLAG_DISTORT_NOISE
uniform float noise_amount;
#endif

#ifdef FLAG_SATURATION
uniform float saturation;
#endif

#ifdef FLAG_CONTRAST
uniform float contrast;
#endif

void main()
{

#ifdef FLAG_DISTORT_NOISE
// Distort noise
float distort_factor = timer * sin(gl_TexCoord[0].x * gl_TexCoord[0].y * 100 + timer);
distort_factor = mod(distort_factor, 8.0) * mod(distort_factor, 4.0);

vec2 distort;
if (noise_amount > 0.0)
distort = vec2(mod(distort_factor, noise_amount), mod(distort_factor, noise_amount + 0.002));
else
distort = vec2(0, 0);
#else
vec2 distort = vec2(0, 0);
#endif

#ifdef FLAG_BLOOM
vec4 sum = vec4(0);
   vec2 texcoord = vec2(gl_TexCoord[0]) + distort;
   vec4 color_in = texture2D(tex, texcoord);

   int j;
   int i;
   vec4 color_glo;
for( i= -4 ;i < 4; i++)
   {
        for (j = -4; j < 4; j++)
        {
            sum += texture2D(tex, texcoord + vec2(j, i)*0.004) * 0.25;
        }
   }
       if (texture2D(tex, texcoord).r < 0.3)
    {
       color_glo = sum * sum * 0.012 + texture2D(tex, texcoord);
    }
    else
    {
        if (texture2D(tex, texcoord).r < 0.5)
        {
            color_glo = sum * sum * 0.012 + texture2D(tex, texcoord);
        }
        else
        {
            color_glo = sum * sum * 0.0125 + texture2D(tex, texcoord);
        }
    }
color_in = mix(color_in, color_glo, 0.6);

#else
vec4 color_in = texture2D(tex, gl_TexCoord[0].xy + distort);
#endif

#ifdef FLAG_SATURATION
// Saturation
vec4 color_grayscale;
color_grayscale.rgb = vec3(dot(color_in, vec4(0.299, 0.587, 0.184, 0)));
vec4 color_out = mix(color_in, color_grayscale, 1 - saturation);
#else
vec4 color_out = color_in;
#endif

#ifdef FLAG_CONTRAST
// Contrast and brightness
vec3 Afactor = vec3(contrast);
vec3 Bfactor = vec3(0.5 - 0.5 * contrast);
color_out.rgb = color_out.rgb * Afactor + Bfactor;
#endif


#ifdef FLAG_GRAIN
float x = gl_TexCoord[0].x * gl_TexCoord[0].y * timer *  1000;
x = mod(x, 13.0) * mod(x, 123.0);
float dx = mod(x, 0.01);

vec3 result = color_out.rgb + color_out.rgb * clamp(0.1 + dx.xxx * 100.0, 0.0, 1.0);

vec2 sc;
sincos(gl_TexCoord[0].y * 2048.0, sc.x, sc.y);
result += color_out.rgb * vec3(sc.x, sc.y, sc.x) * 0.8; //fSintensity;

color_out.rgb = mix(color_out.rgb, result, 0.8); //fNintensity));
#endif

// Dithering
//float downsampling_factor = 4;
//float bias = 0.5;
//color_out.rgb = floor(color_out.rgb * downsampling_factor + bias) / downsampling_factor;

gl_FragColor = color_out;
}

Intensity is hardcoded since convenient interface to controll effects like that does not exist yet. :D Now its only a demonstration.

@Angelus: Sorry, I've misspelled file name. That code should went to post-f.sdr. post-v.sdr has to remain unchanged. Could you test version from this post? I fixed some errors that were reported in your log.
You have FBO enabled and working, shaders are compiled when fbo is already initialized.
« Last Edit: August 11, 2009, 05:49:14 pm by Hery »

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Minecraft
    • Steam
    • Twitter
    • ModDB Feature
so, is there supposed to be a shaky cam effect going on in the postprocessing mission?

Or timings where it seems like the camera or viewpoint "blinks"?

And while I am happy to see people jumping on testing out the postprocessing, Has any one ran any of Hery's previous builds in the Subtractive Shaders thread or Antipodes 2? To be able to include those "unified" shaders in the next MediaVP release, I'd like to know that people are not going to have "white-polygons-of-death" on debris or any issues that we don't already know to exist with the mediavp shaders. (Like the ATi -normal driver file issue.)
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys

 

Offline Angelus

  • 210
  • The Angriest Angel

*snip*

@Angelus: Sorry, I've misspelled file name. That code should went to post-f.sdr. post-v.sdr has to remain unchanged. Could you test version from this post? I fixed some errors that were reported in your log.
You have FBO enabled and working, shaders are compiled when fbo is already initialized.


Yeah, the last edit of post-f worked, and the result is teh awesum!
I replaced the edited post-v with the default one and it works like a charm.

You Sir, are a magician!
You should join the SCP team... :D






 

Offline Nighteyes

  • 211
I agree, amazing work :D
next up, Motion blur :P but I assume that one is pretty hard to implement... :(
maybe this is good? its speaking about rendering the whole image as a texture, like your post precessing effect...
http://www.codeproject.com/KB/openGL/MotionBlur.aspx
« Last Edit: August 11, 2009, 06:34:23 pm by Nighteyes »

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Quote
And while I am happy to see people jumping on testing out the postprocessing, Has any one ran any of Hery's previous builds in the Subtractive Shaders thread or Antipodes 2? To be able to include those "unified" shaders in the next MediaVP release, I'd like to know that people are not going to have "white-polygons-of-death" on debris or any issues that we don't already know to exist with the mediavp shaders. (Like the ATi -normal driver file issue.)
i'm actually using both at the moment (shadersets that is...)

as for the antipodes builds, i'll give em a spin.

I agree, amazing work :D
next up, Motion blur :P but I assume that one is pretty hard to implement... :(
maybe this is good? its speaking about rendering the whole image as a texture, like your post precessing effect...
http://www.codeproject.com/KB/openGL/MotionBlur.aspx
i think that thats one of the more inefficient methods to tell you the truth.
« Last Edit: August 11, 2009, 07:35:13 pm by pecenipicek »
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Hery

  • 26
@Zacam: "blinking problem": solved.

I've redesigned the way one can configure post-processing effects using sexps. Now there is "set-post-effect" which takes effect name and its intensity. Additionally, everything is implemented in a way it will be very easy to keep list of post-processing effects in tbl file (however, that will require better shaders interface).

Full pack (updated mission file, the latest shaders version, new builds)

@pecenipicek: That implementation of motion blur seems to be efficient enough to try using it in FSO, especially, if we optimize few things that weren't mentioned in that article.

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
have fun :p i might try something with shaders, i sent you an email a few days ago.
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Angelus

  • 210
  • The Angriest Angel
The latest version gives me following error, if need i can post the entire FS2 log, but i think this should be enough...


Code: [Select]


Fragment shader failed to compile:
Fragment shader failed to compile with the following errors:
ERROR: 0:106: 'xxx' :  field selection requires structure, vector, or matrix on left hand side
ERROR: 0:109: 'sincos' : no matching overloaded function found
ERROR: 2 compilation errors.  No code generated.



 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
just make sure that the vert shader contains only the vert data...

meaning, only this part

Code: [Select]
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_Vertex;

gl_FrontColor = gl_Color;

// * grrrr ... stupid ATI ... *
#ifdef __GLSL_CG_DATA_TYPES
gl_ClipVertex = (gl_ModelViewMatrix * gl_Vertex);
#endif
}
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Angelus

  • 210
  • The Angriest Angel
That's how the post-v shader looks like.

I think i fixed it...or the computer plays games with me...

Is it possible, that if this ---> // <--- is missing in the first line of the post-f shader, the entire thing doesn't work?

I ask, 'cause that's what i've done, i added them in the new version and it worked.

If that's the case, i shall be known as the MacGyver of HLP...  :D



EDIT: maybe these problems are 'caused because my ATI card is offended by the comment in the shader... :nervous:

 

Offline Hery

  • 26
Angelus it was working because // disabled film grain. Since there was problem in film grain code that's why it doesn't work when it's enabled.
post-f.sdr:
Code: [Select]
#define FLAG_GRAIN
#define FLAG_BLOOM
#define FLAG_DISTORT_NOISE
#define FLAG_SATURATION
#define FLAG_CONTRAST

uniform sampler2D tex;

uniform float timer;

#ifdef FLAG_DISTORT_NOISE
uniform float noise_amount;
#endif

#ifdef FLAG_SATURATION
uniform float saturation;
#endif

#ifdef FLAG_CONTRAST
uniform float contrast;
#endif

#ifdef FLAG_BLOOM
uniform float bloom;
#endif

#ifdef FLAG_GRAIN
uniform float film_grain;
#endif

void main()
{

#ifdef FLAG_DISTORT_NOISE
// Distort noise
float distort_factor = timer * sin(gl_TexCoord[0].x * gl_TexCoord[0].y * 100.0 + timer);
distort_factor = mod(distort_factor, 8.0) * mod(distort_factor, 4.0);

vec2 distort;
if (noise_amount > 0.0)
distort = vec2(mod(distort_factor, noise_amount), mod(distort_factor, noise_amount + 0.002));
else
distort = vec2(0, 0);
#else
vec2 distort = vec2(0, 0);
#endif

#ifdef FLAG_BLOOM
vec4 sum = vec4(0);
   vec2 texcoord = vec2(gl_TexCoord[0]) + distort;
   vec4 color_in = texture2D(tex, texcoord);

   int j;
   int i;
   vec4 color_glo;
for( i= -4 ;i < 4; i++)
   {
        for (j = -4; j < 4; j++)
        {
            sum += texture2D(tex, texcoord + vec2(j, i)*0.004) * 0.25;
        }
   }
       if (texture2D(tex, texcoord).r < 0.3)
    {
       color_glo = sum * sum * 0.012 + texture2D(tex, texcoord);
    }
    else
    {
        if (texture2D(tex, texcoord).r < 0.5)
        {
            color_glo = sum * sum * 0.012 + texture2D(tex, texcoord);
        }
        else
        {
            color_glo = sum * sum * 0.0125 + texture2D(tex, texcoord);
        }
    }
color_in = mix(color_in, color_glo, bloom);

#else
vec4 color_in = texture2D(tex, gl_TexCoord[0].xy + distort);
#endif

#ifdef FLAG_SATURATION
// Saturation
vec4 color_grayscale;
color_grayscale.rgb = vec3(dot(color_in, vec4(0.299, 0.587, 0.184, 0)));
vec4 color_out = mix(color_in, color_grayscale, 1.0 - saturation);
#else
vec4 color_out = color_in;
#endif

#ifdef FLAG_CONTRAST
// Contrast and brightness
vec3 Afactor = vec3(contrast);
vec3 Bfactor = vec3(0.5 - 0.5 * contrast);
color_out.rgb = color_out.rgb * Afactor + Bfactor;
#endif


#ifdef FLAG_GRAIN
float x = gl_TexCoord[0].x * gl_TexCoord[0].y * timer * 1000.0;
x = mod(x, 13.0) * mod(x, 123.0);
float dx = mod(x, 0.01);

vec3 result = color_out.rgb + color_out.rgb * clamp(0.1 + dx * 100.0, 0.0, 1.0);

vec2 sc;
sc.x = sin(gl_TexCoord[0].y * 2048.0);
sc.y = cos(gl_TexCoord[0].y * 2048.0);
result += color_out.rgb * vec3(sc.x, sc.y, sc.x) * 0.8;

color_out.rgb = mix(color_out.rgb, result, film_grain);
#endif

// Dithering
//float downsampling_factor = 4;
//float bias = 0.5;
//color_out.rgb = floor(color_out.rgb * downsampling_factor + bias) / downsampling_factor;

gl_FragColor = color_out;
}

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
sincos XD
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Angelus

  • 210
  • The Angriest Angel
Thx for the help, and also thx for these great new features, they will save me a lot of time.
I can now create cutscenes without recording the entire mission with fraps and then editing it in a vid-app.

This is really awesome, thx for your effort.


Here's a little screeny:



 

Offline gevatter Lars

  • Another wingnut
  • 213
    • http://gevatter_lars.tripod.com/
That looks very nice.

Will this post pro effects be implemented into the basic code, enabling them via checkbox in the launcher or will this be something that is only be enabled with certain mods you have to load or modding teams have to integrate in some way?
"Yes! That is my plan, and I see nothing wrong with it. I figure that if I stick to a stupid strategy long enough it might start to work."
 - comment to "Robotech: The Masters"

 

Offline Hery

  • 26
Tech talk: on

I've decided to completely rewritten parts of fso code responsible for shaders, since they were not prepared to use post shaders.
In my new design there are four classes: shader_manager, shader, main_shader and post_shader. Classes main_shader and post_shader derives from shader.

Shader_manager class (it's a singleton) is responsible for loading, storing and applying shaders. It loads main shaders while initializing graphics subsystem in FSO (exactly the same as before). It creates instances of main_shader class and lets them compile, configure and link shaders. The process of loading main shaders hasn't been changed a lot due to compatibility reasons. Post-processing shaders are loaded, configured and compiled on demand, since they changes less often than main shaders. Both types of shaders are stored in std::map containers (better computational complexity than in previously used std::vector, log N vs. N). Additionally, I introduced third container (also std::map) with main shaders that were used during current mission what in some situations can bring some performance gain.

There is an array of post_effect structures that contains informantion required to properly enable and configure any post-processing effect. In future that array may be read from tbl file what will make post-processing free of hardcoded configuration. Some effects (for example bloom) may be set as always active while the other may be enabled only when their intensity value changes (for example contrast or film grain). Static method post_shader::choose_post_shader is in charge of choosing appropriate shader version.

I also managed to get rid of string comparisons while setting uniforms during frame rendering, what also should in some cases bring performance gain. Client code uses enum values instead of strings. Now we get uniform location in constant time (however, uniform names are still hardcoded - that part of shaders system isn't as flexible as the part connected with post-processing).

Another minor improvement is getting rid of 8129 bytes limit of shaders compilator and consolidator error log.

This patch also includes stubs of two other classes opengl::config and resources:text_file. The former one, I hope, will become universal configuration manager, while the latter will be a part of resources manager that will support asynchronous file loading (that will allow us to almost remove loading screen and load all stuff while player is reading briefing).

Tech talk: off

Full pack

@gevatter Lars: I think in the tech talk above is the answer to your question. Post-processing effects are going to be configured using tbl files. Some of them will be enabled only by sexps (for example film grain in cutscenes) while the rest (for example bloom or motion blur) will be enabled all the time unless disabled via launcher flag.

 

Offline Mongoose

  • Rikki-Tikki-Tavi
  • Global Moderator
  • 212
  • This brain for rent.
    • Minecraft
    • Steam
    • Something
Dammit, I really wish I was capable of running shaders, so I could see all of this cool stuff in action. :(

 

Offline Axem

  • 211
Awesome stuff. The only thing I would like to recommend is could the set-post-effect sexp have a transition time like most of the other cutscene sexps have? So the effect wouldn't go just 0 to 100 in one frame. It'd make in-game transitions easier to look at. :)

(BTW Awesome stuff, did I say that already?)

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
perhaps add a milisecond option to specify in which time it should go from 0-100.
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline Axem

  • 211
That's... what I kinda suggested... The transition from current to the intended value. Sorry if I wasn't clear enough.