Archive 17/01/2023.

Apply blur to only one object in a scene

stark7

Hello -

I am looking into applying effects to specific objects only, like blur and autofocus.

Can someone please tell me what is the simplest and/or most efficient way to blur only one Node + Model Component in a scene?

I was looking at the Outline.as example, only I can’t run it locally for some reason - and that method seems may not take depth into account and I definitely want that a blurred object to be rendered behind a regular one.

Bananaft

What renderPath are you are planning to use? You better to provide some more info or reference picture on what exactly you want to achieve.

stark7

Here is an example - (clearly not my game :slight_smile: ) - basically I have a scene and I only want one of the enemies to be blurred like that. I did this one in gimp.
https://imgur.com/qbxL3ML

[edit, it too me longer than what is reasonable to figure out how to embed images]

1vanK

use masks https://github.com/1vanK/Urho3DMotionBlur

Bananaft

I see two solutions:

  1. You render the shape of blurred area into stencil buffer(or whole texture channel), then blur post effect shader will read it to apply itself only on this area.

  2. If the number of blurred areas is limited (one or few) and shape is always sphere, you can pass its position and radius as shader parameters, then do a spherical projection and manual depth compare in shader.

http://iquilezles.org/www/articles/sphereproj/sphereproj.htm

stark7

Would this work with a partially blurred object in view?