Page 1 of 1

Blur OSL node and render time

Posted: Tue Mar 05, 2024 2:59 pm
by FxDesign
Hi,

I've noticed that using the OSL node "blur" works well, but increase a lot the render times, when pushing iterations up.

Is there an other way/node to blur input textures without increasing render times ?

Thank you

Re: Blur OSL node and render time

Posted: Tue Mar 05, 2024 7:31 pm
by SSmolak
Yes, this is awful that Octane doesn't have real built-in blur node. Even simple contrast in color correction node doesn't work well.
Sometimes you can achieve good result using Baking node with low resolution. It is effective for smoothing bumps and roughness.

Re: Blur OSL node and render time

Posted: Mon Mar 18, 2024 1:24 pm
by ofirgardy
How have you manged to get the Blur.OSL to work?
I was following this tut (for RS) and trying to mimic it in Octane for 3dsmax (not that it matters much)- but couldn't.

could you elaborate on how you did it? or maybe post a screengrab of the flow?

Darby Edelen's wonderful set:
https://github.com/.../RedshiftOSLSha.. ... /README.md

How to apply in RS:
https://youtu.be/D65HyxaC35o?si=mew5R61-2-ooIH3v

Here is a link to FB where I've asked the community for assistance:
https://www.facebook.com/groups/OctaneR ... 278479467/

Re: Blur OSL node and render time

Posted: Tue Mar 19, 2024 6:18 pm
by frankmci
I don't use Octane in Max, but according to the manual it seems to have the same "OSL Delayed UV" option that is required in C4D when doing certain OSL UV related stuff.

Re: Blur OSL node and render time

Posted: Tue Mar 19, 2024 8:23 pm
by ofirgardy
Yes. I understood this just like you did. But failed to recreate.

Do you have any idea how to implement this (even in C4D) I guess I could match it in Max.

Re: Blur OSL node and render time

Posted: Tue Mar 19, 2024 8:44 pm
by frankmci
ofirgardy wrote:Yes. I understood this just like you did. But failed to recreate.

Do you have any idea how to implement this (even in C4D) I guess I could match it in Max.
Oops. I thought I had added a picture in my reply. Here you go. The setting is in the standard Texture Projection node.

Re: Blur OSL node and render time

Posted: Wed Mar 20, 2024 10:44 am
by ofirgardy
I can see you've started with a specular material.

then plugged what? the Blur.OSL into the Albedo? or is it another type of OSL there?
Then second is the Checkers? or is the Second one titled "Image Texture" is that the Blur.OSL?

the last one - the delayed Projection - this one is straight forward

Re: Blur OSL node and render time

Posted: Thu Mar 21, 2024 5:39 pm
by frankmci
ofirgardy wrote:I can see you've started with a specular material.

then plugged what? the Blur.OSL into the Albedo? or is it another type of OSL there?
Then second is the Checkers? or is the Second one titled "Image Texture" is that the Blur.OSL?

the last one - the delayed Projection - this one is straight forward
It's
Projection Node (OSL Delayed UV) >>
Image Texture Node (just a standard UV check grid image) >>
Gaussian Blur OSL Node>>
Gloss Material (Diffuse channel)

This is the GaussianBlur.osl that currently ships with Octane C4D:

Code: Select all

#include <octane-oslintrin.h>

#define MAX_ITERATIONS  10
#define MAX_KERNEL_SIZE 11 // MAX_ITERATIONS + 1

// OSL sample implementation of gaussian blur for Octane Render
shader GaussianBlur(
    color in = 0
        [[string label = "Input texture"]],
    int iterations = 5
        [[int min = 0, int max = MAX_ITERATIONS,
          string label = "Step count",
          string description = "Number of steps"]],
    float stepSize = 0.001
        [[float min = 0.00001, float max = 0.01,
          string label = "Step size",
          string description = "UV distance between steps"]],
    output color out = 0)
{
    if (iterations == 0)
    {
        // just return the input with the right UV mapping
        out =  _evaluateDelayed(in, u, v);
    }
    else
    {
        float kernel[MAX_KERNEL_SIZE];

        // initialize the kernel
        float normFactor = 0;
        for (int i = 0; i <= iterations; ++i)
        {
            // use normal probability density function with sigma = 7
            float n  = 0.05699175 * exp(-0.01020408 * i * i);
            normFactor += i == 0 ? n : 2*n;
            kernel[i] = n;
        }

        // average the neighbours
        color c  = 0;
        for (int i = -iterations; i <= iterations; ++i)
        {
            float n = kernel[iterations - abs(i)];
            for (int j = -iterations; j <= iterations; ++j)
            {
                float f = n * kernel[iterations - abs(j)];
                c += f * _evaluateDelayed(in, u + i * stepSize, v + j * stepSize);
            }
        }

        // calculate the final value
        out = c/(normFactor*normFactor);
    }
}

Re: Blur OSL node and render time

Posted: Thu Mar 21, 2024 5:46 pm
by ofirgardy
Oh... so it's a different type of bluring OSL, different than the one on the yt video. Yes?
Since that "blur.osl" doesn't have an in-connection for hooking an rgb texture (at least not in the manifestation of it on 3dsmax).

I'll search for another OSL solution.