View Full Version : SL and wood
regispl 06012005, 08:23 AM hello!
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.


playmesumch00ns
06012005, 09: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.
Segmoria
06042005, 12: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
http://www.student.kuleuven.ac.be/~m0216922/CG/perlinnoise.html (http://www.student.kuleuven.ac.be/%7Em0216922/CG/perlinnoise.html)
A different approach would be writing a procedural texture function based on the AutoRegression 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
regispl
06082005, 09:02 AM
thanks!
examples of noise are what I needed, but AutoRegression 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:
Segmoria
06092005, 08:16 AM
ok, here is how the AutoRegression algorithm works.
First you fill your image plane with random values. The AutoRegression 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(x1,y1) + C2 * Pixel2(x,y1) + C3 * Pixel3(x+1,y1) + 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 :
http://graphicsxp.free.fr/html/art.html
CGTalk Moderation
06092005, 08: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 ©20002014, Jelsoft Enterprises Ltd.