POV-Ray : Newsgroups : povray.newusers : volume rendering from a text file containing positions in 3 dimensions : Re: volume rendering from a text file containing positions in 3 dimensions Server Time
7 Jul 2024 08:21:58 EDT (-0400)
  Re: volume rendering from a text file containing positions in 3 dimensions  
From: anki
Date: 17 Mar 2010 12:45:01
Message: <web.4ba10674d4b839cffdf151b0@news.povray.org>
Hi  Alain and Simon

Thanks a lot for your reply, atleast some things are clear now

actually my text file looks like below
1st column is sphere number
2nd column is x-position, 3rd- y position and 4th- z -position
there are 4000 particles in a box

1 487.726807 383.565125 99.485672
2 377.206238 393.352325 17.296064
3 452.328613 346.985321 33.054535
4 453.301697 334.173981 14.480576
5 724.187988 389.938171 55.237068
6 298.778717 388.706055 30.780521
7 685.588074 366.411072 31.322350
...............................
.........................
...........................
4000 56.78   456.67   234.56


i can make the text file , where columns are separated by commas like

x1,y1,z1
x2,y2,z2
x3,y3,z3
......
......

still i have a doubt about the format to use in *.pov file to read this text
file

is it like to put the commands as

"#fopen identifier 'pos.txt' read
while loop
end"    in a file named sphere.pov and use ./povray sphere.pov to produce
rendering image ?

could you please suggest me a sample *.pov file which reads a text file
containing the positions of particles like i have

thank you very much
regards
anki













Alain <aze### [at] qwertyorg> wrote:

> > dear users
> > i installed POV-Ray on a linux machine and it will be nice if somebody helps me
> > with the question below
> >
> > i have a txt file containing spherical particle positions (x,y and z) and i want
> > to produce a 3 -dimensional image from this txt file
> >
> > i just started using POV Ray today and i think we need to produce two files with
> > extension *.ini and *.pov from the text file of positions
> >
> > thanks for the help
> > regards
> > anki
> >
> >
> >
> In your text file, are the values separated by comas or by spaces?
> In the first case, a simple #while loop is all you need to read those
> values.
> If you don't know how many elements are in the file, you can use
> #while(!eof <file>).... #end to read untill you reatch the end of the
> text file. In that case, you read the first 3 values before you start
> the loop, and you read the next 3 as the last instruction of the loop,
> just before the #end.
>
> In the second case, it's beter to do a search and replace to replace the
> spaces by comas.
>
> The text file is not used to generate the *.ini nor the *.pov file. The
> *.pov file will use the *.txt file as a data source.
>
> The *.pov file is the one actualy describing the scene: camera location
> and caracteristics, light(s) location(s) intensity and colours, what
> objects to place at each locations with what texture,... In the *.pov
> file, you will read your data and construct the scene from that.
>
> The *.ini file is optional. You can render the *.pov file directly from
> the command line:
> <path>pvengine.exe file.pov
> You can add the image's dimentions the same way, just add +w1025 +h768
> to get a 1024 by 768 pixels image.
>
> The *.ini file is mostly usefull when you need to enter several
> arguments and it becomes unweldy to always write them on the command
> line. It's also very usefull when doing animations as Simon proposed
> with his sample.
> You can have a *test.ini to do the test renders, then a *.ini or
> *final.ini file to render the final image. Both versions refers to the
> same *.pov file.
> The test version will have smaler resolution and lower, or no, aa,
> possibly lower quality setting, less animation frames,...
> The final version will use full quality, good aa, larger resolution, all
> the animation's frames,...
>
>
> Alain


Post a reply to this message

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