photo

Drawing edge with shader

Recommended Posts

Hi,
I'm trying to made a post effect shader for drawing black edges and white faces for rendering.
My problem is when I have an attributed material with normalmap to the mesh, the screen space normal textures contains the normalmap informations of the material..

I don't know if I'm clear but I only whant black edges and white faces.
You can find my shader and material files for post effect and the screen that explain my problem.
I'm not sure about using the normalmap screen space texture correctly ?

Thanks for your help :).

HiddenFaces.png

HiddenFaces1.png

filter_hidden_faces.frag post_filter_hidden_faces.basemat

Share this post


Link to post

Hello,

we've made a progress recently on this. More likely, the desired effect can be achieved with default normal maps only. I'll send you sample code by tomorrow.

Thanks for the patience.

Share this post


Link to post

Here's the shader example.

We suggest researching post_filter_sobel, it provides a faster way to draw edges based on a final image. The algorithm used originally runs multiple cycles. That's kinda slow. Image can be tuned with threshold parameter.

Let us know what you're thinking on this.

 

image.png

filter_sobel_depth.frag

Share this post


Link to post

Yes, your algorithm appear much faster and more precise !
I have just a small problem with this.
I think this is because my scene is scaled with 100 units.
And thanks to Unigine teams for his good work.

test.png

  • Like 1

Share this post


Link to post

The right way for me appear to be  to not use the geLlinearDepth.
But now that work perfect ! Many thanks :)

filter.frag

  • Like 4

Share this post


Link to post