Jump to content

Outline shader without depth test


photo

Recommended Posts

Hi, we are developing a border detection/outline shader that renders the border of a mesh over any other objects in the scene. Some other post ask for similar effects but none came up with a final solution:

 

https://developer.unigine.com/forum/topic/3432-object-outline-shader/?hl=%2Bdepth+%2Btest#entry18421

https://developer.unigine.com/forum/topic/2899-depth-testing-in-post-shader-precision/?hl=%2Bdepth+%2Btest#entry15842

https://developer.unigine.com/forum/topic/917-depth-test/?hl=%2Bdepth+%2Btest#entry4545

 

Sample post_selection_00 is the kind of effect that we need to achieve but rendering the border over all other objects (like disabling depth buffer). But I can't figure out how to achieve depth test disabling effect

Here is a sample image of what we want to achieve:

post-2372-0-76807100-1485512901_thumb.png

 

Any suggestions?

 

Thanks in advance.

 

Link to comment

Javier,

 

If you have 2.3.1 SDK sources, the easiest way will be to disable depth test for Auxiliary buffer. Inside engine/render/RenderRenderer.cpp:

// find that method
void RenderRenderer::render_auxiliary_surfaces(Vector<ObjectSurface *> &surfaces)

//replace
state->setDepthFunc(DEPTH_GEQUAL); 

//to:
state->setDepthFunc(DEPTH_NONE);

RIght now, I'm afraid there is no way to do such trick via material settings. Please, keep in mind that it will affect all other Aux passes and they will also ignore depth.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Thanks for your reply, finally we came up with a solution by rendering the mask with a WidgetSpriteNode and then passing the texture to a custom post shader similar to post_selection_00.

 

Here is the result:

post-2372-0-00618500-1485947757_thumb.png

 

Is there any other option to retrieve this mask with a better performance than using a WidgetSpriteNode? 

 

Thanks

 

Link to comment
  • 3 years later...
On 2/1/2017 at 3:36 PM, silent said:

Hi Javier,

Nice solution you have there! I think if it well fit your needs you should use it :)

how could i reproduce that effect in C#?

 

Link to comment
×
×
  • Create New...