View Full Version : SL and wood
06-01-2005, 09:23 AM
I`m writing shader that shows desks on the floor. I have desks, but I don`t have pattern of a wood. What I need is lines in on direction, that are quite circular (something like sinus function, but more noised). How to do that? Any suggestions?
Thanks in advance for any help.
06-01-2005, 10:39 AM
There's a great example in the book advanced renderman and I believe the source code is at the renderman repository www.renderman.org/RMR
The gist of it is to intersect your shading point with concentric cylinders placed at some angle through your object's coordinate system to create rings. By adding noise in various places you can add wobble to the rings and vary their width and distance apart.
06-04-2005, 01:35 AM
Yes, using a sine pattern and a perlin noise function on top of that
have a look here for some examples, I think it's what you are looking for
A different approach would be writing a procedural texture function based on the Auto-Regression model.
You can get a pretty nice looking wood with that, and its very easy to implement.
Here is a sample result : http://matthewtuffin.co.uk/UniWork/ThirdYear/Portfolio%202%20AutoRegression.jpg
Let me know if you want some more information on this
06-08-2005, 10:02 AM
examples of noise are what I needed, but Auto-Regression sounds interesting (I`m writing this as my school project, so using something unusual would be great). Could you write some more about it? Sorry for so late reply by the way :sad:
06-09-2005, 09:16 AM
ok, here is how the Auto-Regression algorithm works.
First you fill your image plane with random values. The Auto-Regression algorithm works line by line on your image plane and in order to calculate each new pixel it takes into consideration the pixel values of the three pixels from the previous line, averages them and then adds a small noise ammount in order to produce a less unified result.
In order to add some more roughness and randomness you can also try not averaging the 3 pixel values, but multiplying them with a number so as you can assign more influence to a specific pixel.
So the equation for calculating the new pixel values is:
NewPixel(x,y) = C1 * Pixel1(x-1,y-1) + C2 * Pixel2(x,y-1) + C3 * Pixel3(x+1,y-1) + E
Where the C coeficients are the ammount of influence that pixel has in the new pixel values (C1 + C2 + C3 = 1) , so for example values like 0.33, 0.33, 0.33 would mean that the 3 pixel values are averaged and values like 0.9, 0.05, 0.05 would mean that the first pixel has the more influence of all.
And E is a random number in the range of -0.1 - 0.1.
I'm not at home right now so I dont have some code to show you but this is the basic concept. For more information and some source code on OpenGL have a look at here :
06-09-2005, 09:16 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.