POV-Ray : Newsgroups : povray.newusers : Assigning sphere colours using rgb : Assigning sphere colours using rgb Server Time
26 Apr 2024 00:55:32 EDT (-0400)
  Assigning sphere colours using rgb  
From: david
Date: 22 Aug 2017 18:10:01
Message: <web.599cab5be8844a66c326978c0@news.povray.org>
I am trying to plot spheres with positions and colours taken from a text file.

This message (
http://news.povray.org/povray.general/thread/%3Cweb.4f05a8fc1cabb177be8719c80@news.povray.org%3E/
) has helped with the initial plotting, but I cannot get the colours to render.
What am I doing wrong please?

Example code

#include "colors.inc"

global_settings {
 assumed_gamma 1.0
 ambient_light White
}

light_source { <50,50,-50> color White }

camera {
  sky <0, 0, -1>
  look_at <0, 0, 0>
  location <-25, 10,-25>
}

plane { <0,0,-1>, 0
  pigment { color White }
}

#fopen FileHandle1 "coords1.txt" read
#while (defined(FileHandle1))
     #read (FileHandle1, v1, v2, v3, v4, v5, v6)
     sphere { <v1, v2, v3>,    2
      texture { pigment{ rgb <v4, v5, v6> }
                finish { reflection 1  }}}
#end

------------------------------------------------------------------
And the coords1.txt file

10,0,-10,0,178,238,
-10,10,-10,238,174,238,
-10,-10,-10,176,196,222,

(I got the rgb colours from using `col2rgb(c("deepskyblue2", "plum2",
"lightsteelblue"))` in the R software)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.