A friend of mine was working on a scene and asked for a toon shader to help then match a particular style. So I started with the basic clamp an offset fresnel and call it awesome, but they were working much lower poly than I expected so I ended up looking into making something that did a bit of edge detection. So here you are polycount the fruits of my r&d.
The right is unprocessed and the left has the garnish.
A bit more outline goodness.
The friend is still working on the scene so I grabbed a different environment to test it on so the environment isn't mine. If you'd like a copy feel free to grab the upk;
Package , it currently is setup to work in UDK. If you're wondering what all the twiddly nobs in the instance are I have a
little document about 'em
Replies
i dig it man, i'll let you know when it's on my stuff on my scene
the large cluster of orange nodes on the right are the depth buffer offsets in screen space. the depth buffer is spread out along the axis by adding and subtracting a small amount from the uv coordinates.
All the samples are then added together and divided by the number of samples before they are subtracted from an un-offset version of the scene depth. The result of that is visible in B and while that does show the changes in depth it breaks down on steep flat surfaces because it creates multiple unwanted lines across them.
To correct for this B is compared to A(a slightly modified depth buffer) in an if statement and anything that has the two equal or where A is less than B becomes and outline and the rest of the image pixels are filled by the original frame. The black regions in image C are where B is greater than or equal to A.
The shader is lightly commented, take a look in the package it might help answer some of your questions, and if you don't feel like adding it to the post process chain you can assign it to a mesh and look through that mesh (madness!).
Hope that helps.
Also you get outlines in regions where they don't make sense, why for example does the outline appear on every segment of the bridge? o.o
And secondly why don't you get outlines there on the top of the stones? even if you cut of for distance, the rock on the left should use an ol as its nearer that the rock on the right of it.
I guess this is due to using if which is always only right or wrong, no inbetweens?
Thanks for sharing
Trouble is this is a screen wide effect. :S
Corrected it and updated package available. I took the extra nodes out and removed the old method from the material.
@Neox the problem seemed to be the method not the If, it was used to sub white for the frame and a color for the lines.
Lines now get thiner the farther an object is from the camera.
UDK URL="http://ip-comic.com/Drachis/Linked/Distro/Shaders/Graphic/TC_PostProcess0_02.upk"]Download it[/URL
(EDIT:) i downloaded the package and saw the madness. that answers that.
to actually have that display though, do i have to edit the ini?
I wrote down how I thought it worked so tell me if that helps, the depth biased method builds on some of the concepts in the basic document so reading both maybe helpful. You'll really only need to read the Method section of each document.
http://book.hourences.com/tutorialsue3mated3.htm
at the bottom.
now looking between the two. yours is fairly more complex. i take it that the difference is that hourences is meant for an object while yours is meant for post process? im wondering what makes that difference? is it that you use scene depth instead of vectors?
I could rename it to '[UDK] Post Process - Outline & Crush'. The conversation could get pretty interesting around the topic if it rests in the appropriate forum for such a conversation
Otherwise - wicked effect.
yeah would be good to move this to technical talk; seems to be more about that than showing off the bits now.
@Vulmer
You need to connect this to a specific post process in order to get it working out of the box. The one that works by default can be found in UTGame>Effects>FX_HitEffects and is called UTPostProcess_Console
Add a new material node between MotionBlurffect and the MaterialEffect already in there, and pop the material into the node and bam lines everywhere [if not post up and we'll figure it out]
@oniram
What makes it a post process rather than a per object material is that it used both the scene depth and the scene texture. I would of made it as a per object material but I ran into issues accessing the scene depth with non-transparent objects.
the cell shader at hourences will work per object so every object will have its outside edges outlined nicely. The downside is that it requires geometry that is curved to show up and on flat surfaces the outline can spread down a wall.
The material that I made works with the difference in polygon depth rather rather than surface angle(how much it faces the camera). So lines will only appear when two polygons overlap by a certain amount. That should allow it to work with lower poly scenes with little trouble.
@gilgamesh
you have two options either use it like a window, apply it to an object and look through it and everything on the other side will have outlines (like some sort of twisted window) or toss it in the post process any the whole level gets em
(and yeah this might be better off in the technical talk section )
Wooo, thanks man! Worked right away! I just need to figure out how to get it to run in-game now.
Im not sure if it will add anything to what everyone has already discovered, but hopefully it helps someone out there
@riki.. thats awesome! thx. ill have to check those out.
edit: ah. thought these were different files that contained things that were not covered in the dvd. regardless, its good to be releasing it to the community.
I've been having a bit of trouble getting any of the outline versions to work:
The post process chain is working but when I plug in the material my screen goes completely dark, I can't see anything! :poly142: If I remove the new material node, everything goes back to normal.
I'm using UDK 2010-10, can anyone please help me out? :poly136:
*EDIT*
I changed the scene depth priority group (DPG) to WORLD, within the newly created material node, and now things appear to be working. Just in case anyone else was wondering.
http://udn.epicgames.com/Three/DevelopmentKitGemsSobelEdgeDetection.html