March 13, 2010

udk: edge detection shader

A few months ago I made a post process effect for UDK that uses the scene depth to detect edges. It might be overly complex but the results are pretty good.

It needs to be tweaked for any level it's applied to in order to adjust for scale, fog, and desired level of detail. This version was adapted to VCTF-Sandstorm, one of the maps that comes with UDK.





I used the shader provided in this post as the basis for mine, and this post helped as well. This is another example I found more recently.


Click for full image


It's also possible to use the alpha component of the scene texture node instead of the scene depth node (the scaling values must be changed too).

21 comments:

Anonymous

Love your shader. I was looking for something like this. BTW what is the 4e-005? A Constant?
Care to go more indepth on how you made it?

Send me an email aegget_(at)hotmail(dot)com

Anthony Borell

the 4e-005 is 0.000040 for a constant

Chris
This comment has been removed by the author.
Anonymous

Very interesting Anna. One question though, how did you get this to work in game. I modified my inis to point to a PostProcessChain I made, which just has the 1 material effect in it which is this here shader. I get results which look nothing like yours, infact, nothing like anything :(.
Just wondering what else you did.

Adracott

I am attempting to replicated what you did here, and after recreating the whole node setup I think I did a pretty decent job. However my final results were less that effective. Am I missing the constant clamp values? I would imagine that is a value you have changed, and is not shown here. (Btw this is for a school assignment, not using your work in anything made to be kept)

Matt

Hey I'm in the the same boat as the other guys. I'm a student and I'm trying to replicate your results just to learn more about the material editor. I'm not really sure what is happening when I apply it to a post process chain and then apply that to either the world post-process effect or a post-process volume. Any advice on what I should do would be GREATLY appreciated. I'm not 100% sure that I'm even applying it to a post-process chain correctly. Thanks in advance for any feedback.

Anonymous

I also become desperate to get this Material working. My game become totally white.
It would be nice to know, what settings are made in the material to Blend Mode or Lighting Model. How the Postprocessing chain looks like. The settings of the screen depth nodes, screen pos nodes, clamp nodes.
If someone can help mew, email me please at head_less(at)web(dot)de

Anonymous

So that material will make a borderlands shader?

J├Ârgen

requires blendmode modulate to "work".
Nice effect, thanks for sharing..

Clark

Works great! For anyone having issues, you need to change the blend mode to modulate, as mentioned by Jorgen. Furthermore, in the "Current Pixel" comment box, set the ScreenPos to "Screen Align". This fixed it for me.

Anonymous

Hey, I'm trying to replicate this effect for a school project but something isn't working right.I have the nodes set up though I'm not sure if all the values are correct but what I have no idea about is what the post process chain should look like.

If someone could email me with some help that would be awesome. Hofsta.bc@gmail.com

Anonymous

Hi, great material but it seems to kill glow-effects on other materials. Do you know any option to modify this behaviour?

Ben Watson

That is awesome! How do you go about making stuff like this? I am just starting to understand what UDK material editor is capable of but I wouldnt know where to begin with something like this. Amazing.

Raghan

Very good help for me, it's a good job!
Thanks!
:D

Anonymous

what means 1-x?Help please:)

Anonymous

Oh...got it.Search 4 OneMinus:)))

Anonymous

what is 4e-006 then?

Anonymous

4e-006 is 0.000004 for a constant.

TorQueMoD

To get any of the values like 2e005 or 4e006 do the following:

Our goal is to get 2e005 what this means is there will be 5 decimals in total with the first number (2) as the last number.
So 2E005 = 0.00002 - four zeros followed by 2 as the fifth number.

4e006 is .000004 - five zeros followed by 4 as the sixth number.

The first number always tells you what the decimal is and the last number tells you how many leading zeros you need (one less than the last number)

Anonymous

When I use this material as a post process effect, I get lines around the sky box as well similar to a target. Do you know nay way to get rid of that? Everything else is great; the lack of black shadows seen on the iniitial sobel edge shader.

Anonymous

Hey, great post!
I was just playing around with this and found you can get great effects from the shader set up shown above by setting the material properties "Blend Mode" to "BLEND Translucent" and "Lighting Model" to "MLM Unlit" if you add a 1-X node to the end of edge detection chain and plug it into Opacity and then plug any colour or texture into the Emissive channel.

Post a Comment