POV-Ray : Newsgroups : povray.general : Rendering an electromagnetic field and photon rays Server Time
29 Mar 2024 11:06:05 EDT (-0400)
  Rendering an electromagnetic field and photon rays (Message 11 to 20 of 25)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 5 Messages >>>
From: Bald Eagle
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 15:50:01
Message: <web.59f0ea1d9b56bbddc437ac910@news.povray.org>
"cbpypov" <nomail@nomail> wrote:
 But the doc
> says it is limited to a box from 0,0,0 to 1,1,1. Is this a problem regarding my
> relatively complex volume?

Nope.
"df3 file size.
Df3 files can get very large, very quickly given the cubed dimensions. A df3
1000x1000x1000 at 1 byte resolution will take a gigabyte of storage. It
practice, aim to reduce the z dimension as much as possible letting the
density_file pattern scale up to the unit cube. Later scale the unit cube
dimension to the desired final size."

http://wiki.povray.org/content/User:Wfpokorny/DensityFile


Post a reply to this message

From: Stephen
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 16:05:10
Message: <59f0ee76$1@news.povray.org>
On 25/10/2017 20:35, cbpypov wrote:
> Thanks again to Bald Eagle and as well to Stephen for the fragment. Together
> with the python df3 class getting the df3 to work should be easy. But the doc
> says it is limited to a box from 0,0,0 to 1,1,1. Is this a problem regarding my
> relatively complex volume?

No it shouldn't be. You can scale your box up and when you do that you 
need to scale the emission down by the reciprocal of your scale. I think 
that is the right way round.
You will also need to translate the media by <-0.500,-0.500,-0.500> to 
get all of it into the box.


-- 

Regards
     Stephen


Post a reply to this message

From: Stephen
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 16:13:20
Message: <59f0f060$1@news.povray.org>
On 25/10/2017 20:46, Bald Eagle wrote:
> Nope.
> "df3 file size.
> Df3 files can get very large, very quickly given the cubed dimensions. A df3
> 1000x1000x1000 at 1 byte resolution will take a gigabyte of storage

That is true. I just created a 1200x1200x600 df3 and it is 850Mb but it 
zips down to 6Mb.

-- 

Regards
     Stephen


Post a reply to this message

From: cbpypov
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 16:20:01
Message: <web.59f0f13d9b56bbdd667cbe5f0@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
> On 25/10/2017 20:07, cbpypov wrote:
> > It's sad that I cannot attach an image
>
> But you can, use the newsgroup called povray.binaries.images.
>
> If you are using the web view.
> http://news.povray.org/povray.binaries.images/
>
>
> --
>
> Regards
>      Stephen

Great, I did not know of that (although it seems reasonable in an image related
forum) :)

Here is some visual information:

http://news.povray.org/povray.binaries.images/thread/%3Cweb.59f0ee4b3a8b1675667cbe5f0%40news.povray.org%3E/


Post a reply to this message

From: Stephen
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 16:22:13
Message: <59f0f275$1@news.povray.org>
On 25/10/2017 21:13, Stephen wrote:

> 
> That is true. I just created a 1200x1200x600 df3 and it is 850Mb but it 
> zips down to 6Mb.
> 

I forgot to mention. You can find a DF3 viewer here:

http://qcganime.web.fc2.com/OOSAWA/oosawaE.html


-- 

Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 16:59:19
Message: <59f0fb27$1@news.povray.org>
Le 17-10-25 à 11:48, cbpypov a écrit :
> Hi,
> 
> I'm trying to render a high quality "cover art" for a physics thesis
> (nanophotonics). I have basically two questions:
> 
>    1. What is the best way to generate a "glowing field distribution"?
>    2. What is the best way to illustrate a light ray or "photon path" coming from
> an emitter, say a small glowing sphere
> 
> For 1): Say I have field values in 3D that I could assign to desired colors and
> brightness values. So that that I have e.g. a list of (x, y, z, R, G, B,
> brightness). I thought of using a light source source at each point, maybe also
> using a semitransparent looks_like attribute; together with a medium, like:
> 
> box{
>     <-10,0,0>, <20, 5, 10>
>     pigment { rgbt 1 } // clear
>     hollow
>     interior{
>       media{
>         scattering{ 1., 0.17 extinction 0.01}
>         samples 5*Media_Quality, 10*Media_Quality  // min, max
>       } // end media
>     } // end interior
>   } // end box
> #end
> 
> But it does not have the desired effect. So how can I achieve something like
> this?
> 
> for 2): They should moreover be small particles emitting focussed beams or maybe
> glowing wiggly rays. Does anyone have an example of how to implement this?
> 
> Thanks in advance
> 
> 

You should note that the second samples parameter is never used unless 
you use sampling method 1 or 2. By default, method 3 is used.
You correctly don't use intervals, so, it keeps it's proper default 
value of 1. Increasing that will only make your renders take a LOT more 
time.

As said elsewhere, using emissive media seems more appropriate as you 
are modeling an area of emission. It will also render much faster.


Post a reply to this message

From: Alain
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 17:14:07
Message: <59f0fe9f$1@news.povray.org>
Le 17-10-25 à 14:57, Stephen a écrit :
> On 25/10/2017 17:31, Bald Eagle wrote:
>> "cbpypov" <nomail@nomail> wrote:
>>> Hi,
>>>
>>> I'm trying to render a high quality "cover art" for a physics thesis
>>> (nanophotonics). I have basically two questions:
>>>
>>>    1. What is the best way to generate a "glowing field distribution"?
>>>    2. What is the best way to illustrate a light ray or "photon path" 
>>> coming from
>>> an emitter, say a small glowing sphere
>>
>> I would say that you should look at Paul Nylander's work
>> http://www.bugman123.com/index.html
>> as he's and engineer, and has done an awful lot of very professional 
>> quality
>> scientific visualization with POV-Ray.
>>
>>> For 1): Say I have field values in 3D that I could assign to desired 
>>> colors and
>>> brightness values. So that that I have e.g. a list of (x, y, z, R, G, B,
>>> brightness).
>> .....
>>> So how can I achieve something like
>>> this?
>>
>> You use an EMISSIVE media.
>> I'd also consider generating your field as a df3 file, and then you 
>> can "sculpt"
>> the media density with that df3 information.
>>
> 
> DF3s are probably the way to do it. One drawback is that PovRay uses 
> df3s as a monochrome input. So you would need three of them to R G & B 
> images. jr might be able to help you with the df3 format as he is 
> working on a set of df3 utilities.
> 
> The code I use for rendering in colour with df3s is:
> 
>          #declare PF = 64  ; // multiplication factor
> 
>      #declare Df3_Material0 =
>      material{
>        texture {
>          pigment {
>            colour rgbft <1.000,1.000,1.00,0.000,1.000>
>          }
> 
>        }
> 
>        interior{
>          //ior                 1.000
>          //caustics            0.000
>          //dispersion          1.000
>          //dispersion_samples  7.000
>          //fade_power          0.000
>          //fade_distance       0.000
>          //fade_color          rgb <0.000,0.000,0.000>
Those can, and should, be omited.
>          media {
>            method     3
>            // intervals  10
MUST stay at 1. Don't use intervals is best.

>            //samples    1, 1
// May be omited : Use 10 samples by default
// Second value NOT used.
>            //confidence 0.900
>            //variance   0.008
>            //ratio      0.900
// All 3 NOT used with method 3
>            absorption rgb <0.000,0.000,0.000>
>            emission   rgb <1.000,0.000,0.000>     * PF
>            aa_threshold 0.050
>            aa_level    4
>            density {
>              density_file df3 "Your_red.df3"
>              interpolate 2
>            }
> 
>          }
> By default, method 3 use only 1 interval and 10 samples.
Using more that a single intervals will dramatically increase the time 
required by your render.
If you need more sampling, simply increase the samples vlue.
As only a single interval is used, only the first samples value is ever 
used. A second valus, if present, is silently ignored.
Also, confidence, variance and ratio, are used to distribute samples 
within various intervals, they are not used, and silently ignored.

intervals 1 samples 500
is much faster than
intervals 10 samples 5
for 10 times as many samples.


Post a reply to this message

From: Stephen
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 17:37:33
Message: <59f1041d$1@news.povray.org>
On 25/10/2017 22:14, Alain wrote:
> Le 17-10-25 à 14:57, Stephen a écrit :
>> On 25/10/2017 17:31, Bald Eagle wrote:
>>> "cbpypov" <nomail@nomail> wrote:
>>>> Hi,
>>>>
>>>> I'm trying to render a high quality "cover art" for a physics thesis
>>>> (nanophotonics). I have basically two questions:
>>>>
>>>>    1. What is the best way to generate a "glowing field distribution"?
>>>>    2. What is the best way to illustrate a light ray or "photon 
>>>> path" coming from
>>>> an emitter, say a small glowing sphere
>>>
>>> I would say that you should look at Paul Nylander's work
>>> http://www.bugman123.com/index.html
>>> as he's and engineer, and has done an awful lot of very professional 
>>> quality
>>> scientific visualization with POV-Ray.
>>>
>>>> For 1): Say I have field values in 3D that I could assign to desired 
>>>> colors and
>>>> brightness values. So that that I have e.g. a list of (x, y, z, R, 
>>>> G, B,
>>>> brightness).
>>> .....
>>>> So how can I achieve something like
>>>> this?
>>>
>>> You use an EMISSIVE media.
>>> I'd also consider generating your field as a df3 file, and then you 
>>> can "sculpt"
>>> the media density with that df3 information.
>>>
>>
>> DF3s are probably the way to do it. One drawback is that PovRay uses 
>> df3s as a monochrome input. So you would need three of them to R G & B 
>> images. jr might be able to help you with the df3 format as he is 
>> working on a set of df3 utilities.
>>
>> The code I use for rendering in colour with df3s is:
>>
>>          #declare PF = 64  ; // multiplication factor
>>
>>      #declare Df3_Material0 =
>>      material{
>>        texture {
>>          pigment {
>>            colour rgbft <1.000,1.000,1.00,0.000,1.000>
>>          }
>>
>>        }
>>
>>        interior{
>>          //ior                 1.000
>>          //caustics            0.000
>>          //dispersion          1.000
>>          //dispersion_samples  7.000
>>          //fade_power          0.000
>>          //fade_distance       0.000
>>          //fade_color          rgb <0.000,0.000,0.000>
> Those can, and should, be omited.

No chance. I use a modeller and that is what it outputs
But it is good that you mention it.

>>          media {
>>            method     3
>>            // intervals  10
> MUST stay at 1. Don't use intervals is best.
> 

Holes in the brain. I keep getting this the wrong way round. :-(


>>            //samples    1, 1
> // May be omited : Use 10 samples by default
> // Second value NOT used.
>>            //confidence 0.900
>>            //variance   0.008
>>            //ratio      0.900
> // All 3 NOT used with method 3
>>            absorption rgb <0.000,0.000,0.000>
>>            emission   rgb <1.000,0.000,0.000>     * PF
>>            aa_threshold 0.050
>>            aa_level    4
>>            density {
>>              density_file df3 "Your_red.df3"
>>              interpolate 2
>>            }
>>
>>          }
>> By default, method 3 use only 1 interval and 10 samples.
> Using more that a single intervals will dramatically increase the time 
> required by your render.
> If you need more sampling, simply increase the samples vlue.
> As only a single interval is used, only the first samples value is ever 
> used. A second valus, if present, is silently ignored.
> Also, confidence, variance and ratio, are used to distribute samples 
> within various intervals, they are not used, and silently ignored.
> 
> intervals 1 samples 500
> is much faster than
> intervals 10 samples 5
> for 10 times as many samples.

I wonder how many times I will need to be told. I seem to have a blind 
spot for this. I hope you don't get bored easily. ;-)

But I should not post bad information.



-- 

Regards
     Stephen


Post a reply to this message

From: Bald Eagle
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 25 Oct 2017 17:45:00
Message: <web.59f104fd9b56bbdd5cafe28e0@news.povray.org>
Car tire is all fixed.
25 min of driving time, and already I get a flat.   :|
UN-believable.

"cbpypov" <nomail@nomail> wrote:
> Moreover, I'd really enjoy getting your code and to see what can do with it :)

....and here it is:
(be aware that copying and pasting from a forum post may give you bad formatting
results, and you'll have to fix any CR/NL line errors)
I couldn't figure out to get the original Processing code - supposedly he has
all the code posted for each of his Code Challenge videos.
Perhaps someone else can figure it out.  (I still suck at using GitHub)
============================================================================

#version 3.7;
global_settings { assumed_gamma 1.0 }

//------------------------------------------
// SDL for Perlin Noise flow field
// NOT WORKING - vector array looks fine, it's the "movement" of the points that
the problem
// the points don't follow the flow field.
// The loop at the end just simulates an animation, without having to render all
the frames.
// Bill Walker - 2017
//------------------------------------------

#include "colors.inc"
#include "functions.inc"

#declare Aspect = image_width/image_height;

camera {
 location  <(image_width/2), (image_height/2), -600>
 right x*Aspect
 look_at <(image_width/2), (image_height/2), 0>
}

light_source { <10, 50, 0>  color rgb <1, 1, 1>}

sky_sphere { pigment {White} }

//=====================================================================================================================
==

#declare E = 0.000001;
#declare inc = 0.02;
#declare Scale = 10;

#declare cols = floor (image_width / Scale);
#declare rows = floor (image_height / Scale);
#declare Particles = array [100];
#declare FF = cols*rows;
//#debug concat ( " FF = ", str (FF, 3, 1),  "\n")
#declare FlowField = array [cols * rows];
#declare Mag = 1;
#declare MaxSpeed = 4;

#declare Seed = seed (12345);

#macro Vect (A)
 <cos(A), sin(A), 0>
#end // end macro Vect

#macro Particle ()
 #declare Pos = <rand(Seed)*image_width, rand(Seed)*image_height>;
 #declare Vel = <0, 0>; //<rand(Seed), rand(Seed)>;
 #declare Acc = <0, 0>;
 #declare PrevPos = Pos;
 array [4] {Pos, Vel, Acc, PrevPos}
#end // end macro Particles

#macro Update (P)
 #declare P[1] = P[1] + P[2];
 #declare P[1] = <min (P[1].x, MaxSpeed), min (P[1].y, MaxSpeed)>;  // limits
speed to max speed
 #declare P[0] = P[0] + P[1];
 #declare P[2] = P[2] * 0;
#end // end macro Update

#macro Follow (P, Vectors)
 #declare XX = floor (P[0].x / Scale);
 #declare YY = floor (P[0].y / Scale);
 #declare Index = XX + YY * cols;
 //#debug concat ( " Index = ", str (Index, 3, 1),  "\n")
 #declare F = Vectors [Index];
 Force (P, F)
#end // end macro Follow

#macro Force (P, F)
 #declare P[2] = P[2] + <F.x, F.y>;
#end // end macro Force

#macro Show (P)
 //sphere {<P[0].x, P[0].y, 0> 0.5 texture {pigment {Color} finish {specular
0.4}} }
 cylinder {<P[3].x, P[3].y, 0>, <P[0].x, P[0].y, 0> 1 texture {pigment {Color}
finish {specular 0.4}} }
 UpdatePrev (P)
#end // end macro Show

#macro UpdatePrev (P)
 //#debug concat ( "Prev = ", vstr(3, P[3], ", ", 2, 0), " \n")
 #declare P[3] = P[0]+<E,E>;
 //#debug concat ( "Current = ", vstr(3, P[3], ", ", 2, 0), " \n")
#end // end macro UpdatePrev

#macro Edges (P)
 //#local PX = P[0].x;
 //#local PY = P[0].y;
 #if (P[0].x > image_width)  #declare P[0] = <1, P[0].y>;     UpdatePrev (P)
#end
 #if (P[0].x < 0)    #declare P[0] = <image_width-1, P[0].y>;  UpdatePrev (P)
#end
 #if (P[0].y > image_height)  #declare P[0] = <P[0].x, 0>;     UpdatePrev (P)
#end
 #if (P[0].y < 0)    #declare P[0] = <P[0].x, image_height-1>;  UpdatePrev (P)
#end
#end // end macro Edges


#macro Draw()
 #declare zoff = 0;
 #local yoff = 0;
 #for (Y, 0, rows-1)
  #local xoff = 0;
  #for (X, 0, cols-1)
   #local index = X + Y * cols;

   #local r = f_noise_generator (xoff, yoff, zoff, 3); // 3 = Perlin noise
   #local A = degrees (r*2*pi);
   #local V = Vect (A)*Mag;
   #declare FlowField [index] = V;

   #local xoff = xoff + inc;

   #local Grayscale = 0;
   //#local HSV_Angle = rand (Seed)*360;
   //#local Color = CHSV2RGB (<HSV_Angle, 1, 1>);
   //box {<X*Scale, (Y/Aspect)*Scale, 0>, <X*Scale+Scale,
((Y*Scale)/Aspect)+Scale, 0.1> pigment {rgb Grayscale}}
   cylinder {<0,0,0>, V*(1/Mag)*Scale 0.5 translate <X*Scale, Y*Scale, 0>
pigment {rgb Grayscale}}
  #end // end for X
  #local yoff = yoff + inc;
  //#declare zoff = zoff + 0.0003;
 #end // end for Y
#end // end macro Draw

//Draw()
#for (i, 0, 99)
 #declare Particles [i] = Particle();  // create a particle with position,
velocity, accel
#end

#for (Clock, 0, 500)
Draw() // update vectors

#for (i, 0, 99)
 #declare Color = CHSV2RGB (<i*3.6, 1, 1>);

 Follow (Particles [i], FlowField)   // pair particle at location with vector in
that part of field
 Update (Particles [i])     // update particle position, velocity, acceleration
 Edges  (Particles [i])     // wrap particles around edges
 Show   (Particles [i])     // plot particle positions / paths

#end // end for i

#end // end for Clock


Post a reply to this message

From: Tor Olav
Subject: Re: Rendering an electromagnetic field and photon rays
Date: 26 Oct 2017 10:22:53
Message: <59f1efbd$1@news.povray.org>
Hi

Back in 2003 Jaap Frank made some nice and interesting media images that 
might be relevant to you.

See this thread:
Newsgroup: povray.binaries.scene-files
Subject: Quantum Waves in Media
From: Jaap Frank
Date: 12 Jan 2003 04:45:23

Here's a link to that thread in the web interface:
http://news.povray.org/povray.binaries.scene-files/thread/%3C3e20f2e3%40news.povray.org%3E/

You'll find both images and code in that thread.

-- 
Tor Olav
http://subcube.com


On 10/25/2017 05:48 PM, cbpypov wrote:
> Hi,
>
> I'm trying to render a high quality "cover art" for a physics thesis
> (nanophotonics). I have basically two questions:
>
>   1. What is the best way to generate a "glowing field distribution"?
>   2. What is the best way to illustrate a light ray or "photon path" coming from
> an emitter, say a small glowing sphere
>
> For 1): Say I have field values in 3D that I could assign to desired colors and
> brightness values. So that that I have e.g. a list of (x, y, z, R, G, B,
> brightness). I thought of using a light source source at each point, maybe also
> using a semitransparent looks_like attribute; together with a medium, like:
>
> box{
>    <-10,0,0>, <20, 5, 10>
>    pigment { rgbt 1 } // clear
>    hollow
>    interior{
>      media{
>        scattering{ 1., 0.17 extinction 0.01}
>        samples 5*Media_Quality, 10*Media_Quality  // min, max
>      } // end media
>    } // end interior
>  } // end box
> #end
>
> But it does not have the desired effect. So how can I achieve something like
> this?
>
> for 2): They should moreover be small particles emitting focussed beams or maybe
> glowing wiggly rays. Does anyone have an example of how to implement this?
>
> Thanks in advance
>
>


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 5 Messages >>>

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