Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Easier way to create a procedural grid with individual tiles that can be larger than 3x3?

6 REPLIES 6
Reply
Message 1 of 7
xebajac
262 Views, 6 Replies

Easier way to create a procedural grid with individual tiles that can be larger than 3x3?

 
6 REPLIES 6
Message 2 of 7
madsd
in reply to: xebajac

Can you show an example?

Message 3 of 7
xebajac
in reply to: xebajac

Something like the tiles in this wood shader

Message 4 of 7
madsd
in reply to: xebajac

If you can load OSL shaders, I can try cook up a solution one of the next days.

Message 5 of 7
xebajac
in reply to: xebajac

yes i can load osl shaders, thanks...

Message 6 of 7
madsd
in reply to: xebajac

Ok.

I compiled a base for the planks.
There is a float value called PlankLength which is the only variable except UV info I have hooked up.

For now, its a fully self contained procedural noise pr brick, there is also a grout scaler which is also fully procedural ( the noise is build into the shader directly )

I will look at wiring things out so you can use textures, as input pr tile at a point.
Just figured I would upload what I got for now.

3408-ww.png

3407-qwe.png



Copy this to a clean osl shader and compile it, and hope it works.

-----------------

// Complied by Mads Drøschler 14.3.2019

vector fract ( vector x ){

return x-floor(x);

}

vector hash3( vector p )

{

vector q = vector( dot(p,vector(127.1,311.7,0)),

dot(p,vector(269.5,183.3,0)),

dot(p,vector(419.2,371.9,0)) );

return fract(sin(q)*43758.5453);

}

float iqnoise( vector x )

{

vector p = floor(x);

vector f = fract(x);

float va = 0.0;

float wt = 0.0;

for( int j=-2; j<=2; j++ )

for( int i=-2; i<=2; i++ )

{

vector g = vector( float(i),float(j),0 );

vector o = hash3( p + g );

vector r = g - f + o;

float d = dot(r,r);

float ww = pow( 1.0-smoothstep(0.0,1.414,sqrt(d)), 1. );

va += o[2]*ww;

wt += ww;

}

return va/wt;

}

shader ProceduralTiles(

point Po = P,

float PlankLength = 200,

output color Out = 0,

output color OutA = 0,

)

{

float zoomout = .3;

vector uv = Po/zoomout;

float distortion = (iqnoise(uv/128.));

uv += (distortion*(15.*zoomout));

vector col = vector(0.5);

float a = (iqnoise(uv/4.)/2.)*2.;

col *= a+(iqnoise(uv/64.)/2.);

float mx = mod(uv[0],PlankLength);

float my = mod(uv[1],100.);

if ((my < 20.) ||(fmod(uv[1],200.) < 100. && mx < 20.) ||(fmod(uv[1],200.) > 100. && mx > 100. && mx < 120.)){

a = iqnoise(uv)/2.;

col = vector(.4+a);

}

Out = pow(vector(col),2.2);

// OutA = a;

}

Message 7 of 7
xebajac
in reply to: madsd

ok i'll try it...thank you..good luck on finishing.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report