Possible to add DOF blur to a translucent material?

For adding a blurry fx to windows etc. I don’t see any examples of this in UDK.

Like this: image

Which is an fx i see in many games from the time UDK was popular.

Any ideas?

Can you use SceneTexture with UVs to average the color of several adjacent pixels?

I couldn’t get SceneTexture to work the way I wanted, but this is the gist:

I think in order to get this to work on a window, you would have to get a render texture for what the player would see through the window, insert that into a material instance, and apply that instance to the window. That probably wouldn’t work very well if you want to add lots of windows to a building at runtime.

OK, I got it to work…

It’s the same material as above, but you put in a SceneTexture in place of every instance of the texture parameter. Then instead of a TextureCoordinate in the upper-right corner, you put a ScreenPosition. And on the ScreenPosition, you must set ScreenAlign=true. Fiddle with the resolution parameters until you get the look you want. Also, you can expand from here and you can get a better blur by sampling 25 pixels in a square instead of 9 pixels.

Very cool @Nathaniel3W. Nice work. I will certainly give it a try. Thanks

It’s a shame we can’t use the post process DOF blur. You would expect it to be available within the material editor given it’s supported in the normal engine rendering.