POV-Ray : Newsgroups : povray.newusers : Assigning sphere colours using rgb : Re: Assigning sphere colours using rgb Server Time
19 Apr 2024 06:31:25 EDT (-0400)
  Re: Assigning sphere colours using rgb  
From: david
Date: 23 Aug 2017 10:00:00
Message: <web.599d89b160abce79c326978c0@news.povray.org>
Thanks Alain, also for the extra info
david

Alain <kua### [at] videotronca> wrote:
> Le 17-08-22 à 18:08, david a écrit :
> > 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,
> This one show as cyant
> > -10,10,-10,238,174,238,
> > -10,-10,-10,176,196,222,
> Those two show as pure white.
> In a radiosity scene, they'll have a huge impact on any neibouring tints.
>
> >
> > (I got the rgb colours from using `col2rgb(c("deepskyblue2", "plum2",
> > "lightsteelblue"))` in the R software)
> >
> >
> >
> >
> >
>
> In POV-Ray, all colours are in the 0..1 range. Anything larger than that
> gets shown as if they where set at 1.
> If you see those on a slightly reflective surface, then, you'll be able
> to see the actual colours. Try a plane with this texture:
> texture{pigment{rgb 0} finish{reflection 1/200 diffuse 0 ambient 0}}
>
> What you need is to divide your 0..255 range values by 255 as follow:
> texture { pigment{ rgb <v4/255, v5/255, v6/255> }
>
> OR, use this shorter form :
> texture { pigment{ rgb <v4, v5, v6>/255 }
>
> As those are probably gamma precomputed, using srgb is probably beter :
> texture { pigment{ srgb <v4, v5, v6>/255 }
>
>
> Alain


Post a reply to this message

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