Jump to content

Dirty Comic Shader


DaDonik
 Share

Recommended Posts

File Name: Dirty Comic Shader

File Submitter: DaDonik

File Submitted: 03 Aug 2011

File Updated: 03 Aug 2011

File Category: Shaders

 

Just replace one of frameworks post effect with this shader.

For example rename the shader "hdr.frag" and replace the "hdr.frag" in the postfilter folder with it. Then startup the editor, enable the effect and there you go :P

 

Here is a picture of the shader in action:

gallery_48_102_134361.jpg

 

Click here to download this file

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

I tried this in my game but it seems a bit much in this case. It really drowns out the textures.

 

http://dl.dropbox.com/u/1293842/Comic.png

 

Try adding an ambient light with a lowish intensity, this stops the drowning out for me. I also noticed you have 2 directional lights? Wouldn't that cause this drowning out issue too?

Intel core 2 quad 6600 | Nvidia Geforce GTX460 1GB | 2GB DDR2 Ram | Windows 7.

 

Google Sketchup | Photoshop | Blender | UU3D | Leadwerks Engine 2.4

Link to comment
Share on other sites

I know the shader is far from perfect!

 

@Rick: Just open the shaderfile and alter

float fNormalStrengthDivider = 8.0;

to for example:

float fNormalStrengthDivider = 10.0;

 

To ged rid of anything but the outlines, you could just remove everything after line 40. That will also save much performance!

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

Hey Guys,

 

Been testing this in large open areas and found that although it works well in closed in and more close up areas there are some things that need to be changed to get it to work properly in a big open world scene with geographic topography made with the editor. If you don't know what I mean --> this is what happens if you use the shader outside with LE Editor hills

 

Before.png

 

As you can see the shader is detecting the edges of polygons as edge lines which it shouldn't be and you can see that as you get to the horizon it starts to blacken out with a really thick black line. This is because the difference in depth on the depth buffer gets less and less the further away it gets. Therefore, I thought of a workaround to make the difference required to make a line dependant on the depth of the pixel in question... If you want to use the shader in the open planes with hills you'll need to change the following code:

 

From This:

fEdgeDepth = clamp((fDDX + fDDY - 0.01) * 10.0, 0.0, 1.0);                           //Line Number 24

To Something Like This:

if(fCurrent<=0.5){                                                                                      
       fEdgeDepth = clamp((fDDX + fDDY - 0.001) * 10.0, 0.0, 1.0);
} else if(fCurrent>0.5 && fCurrent<=5.0){
       fEdgeDepth = clamp((fDDX + fDDY - 0.02) * 10.0, 0.0, 1.0);
} else if(fCurrent>5.0 && fCurrent<=9.0){
       fEdgeDepth = clamp((fDDX + fDDY - 5.0) * 10.0, 0.0, 1.0);
} else if(fCurrent>12 && fCurrent<=15.0){
       fEdgeDepth = clamp((fDDX + fDDY - 7.0) * 10.0, 0.0, 1.0);
} else if(fCurrent>25 && fCurrent<=28.0){
       fEdgeDepth = clamp((fDDX + fDDY - 12.0) * 10.0, 0.0, 1.0);
} else {
       fEdgeDepth = clamp((fDDX + fDDY - 20.0) * 10.0, 0.0, 1.0);
}      

 

DaDonik & I tested this in both small and open areas but Unfortunately this also results in losing a bit of detail outlining in the distance but the ultimate outline is still retained (Will have to hard-texture in the lines within the mesh to keep the detail <-- they do that in borderlands). So if your game is in-doors, the original shader code is still better. However, for the great outdoors you'll need to change it so something like this and tweak it to be as close to what you need as possible. I also tried using a function for a smoother transition rather than a big if statement but I didn't get a good result for some reason. Feel free to play around with the idea.

 

Here is the resulting outline generated after the changes ;)

After.png

^^ As you can see the thick line in the distance is reduced and you only see black lines on the very border on the hills. You'll also notice that the vehicle has less inner outlines... This is unfortunately the trade off. However, those inner lines will become visible if you walk closer to the vehicle. Best to hard texture in the inner lines where possible

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

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...