3D_COLOR

3D_COLOR N,R,G,B

SET THE COLOR OF THE 3D OBJECT NUMBER N

  • Type: Command
  • Parameters: 4
  • Group: 3D Objects

ACTION

The command 3D_COLOR N,R,G,B colors the 3D object designated by its number, with the color resulting of the addition of the 3 specified primary components: red (R), green (G) and blue (B).

The intensity of each primary component can vary from 0 to 255. (0 = no color, 255 = full intensity)

Remark: when all the 3 primary components are 0, the result color is black (no color), when all the 3 primary components are 255, the result color is white (addition of the 3 primary colors at maximum intensity).

Recall:

- yellow color (red + green) when B = 0

- gray color when R=G=B

- violet color (red + blue) when G = 0

- black color when R=0, G=0, B=0

- white color when R=255, G=255, B=255

SYNTAX: 3D_COLOR N,R,G,B

  • N = 3D object number (integer or real). Must be greater than 0 and less than or equal to the allowed maximum number of 3D objects.
  • R = red component value (integer or real) of the result color.
  • G = green component value (integer or real) of the result color.
  • B = blue component value (integer or real) of the result color.

USE

  • The command 3D_COLOR is used to paint a 3D object.

ERROR

  • If number N is not a correct expression.
  • If number N exceeds the allowed maximum number of 3D objects.
  • If number N is not greater than 0.
  • If 3D object number N does not exist.
  • If R or G or B is not a correct expression.
  • If R or G or B is less than 0 or greater than 255.

EXAMPLE

rem create a 3D world

scene3d 1

rem resize the 3D world

width 1,300:height 1,300

rem place the camera

cam_position 5,10,10

rem create a cube (3D object number 1) with side length of 1.5

3d_cube 1,1.5

rem wait for 1 second

wait 1000

rem give a yellow color to the cube (yellow = red + green)

3d_color 1,200,200,0

SEE ALSO

-