Hi,
I've been trying to create seamless/non tiling grass material. I've tried using turbulence and the new uvw mapping but I can still see the tiles.
Any texture gurus out there that can help me out?
Thanks
// Shader : Texture Tiling OSL shader
// Author : Hayssam Keilany
//
// Description :
//
// Meant to "break" the repeating patterns on textures
// Very simple version, could be improved by anyone if they feel like it :)
// REMINDER : YOU NEED TO USE "OSL UV" IN THE PROJECTION NODE
#include <octane-oslintrin.h>
color dissolve(color tex1, color tex2, float mix, float noisescale)
{
float rnd = noise("noise", P * noisescale);
color c;
if(rnd < mix)
c = tex2;
else
c = tex1;
return c;
}
shader Texture_Tiling
(
color texinput = color(1,1,1)
[[string label = "Input (Texture)"]],
float scale=4.0
[[string label = "Tiling Scale", float min=0.0, float sliderexponent=4,float max=10]],
int pixelate = 1
[[string label = "Enable Pixelation",string widget = "boolean"]],
int blurmode = 0
[[string label = "Enable Blur Mode",string widget = "boolean"]],
float blursize = 0.5
[[string label = "Blur Size",float min = 0.0, float sliderexponent=4, float max=1]],
float noisescale = 6
[[string label = "Noise Size",float min = 0.0, float sliderexponent=4, float max=100]],
output color c=0
)
{
float u_tile; float v_tile;
// "pixelize" the texture
if (pixelate)
{
u_tile = floor(u * scale);
v_tile = floor(v * scale);
}
else
{
u_tile = u;
v_tile = v;
}
// offset it
// can be changed to "cell" but voronoi looks more natural
float u_jit = noise("voronoi", u, v_tile * scale + v_tile);
float v_jit = noise("voronoi", v, u_tile * scale + u_tile);
// add with untouched UV
float xoffset = u + u_jit;
float yoffset = v + v_jit;
// declare the textures to blur
color tex1 = _evaluateDelayed(texinput, xoffset , yoffset );
color tex2 = _evaluateDelayed(texinput, xoffset+blursize , yoffset );
color tex3 = _evaluateDelayed(texinput, xoffset , yoffset + blursize);
color tex4 = _evaluateDelayed(texinput, xoffset - blursize, yoffset - blursize);
// choose between dissolve or blur
if (blurmode) c = (tex1 + tex2 + tex3 + tex4) / 4;
else
{
color c1 = dissolve(tex1, tex2, 0.5, noisescale);
color c2 = dissolve(c1 , tex3, 0.5, noisescale);
c = dissolve(c2 , tex4, 0.5, noisescale);
}
}
Users browsing this forum: Google [Bot] and 13 guests