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
Moderator: aoktar
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.
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
#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);
}
}
Users browsing this forum: No registered users and 27 guests