POV-Ray : Newsgroups : povray.advanced-users : File Read Problem Server Time
1 Nov 2024 01:26:01 EDT (-0400)
  File Read Problem (Message 1 to 3 of 3)  
From: David Vincent-Jones
Subject: File Read Problem
Date: 19 Apr 2003 17:36:50
Message: <3ea1c172@news.povray.org>
I am trying to use a file read to both position an object as well as
establishing the objects color..
The positioning is displaying correct as expected but the color is only
displaying as white.

#fopen DAT_File "C:\IMGdat.dat" read
#while (defined(DAT_File))
        #read (DAT_File, C1,C2,C3)
        sphere { <C1,C2,C3> 2 pigment{color rgb <C1, C2, C3>}}
#end

Can somebody suggest what may cause the problem.

David


Post a reply to this message

From: Warp
Subject: Re: File Read Problem
Date: 19 Apr 2003 21:49:42
Message: <3ea1fcb6@news.povray.org>
David Vincent-Jones <geo### [at] galaxynetcom> wrote:
> The positioning is displaying correct as expected but the color is only
> displaying as white.

  That's probably because C1, C2 and C3 are larger than 1.
  You have to divide them with a value which scales them into the range
0-1 in order to get a color.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From:
Subject: Re: File Read Problem
Date: 19 Apr 2003 22:00:18
Message: <3ea1ff32@news.povray.org>
Hi David,

I've checked your code with
   Windows 2000 Professional
   POV-Ray 3.5.icl.win32
using  the following IMGdat.dat file:

1, 0, 0,
0, 1, 0,
0, 0, 1,
1, 1, 1,

This gave four overlapping spheres with the expected colors: red, green,
blue, and white. The only reason for your error I can think of is "color
overflow": are you sure all your C1, C2, C3 are >=0 and <=1?

   Sputnik


Post a reply to this message

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