Jump to content

How to blur displacement in a shader?


magneto

Recommended Posts

Hi,

 

I am using plain noise and numeric value displacements without using any texture maps. Is there a way to blur the displacements in a shader?

 

Since I am also using noise, I tried lowering the roughness but it removes a lot of noise detail, way beyond simple surface smoothing.

 

Is point cloud filtering the way to go? I didn't try it yet because I wanted to do actual surface blurring, not a proximity one, i.e. using the surface connectivity. But I don't know if there is such a thing in shaders?

 

 

Thanks.

Link to comment
Share on other sites

Thanks Edward. I am using the default noise vop in Mantra Surface material which is Turbulent Noise. I now changed it to Anti Aliased Noise. I kept roughness at 0.5 but lowered Max Octraves, and it did what I wanted. Is this what you wanted me to try?

 

Out of curiosity if I needed a generic way to blur displacement details, is there a way to do this? I would appreciate any insight on this since I am sure shading experts do this with their eyes closed :)

Link to comment
Share on other sites

Thanks Edward. You are right. I am not sure if anti-aliasing would work though.

 

Let's say I generate some values in memory without using noise or a texture map where the result is like this:

 

ncsmall.gif

 

I wanna be able to blur this image so that the smaller details are lost and the resulting displacement is smooth and doesn't have much detail.

 

Or let's say you are using Voronoi Noise and want to smooth the edges by blurring the result:

 

improvedvoronoinoise3.jpg

 

Maybe like you said I might be thinking about it wrong :)

Link to comment
Share on other sites

You could try to approximate the averaging the neighbouring displacements by using derivatives. However, the limitations will be the accuracy of the derivatives that you have and a limited filter radius because the derivatives will be more inaccurate as you move away from your shading point. However, if your underlying geometry is a flat grid, then your derivatives will be good enough. For arbitrary geometry, not so much.

 

A better way will be generate enough information for your shader so that it can calculate an accurate displacement for the radius around any point in the base geometry. I've never tried this myself but I've seen some approaches where they generate something like an SDF (or perhaps a closest point transform field) so that this can be done.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

i've always been a bit curious about how to best antialias a displacement calculation.  i mean, consider that displacements themselves have a major impact on the shape of the resultant geometry which is what you would normally use as a basis of your antialiasing.  polygons that are slivers BEFORE displacement would potentially be hit with a filtering hammer regardless of what they would look like post displacement.  without knowing the result of the displacement, it would seem like a distance-based approach would be more fitting...

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...