I want to archive a triangles texture on a floor and
give to each triangle a different color.
I know how to model it and then apply random materials with OSL, but
I wonder if can I make it directly only with an OSL or arnold map....
I try to usw the shapes.osl but with no success..
thx gurus...
(Sorry I use wetransfer but when I try to upload something
it says "error parsing file" )
Solved! Go to Solution.
Solved by madsd. Go to Solution.
You cant use that shader for floor tiles directly.
You need some, pr tile change, a float is enough, it can control all aspects of UV.
Try write off this triangle shader and build this hirachy.
I added the triangles as displacement as well, textures rotate pr tile, it can be bound to anything.
https://i.imgur.com/TFx6zMO.jpg
Fixed up a version that utilizes a 3 point vector.
The thing is, the shader you send over works, perfect - however --->
I am calling an external .h file for the vector2 struct.
Arnold needs the pathing to be explicit and that the refferenced files are actually there.
This is semi optimal - more over, if people from other hosts use this shader, they would need the additional .h file and correct explicit refference to location in the shader.
Not very friendly.
Ideally:
All shipping Arnold builds should have a solid vector2.h and vector4.h hook in one of the stdosl files, so we can just refference them with no pathing since pathing is setup behind the curtain to simplify errors from users and make it more robuste as well.
Besides, the 2 vector types are nice to carry data around in for the sake of logic in reading and somethings for conveniency.
So I just removed the 2 point construct and parse everything through the generic vector.
Now renders with Arnold GPU.
float fract ( float x ) { return x-floor(x); } float r(float n, float Shuffle) { return fract(abs(sin(n*Shuffle)*367.34)); } float r(vector n, float Shuffle) { return r(dot(n,vector(2.46,-1.21,0)),Shuffle); } float cycle(float n) { return cos(fract(n)*2.0*3.141592653)*0.5+0.5; } shader Triangles( point Po = P, float Time = 0, float Shuffle = 1.0, output float Float_Out = 0, ) { float a = (radians(60.0)); float zoom = 96.0; vector c = (vector(Po[0],Po[1],0)+vector(Time*zoom,0.0,0))*vector(sin(a),1.0,0); c = ((c+vector(c[1],0.0,0)*cos(a))/zoom)+vector(floor(4.*(c[0]-c[1]*cos(a))/zoom),0.0,0); float n = cycle(r(floor(c*4.0),Shuffle)*0.2+r(floor(c*2.0),Shuffle)*0.3+r(floor(c),Shuffle)*0.5+Time*0.125); color Out = vector(n*2.0,pow(n,2.0),0.0); Float_Out = Out[0]; }