adding color pattern

hi,
  I want to generate a pool-ball like object. Basically, instead of
having a uniform colored object, I want to add some other color to the
object but the object is made of uniform material. Can I generate a
.cal file and directly manipulate the color at specific location using
local coordinates and use colorFunc to add the pattern? It sounds
trival to do but I m having trouble generating it right. Thank you
very much.

···

--
always on full sail during high tides

I'm not a mathmatical type, so I can't advise you on a cal file, though I'm
sure there's a way.

But you could use a 2 color pic file and project it on sideways.. say 7/8 is
red and 1/8 is white. That should give you a white circle on a red ball.
Give the pic enough resolution so the color boundary is crisp.
You'll have to make it an octree and use it as an instance if you want to
move it randomly.

HTH
Rob F

···

-----Original Message-----
From: [email protected]
To: [email protected]
Sent: 9/26/2005 4:41 PM
Subject: [Radiance-general] adding color pattern

hi,
  I want to generate a pool-ball like object. Basically, instead of
having a uniform colored object, I want to add some other color to the
object but the object is made of uniform material. Can I generate a
.cal file and directly manipulate the color at specific location using
local coordinates and use colorFunc to add the pattern? It sounds
trival to do but I m having trouble generating it right. Thank you
very much.

--
always on full sail during high tides

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

Sorry for the late reply. Here's some examples from my work:

o_ball-1.rad:

···

On Mon, 26 Sep 2005 19:41:00 -0400 <[email protected]> wrote:

hi,
  I want to generate a pool-ball like object. Basically, instead of
having a uniform colored object, I want to add some other color to the
object but the object is made of uniform material. Can I generate a
.cal file and directly manipulate the color at specific location using
local coordinates and use colorFunc to add the pattern? It sounds
trival to do but I m having trouble generating it right. Thank you
very much.

----
void mixfunc ball_1_surf
6 clear_plastic yellow_billiard
  num_disc billiards.cal
  -s 57.15
0
1 18.0

ball_1_surf sphere ball_1
0
0
4 0 0 0
  57.15

white_flat colorpict ball_1_unlit
9 unlit_red unlit_green unlit_blue
  lcd-01.pic
  billiards.cal ballmap_u ballmap_v
  -s 57.15
0
3 0.65 0.45 0.45

void mixpict ball_1_num
9 redled ball_1_unlit
  lit lcd-01.pic
  billiards.cal ballmap_u ballmap_v
  -s 57.15
0
0

ball_1_num ring face-1a
0
0
8 0 54.35288 0
  0 1 0
  0 17.660321

ball_1_num ring face-1b
0
0
8 0 -54.35288 0
  0 -1 0
  0 17.660321
----

o_ball-9.rad:
----
white_billiard colorfunc ball_9_col
6 bh_red bh_green bh_blue
  billiards.cal
  -s 57.15
0
4 0.9 0.9 0.0
  60.0

void mixfunc ball_9_surf
6 clear_plastic ball_9_col
  num_disc billiards.cal
  -s 57.15
0
1 18.0

ball_9_surf sphere ball_9
0
0
4 0 0 0
  57.15

white_flat colorpict ball_9_unlit
9 unlit_red unlit_green unlit_blue
  lcd-09.pic
  billiards.cal ballmap_u ballmap_v
  -s 57.15
0
3 0.65 0.45 0.45

void mixpict ball_9_num
9 redled ball_9_unlit
  lit lcd-09.pic
  billiards.cal ballmap_u ballmap_v
  -s 57.15
0
0

ball_9_num ring face-9a
0
0
8 0 54.35288 0
  0 1 0
  0 17.660321

ball_9_num ring face-9b
0
0
8 0 -54.35288 0
  0 -1 0
  0 17.660321
----

m_balls.rad:
----
void plastic white_flat
0
0
5 0.6 0.6 0.6
  0.0 0.1

void texfunc rough1
4 gloss_dx gloss_dy gloss_dz
  gloss.cal
0
3 0.02 0.02 0.02

void plastic white_billiard
0
0
5 0.6 0.6 0.6
  0.03 0.02

# 0.9 0.9 0.0
void plastic yellow_billiard
0
0
5 0.54 0.54 0.0
  0.03 0.02

etc...

rough1 dielectric clear_plastic
0
0
5 1.25 1.25 1.25
  1.3 0.0

void light redled
0
0
3 500 0 0
----

billiards.cal:
----
ballmap_u = 0.5+if(Py, -Px, Px)*0.5;
ballmap_v = 0.5+Pz*0.5;

RADIAN : 180 / PI;

py_angle = acos(abs(Py)) * RADIAN;
pz_angle = acos(abs(Pz)) * RADIAN;

num_disc = if(A1 - py_angle, 1, 0);

bh_red = if(A4 - pz_angle, 1.0, A1);
bh_green = if(A4 - pz_angle, 1.0, A2);
bh_blue = if(A4 - pz_angle, 1.0, A3);

rgb_grey(r,g,b) = r + g + b;

max3(a,b,c) : if(a-b, if(a-c, a, c), if(b-c, b, c));

lit(r,g,b) = r - (1/255);
unlit(r,g,b) : g - (1/255);
unlit_red(r,g,b) = clip((unlit(r,g,b) * A1) + (1 - unlit(r,g,b)));
unlit_green(r,g,b) = clip((unlit(r,g,b) * A2) + (1 - unlit(r,g,b)));
unlit_blue(r,g,b) = clip((unlit(r,g,b) * A3) + (1 - unlit(r,g,b)));

on : 1;
off : 0;

half : 0.5;
----

Hopefully that'll help you. All of the balls are very similar. Just have
your seven colours defined (in m_balls.rad in my example) plus black for
the 8-ball. Then it's just a copy-and-paste job for the other balls, just
changing the names slightly. The 'low' balls have a solid colour, the
'high' balls have only a band of colour. That's what the
bh_{red,green,blue} functions are modifying. Then just place the balls in
the scene with an !xform line. This is needed to have the functions
modifying the material transform with the rest of the ball.

bye