perlin noise

Hi,

I am using the dirt.cal function to generate Perlin noise, but I would like to make a different noise pattern for each image given the same A1 parameter. How do I do this?

Thanks!

--xian

Hi Xian,

Actually dirt.cal uses the fractal noise function: fnoise3(x,y,z). The Perlin noise function is noise3(x,y,z). You can look in dirt.cal to see how the function is used there and in rayinit.cal for library functions that are available. There are also additional functions: noise3x(x,y,z), noise3y(x,y,z) and noise3z(x,y,z). As I understand from RwR these represent the partial derivative of the Perlin noise function at the point (see RwR page 253).

Regards,

-Jack de Valpine

Yun-Xian Ho wrote:

···

Hi,

I am using the dirt.cal function to generate Perlin noise, but I would like to make a different noise pattern for each image given the same A1 parameter. How do I do this?

Thanks!

--xian

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

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general
  
--
# Jack de Valpine
# president
#
# visarc incorporated
# http://www.visarc.com
#
# channeling technology for superior design and construction

Hi Xian,

Jack is correct. If you want the noise to appear different in subsequent images, you must alter your scene description. Probably the easiest is to add some transform to the material, like so:

void brightfunc random_dirt
10 dirt dirt.cal -t ${rand_x} ${rand_y} ${rand_z} -rx ${rand_rx} -ry ${rand_ry}
0
1 0.5

I am assuming an "A1" parameter of 0.5, but use whatever you like. The above data may be passed in a file (say "dirt.fmt") to rcalc and inserted in your scene like so:

!date +%s | rcalc -e 'seed=$1/1000 - 1192290' \
  -e 'rand_x=3000*rand(seed*1.901+3817)' \
  -e 'rand_y=3000*rand(seed*-1.627-592)' \
  -e 'rand_z=3000*rand(seed*9.67-5824)' \
  -e 'rand_rx=180*rand(seed*2.083+964)' \
  -e 'rand_ry=360*rand(seed*4.813+371)' -o dirt.fmt

random_dirt plastic my_plastic
(etc.)

Since "date +%s" outputs a different number of seconds every time you run it, this should give you a new transform unrelated to the last one every time -- as long as you don't run them less than a second apart.

Why do you want to do this, out of curiosity?

-Greg

···

From: Jack de Valpine <[email protected]>
Date: October 13, 2007 7:52:14 AM PDT

Hi Xian,

Actually dirt.cal uses the fractal noise function: fnoise3(x,y,z). The Perlin noise function is noise3(x,y,z). You can look in dirt.cal to see how the function is used there and in rayinit.cal for library functions that are available. There are also additional functions: noise3x(x,y,z), noise3y(x,y,z) and noise3z(x,y,z). As I understand from RwR these represent the partial derivative of the Perlin noise function at the point (see RwR page 253).

Regards,

-Jack de Valpine

Yun-Xian Ho wrote:

Hi,

I am using the dirt.cal function to generate Perlin noise, but I would like to make a different noise pattern for each image given the same A1 parameter. How do I do this?

Thanks!

--xian

Hi Greg,

Well at least I was on the right track as I had recommended something similar to Xian (transforms on the noise). (I guess this was offline though as I just hit reply.) I could not figure out how to generate a random value like this, so I was recommending that something could be scripted where random values could be generated with some other scripting language. This is much more elegant as it keeps it all (relatively) native and in-line to boot.

-Jack

Greg Ward wrote:

···

Hi Xian,

Jack is correct. If you want the noise to appear different in subsequent images, you must alter your scene description. Probably the easiest is to add some transform to the material, like so:

void brightfunc random_dirt
10 dirt dirt.cal -t ${rand_x} ${rand_y} ${rand_z} -rx ${rand_rx} -ry ${rand_ry}
0
1 0.5

I am assuming an "A1" parameter of 0.5, but use whatever you like. The above data may be passed in a file (say "dirt.fmt") to rcalc and inserted in your scene like so:

!date +%s | rcalc -e 'seed=$1/1000 - 1192290' \
    -e 'rand_x=3000*rand(seed*1.901+3817)' \
    -e 'rand_y=3000*rand(seed*-1.627-592)' \
    -e 'rand_z=3000*rand(seed*9.67-5824)' \
    -e 'rand_rx=180*rand(seed*2.083+964)' \
    -e 'rand_ry=360*rand(seed*4.813+371)' -o dirt.fmt

random_dirt plastic my_plastic
(etc.)

Since "date +%s" outputs a different number of seconds every time you run it, this should give you a new transform unrelated to the last one every time -- as long as you don't run them less than a second apart.

Why do you want to do this, out of curiosity?

-Greg

From: Jack de Valpine <[email protected]>
Date: October 13, 2007 7:52:14 AM PDT

Hi Xian,

Actually dirt.cal uses the fractal noise function: fnoise3(x,y,z). The Perlin noise function is noise3(x,y,z). You can look in dirt.cal to see how the function is used there and in rayinit.cal for library functions that are available. There are also additional functions: noise3x(x,y,z), noise3y(x,y,z) and noise3z(x,y,z). As I understand from RwR these represent the partial derivative of the Perlin noise function at the point (see RwR page 253).

Regards,

-Jack de Valpine

Yun-Xian Ho wrote:

Hi,

I am using the dirt.cal function to generate Perlin noise, but I would like to make a different noise pattern for each image given the same A1 parameter. How do I do this?

Thanks!

--xian

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

--
# Jack de Valpine
# president
#
# visarc incorporated
# http://www.visarc.com
#
# channeling technology for superior design and construction