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 07:45:46 EDT (-0400)
  Re: volume rendering from a text file containing positions in 3 dimensions  
From: Alain
Date: 22 Mar 2010 19:29:32
Message: <4ba7fd5c$1@news.povray.org>

> Dear Alain and Christian
>
> Thank you very much for your response and giving me suggestions to read the text
> file.
> I am able to produce the image, but still i have got some issues
>
> I use camera location and look_at and light_source with these positions given
> below.
>
> Actually i used different positions for them to get a nice 3-dimensional image,
> but i think i am not using optimal values
>
> the set of particles positions i have, x-position ranges from 0.0 to 40.0;
> y-position ranges from 0.0-20.0 and z-position ranges from 0-10.0
>
> that means x-dimension is of 40 particle diameter length; y-dimension is of
> 20-particle diameter length and z-dimension is of 10-particle diameter length
>
> particle diameter is 1.0
>
> could you please suggest me the best way to put the light source and camera
> position
>
>
> background { color Cyan}
> camera {
>      location<0, 5, -3>
>      look_at<24, 9, 2>
> }
> light_source {<10, 5, -3>  color White}
>
>
>
> thanking you
> anki
>
>
>
>
>
>
>
>
> lain<aze### [at] qwertyorg>  wrote:

>>> 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
>>>
>>
>> Put a coma after each values.
>>
>> Sample file:
>>
>> #declare Cluster = union{
>>    #fopen DATA_FILE "pos.txt" read
>>    #read(DATA_FILE, PosX, PosY, PosZ)
>>     #while (defined(DATA_FILE))
>>     sphere{<PosX, PosY, PosZ>, Radius}
>>     #end
>>     #fclose DATA_FILE
>>     pigment{rgb 1}
>>     }
>>
>> It opens your input file and read the first 3 values.
>> It then start a loop.
>> The loop place a single sphere, then it reads the next 3 values.
>>
>> It will continue to loop until you reatch the end of your file. At that
>> moment, DATA_FILE becomes undefined and the loop falls through.
>> The #fclose DATA_FILE is not realy needed as the file is automaticaly
>> closed, and it's identifier suppressed, after you tried to read past
>> it's end.
>> After the end of the loop, a texture is applied to the union and the
>> union is closed.
>>
>> I used a #declare. It allows you to use your cluster of spheres several
>> times with no need to read your data a second time.
>>
>> This construction allows you to read any file of any length with no need
>> to know how many elements are contained in it.
>> You don't need any array.
>>
>> You can use any object as your shape, you are not limited to use spheres.
>>
>>
>> Alain
>
>
>
>

With no access to your data, it's dificult to juge, but I'll try using a 
set of 4000 randomly placed spheres.

You can try moving the camera around until you find a spot from where 
you get an interesting view.
Maybe moving the light to a somewhat larger distance from your spheres. 
I think that it may be to close, but it may need to be that close.
Some times, adding a second light can help.

Adding some highlight can add a lot but may not be interesting/advisable 
in your case. Try it to see.

You may try using smaler spheres, presently, there is a lot of overlaping.



Alain


Post a reply to this message

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