Blur OSL node and render time

Forums: Blur OSL node and render time
Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderator: aoktar

Blur OSL node and render time

Postby FxDesign » Tue Mar 05, 2024 2:59 pm

FxDesign Tue Mar 05, 2024 2:59 pm
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
FxDesign
Licensed Customer
Licensed Customer
 
Posts: 103
Joined: Wed Apr 24, 2013 10:47 am

Re: Blur OSL node and render time

Postby SSmolak » Tue Mar 05, 2024 7:31 pm

SSmolak Tue Mar 05, 2024 7:31 pm
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.
Architectural Visualizations http://www.archviz-4d.studio
User avatar
SSmolak
Licensed Customer
Licensed Customer
 
Posts: 1095
Joined: Sat Feb 07, 2015 5:41 pm
Location: Poland

Re: Blur OSL node and render time

Postby ofirgardy » Mon Mar 18, 2024 1:24 pm

ofirgardy Mon Mar 18, 2024 1:24 pm
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/
ofirgardy
Licensed Customer
Licensed Customer
 
Posts: 9
Joined: Wed Feb 05, 2020 12:17 pm

Re: Blur OSL node and render time

Postby frankmci » Tue Mar 19, 2024 6:18 pm

frankmci Tue Mar 19, 2024 6:18 pm
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.
Technical Director - C4D, Maya, AE, - Washington DC
frankmci
Licensed Customer
Licensed Customer
 
Posts: 827
Joined: Fri May 26, 2017 2:00 pm

Re: Blur OSL node and render time

Postby ofirgardy » Tue Mar 19, 2024 8:23 pm

ofirgardy Tue Mar 19, 2024 8:23 pm
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.
ofirgardy
Licensed Customer
Licensed Customer
 
Posts: 9
Joined: Wed Feb 05, 2020 12:17 pm

Re: Blur OSL node and render time

Postby frankmci » Tue Mar 19, 2024 8:44 pm

frankmci Tue Mar 19, 2024 8:44 pm
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.
Attachments
OSL.Delayed.UVs.png .png
"OSL Delayed UVs" projection with OSL blur node
Technical Director - C4D, Maya, AE, - Washington DC
frankmci
Licensed Customer
Licensed Customer
 
Posts: 827
Joined: Fri May 26, 2017 2:00 pm

Re: Blur OSL node and render time

Postby ofirgardy » Wed Mar 20, 2024 10:44 am

ofirgardy Wed Mar 20, 2024 10:44 am
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
ofirgardy
Licensed Customer
Licensed Customer
 
Posts: 9
Joined: Wed Feb 05, 2020 12:17 pm

Re: Blur OSL node and render time

Postby frankmci » Thu Mar 21, 2024 5:39 pm

frankmci Thu Mar 21, 2024 5:39 pm
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);
    }
}
Last edited by frankmci on Thu Mar 21, 2024 5:48 pm, edited 1 time in total.
Technical Director - C4D, Maya, AE, - Washington DC
frankmci
Licensed Customer
Licensed Customer
 
Posts: 827
Joined: Fri May 26, 2017 2:00 pm

Re: Blur OSL node and render time

Postby ofirgardy » Thu Mar 21, 2024 5:46 pm

ofirgardy Thu Mar 21, 2024 5:46 pm
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.
ofirgardy
Licensed Customer
Licensed Customer
 
Posts: 9
Joined: Wed Feb 05, 2020 12:17 pm

Return to Maxon Cinema 4D


Who is online

Users browsing this forum: No registered users and 35 guests

Sat Apr 27, 2024 12:27 pm [ UTC ]