Jump to content

Best way to add a postfilter?


CopperCircle
 Share

Recommended Posts

You can base your renderer around framewerk (which you can modify) rather than the encapsulated (DLL) framework but at the cost of losing Lua script support as that uses framework. If your not using Lua then that's no loss.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

First of i would look into the "presets" folder under PostFilters - they basicaly work like the preprocessing for mesh shaders (with added specular, glow etc.).

The same way you could "plugIn" your effect(s) imho e.g. not tested myself but it works. :)

 

... lets say you use frameworks distanceFog, bloom, ssao and hdr which would be a common combination.

In that case, framework would not load every posteffects one by one but load the preset "postfilter_distancefog_bloom_ssao_hdr.frag" instead.

If you want to add your posteffect to this preset (since its the one youll use in framework) youll do like to add yours with something like "#define LW_BLUESHIFT".

 

The actaull call to every single shader happens in "postfilter.frag" which in turn calls the specific shader, like a "blueshift.frag".

 

So you have to add your changes to "postfilter.frag" (if needed) and the call to ultimately your own posteffect.

 

Take a look into "godrays.frag" and "hdr.frag" and youll find they get called in postfilter.frag and/or the related preset.

 

hth

AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3

zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5

 

adv_banner-april2012_720x150_tex01.png

 

Xxploration FPS in progress ...

Link to comment
Share on other sites

First of i would look into the "presets" folder under PostFilters - they basicaly work like the preprocessing for mesh shaders (with added specular, glow etc.).

The same way you could "plugIn" your effect(s) imho e.g. not tested myself but it works. :blink:

Yes this will work but you are restricted to the choices Josh has made on what is passed to the shaders from the framework and use of buffers etc, developing your own renderer or using the framewerk (note the use of the word werk rather than work) where you have access to the source code gives much more flexability. It really depends on what you are looking to do, if nothing advanced then this is by far the simplest way!

 

Either way ... good luck!

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

Hmmm, right - doesnt thought about additional blend textures etc. - actually I call my own post effects right after RenderFramework got my postbuffer.

 

[edit]

Guess I misunderstood - you want framework and render your effects after SetHDR(1) etc. Iam not completely hooked but lets say i believe something like this would work.

 

global :

 
//Global variables - 
TBuffer postbuffer;
TBuffer blurbuffer[2];
TShader ppnightvision;
TShader ppdefaultvision;

 

in the main loop :

		UpdateFramework();
//			RenderFramework();
		Render();

 

the render() methode :

void Render() {

       SetBuffer(postbuffer);
RenderFramework();

TTexture posttex1;
posttex1 = LoadTexture("abstract::fx_screen_1.dds");

       // post effect 1 - Blur
TTexture blurtex;

int bw;
int bh;

for ( int i = 0; i < 2; i++ ) {
               if (i==0) 
		blurtex = GetColorBuffer(postbuffer, 1);
	else 
		blurtex = GetColorBuffer(blurbuffer[i-1]);

	SetBuffer(blurbuffer[i]);

	bw = BufferWidth(blurbuffer[i]);
	bh = BufferHeight(blurbuffer[i]);

	DrawImage(blurtex, 0, bh, bw, -bh);
}

SetBuffer(BackBuffer());

       // post effect 2 - nightvision
if (switchScreen) 
{
	SetShader(ppdefaultvision);
	BindTexture( GetColorBuffer(blurbuffer[1]), 0);

	BindTexture( posttex1, 1);

	TTexture tex = GetColorBuffer(postbuffer);
	TextureFilter(tex,TEXFILTER_SMOOTH);
	DrawImage(tex,0,TextureHeight(tex),TextureWidth(tex),-TextureHeight(tex));
	TextureFilter(tex,TEXFILTER_PIXEL);

	SetShader(NULL);

} 
else if (!switchScreen) 
{
	SetShader(ppnightvision);
	BindTexture( GetColorBuffer(blurbuffer[1]), 0);

	BindTexture( posttex1, 1);

	TTexture tex = GetColorBuffer(postbuffer);
	TextureFilter(tex,TEXFILTER_SMOOTH);
	DrawImage(tex,0,TextureHeight(tex),TextureWidth(tex),-TextureHeight(tex));
	TextureFilter(tex,TEXFILTER_PIXEL);

	SetShader(NULL);
}
// --
}

 

Its a little fragmented ATM but should work.

The "Post-Processing_Effects.pdf" and the "Rendering_Water.pdf" helped a lot flashing these out.

 

hf

AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3

zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5

 

adv_banner-april2012_720x150_tex01.png

 

Xxploration FPS in progress ...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...