CopperCircle Posted June 26, 2010 Share Posted June 26, 2010 Hi, I want to add my own postfilter shader and wondered which is the best way? I have a basic LEO project created by the wizard and I see I can add the built in effects simply (SetBloom(1)) how would I merge my own post effects? Cheers. Quote Link to comment Share on other sites More sharing options...
Laurens Posted June 26, 2010 Share Posted June 26, 2010 I have not tried using my own shaders using Framework but this is probably a good place to start. http://leadwerks.com/wiki/index.php?title=Shaders Quote Link to comment Share on other sites More sharing options...
DaDonik Posted June 27, 2010 Share Posted June 27, 2010 You basically have to write your own renderer and ignore the buildt in framework. At least that is what i do. Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
Pixel Perfect Posted June 27, 2010 Share Posted June 27, 2010 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. Quote 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 More sharing options...
flachdrache Posted June 27, 2010 Share Posted June 27, 2010 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 Quote AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3 zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5 Xxploration FPS in progress ... Link to comment Share on other sites More sharing options...
CopperCircle Posted June 27, 2010 Author Share Posted June 27, 2010 Thanks for all the info, I still get a little confused with all the various ways of using LE (framework, gamelib, ect...) and thier limitations/advantages. I would like to use Lua script and I think I will try and add my shader to the presets. Cheers. Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted June 27, 2010 Share Posted June 27, 2010 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. 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! Quote 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 More sharing options...
flachdrache Posted June 27, 2010 Share Posted June 27, 2010 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 Quote AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3 zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5 Xxploration FPS in progress ... Link to comment Share on other sites More sharing options...
Recommended Posts
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.