smooth procedural textures with smoothstep?

(zebus3d) #1

Hi guys!.

Is possible add smooth to procedural textures with osl and smoothstep and fuzzy?


(Secrop) #2

Simple way is to sample the texture in near from the sampling point and interpolate all the results… but this is rather an expensive technic in terms of computation, specially if you want it without noise… For example adding noise to the original coordinate system (with a very small scale), can get the result you want, but it will require exponentially more samples for a clean result, as your smooth radius gets bigger.

It’s better to either adjust the algorithm to automatically define some median value (means creating a new procedural texture), or baking the original and blur it in 2d.

(zebus3d) #3

Would it not be possible to catch the output buffer of the material “on the fly” to be able to use the output as an image and now can make it a 2d blur?.. someone who knows how to program and know in depth blender, know if it is possible do be done ?. To be able to make a blur in materials, this is a great difference in the possibilities and quality of complex procedural materials.
Thank you.

(Secrop) #4

That can be done, but it’s not pratical. First, we could use the uv space to store the texture, but having uv islands or uv distortions will make the blur function not to work correctly, and solving this is rather computational expensive.

So doing it at the shader level is the best, but requires some analitic work. For example, i wrote a ‘soft voronoi’ that returns a voronoi pattern with diffuse values near the F2-F1 planes. The main reason to write it from scratch, is because the algorithm still has just one loop inside, just like the original voronoi, and performs almost as fast. By trying to use a generic method for any texture, we must rely on calculus, and in the example of the voronoi, that means we need to run that loop multiple times for each sample, and find the medians.

Now, what you could argue, is to have an implementation of most textures to include blur (just like the brick has now the smooth mortar). For some textures that might be possible, for others probably not.

Thought I’m more inclined to keeping texture creation outside the render routines as much as possible, as it can be much more powerfull alone, than trying to implement it in the render…