POV-Ray : Newsgroups : povray.newusers : How to: Sphere with 3D Electric Field Lines Server Time
28 Apr 2024 06:53:06 EDT (-0400)
  How to: Sphere with 3D Electric Field Lines (Message 11 to 20 of 26)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 6 Messages >>>
From: Johann
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 05:15:00
Message: <web.5427d02a266802cb16298ca60@news.povray.org>
> Please do and if it works, let me know.
>
> I know what you mean. Learning Blender showed me that working with
> meshes requires different approaches.
> If you can programme then the world is your oyster. :-)
>
> --
>
> Regards
>      Stephen

Hi Stephen! Well I am actually not a professional programmer but I have some
experience with older programming tools not related to 3D Graphics. The problem
is that I do not have experience in creating 3D Graphics using a programming
language and especially no knowledge about modelling stuff. Anyway, as you may
probably saw above, I have two examples that I would like to be modified with
some help.

Maybe you noticed it with yourself, when we start learn programming, most of us
have something in the back of our head that we like to develop. This means,
having a goal is the trigger to learn a programming language. If you just start
to learn a programming language without plan, then 99% you will abandon before
you even start.

What is all I am asking is with the help of the group to tweak the above sample
codes for the Electric field where the resulting rendered images are those I
would like to have (the displayed result in both examples). I am interested in
new
ideas in Physics (the plan) those will trigger my interest to learn POV RAY
(think a trap with a cheese and a mouse walking around it), otherwise I am not
interested. Why, I will not be interested?Since, I do not have drawing and art
skills to spend my time with POV RAY just for the sake of creativity.

I really admire those skilled and talented people who create such amazing works
with POV RAY but I cannot follow since I do not have such creative skills as
also it is not my goal. So for once more, if the group could help me on the
above, certainly I will learn more and it will start to have fun for me. Without
having fun or like what you are doing, better not do it.

In any case, thanks for your post!

Johann


Post a reply to this message

From: Thomas de Groot
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 07:03:34
Message: <5427eb06$1@news.povray.org>
The two examples and especially the second, are interesting,a nd just 
for that I thank you. Unfortunately, I have no skills in physics to be 
able to really help you although I shall think a bit more about how 
things could be achieved. I have a hunch that it should not be too 
difficult, but then being a lay person in this...;-)

Thomas


Post a reply to this message

From: Johann
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 09:50:01
Message: <web.54280f80266802cb16298ca60@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> The two examples and especially the second, are interesting,a nd just
> for that I thank you. Unfortunately, I have no skills in physics to be
> able to really help you although I shall think a bit more about how
> things could be achieved. I have a hunch that it should not be too
> difficult, but then being a lay person in this...;-)
>
> Thomas

Hi Thomas!
I believe the first example is very simple, it could be possible to be modified
with ease. The second one although most impressive that is the most beautiful
rendered image of a field I have seen in my life so far, it will be a little
more difficult to modify but not impossible. What requires is someone with an
idea or better with some skill about how to render functions and especially
Physics Field functions on POV RAY. On a previous post Bill shared a POV RAY
code but it is too slow and it is not exactly what I need. You may notice on his
sample he uses clearly the Electric Field function but the total result is poor
in quality and performance.

If you search on the Internet you may find all the masterpieces of the world
with many sample POV RAY code but almost none to share the POV RAY Code for
electromagnetic fields. Those two examples I shared, are the only found on the
net. Strange, isn't it?

Thanks for your post!

Johann


Post a reply to this message

From: Thomas de Groot
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 10:00:43
Message: <5428148b$1@news.povray.org>
On 28-9-2014 15:45, Johann wrote:
> Hi Thomas!
> I believe the first example is very simple, it could be possible to be modified
> with ease. The second one although most impressive that is the most beautiful
> rendered image of a field I have seen in my life so far, it will be a little
> more difficult to modify but not impossible. What requires is someone with an
> idea or better with some skill about how to render functions and especially
> Physics Field functions on POV RAY. On a previous post Bill shared a POV RAY
> code but it is too slow and it is not exactly what I need. You may notice on his
> sample he uses clearly the Electric Field function but the total result is poor
> in quality and performance.
>
> If you search on the Internet you may find all the masterpieces of the world
> with many sample POV RAY code but almost none to share the POV RAY Code for
> electromagnetic fields. Those two examples I shared, are the only found on the
> net. Strange, isn't it?
>
> Thanks for your post!
>

As I said, my physics are poor and I do not know what to visualize under 
an electric field. Does that resemble a magnetic field like the one 
around the Earth? For the first example at least that would mean toruses 
in 3D space.

Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 10:16:26
Message: <5428183a$1@news.povray.org>
Hmm. I ran Bill's example and while some parts could readily be 
represented by toruses, all is not that simple... Maybe parametric 
objects but those are reputedly extremely slow. Isosurfaces are my best 
guess at the moment.

Thomas


Post a reply to this message

From: Johann
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 13:40:01
Message: <web.5428472b266802cb16298ca60@news.povray.org>
> As I said, my physics are poor and I do not know what to visualize under
> an electric field. Does that resemble a magnetic field like the one
> around the Earth? For the first example at least that would mean toruses
> in 3D space.
>
> Thomas

Hi Thomas! I am also not a physicist but the way to find a solution is to use
the first example which is simpler. I think what is needed is to attach in a way
the value of the amplitude (E=K*q/r^2) to the cylinder length. The formula of
the electric field is just a function like y=1/r^2. As I can imagine it probably
cannot work like this but using y=1/r^2 to create a color gradient with distance
as a first attempt.

I think you are right, the solution could be isosurfaces (I suppose they are
similar to contours or to equipotential surfaces) using the y=1/r^2 as a first
attempt. If you can find a solution on this, it would be greatly appreciated.

Ioannis


Post a reply to this message

From: Alain
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 14:11:47
Message: <54284f63@news.povray.org>

>> As I said, my physics are poor and I do not know what to visualize under
>> an electric field. Does that resemble a magnetic field like the one
>> around the Earth? For the first example at least that would mean toruses
>> in 3D space.
>>
>> Thomas
>
> Hi Thomas! I am also not a physicist but the way to find a solution is to use
> the first example which is simpler. I think what is needed is to attach in a way
> the value of the amplitude (E=K*q/r^2) to the cylinder length. The formula of
> the electric field is just a function like y=1/r^2. As I can imagine it probably
> cannot work like this but using y=1/r^2 to create a color gradient with distance
> as a first attempt.
>
> I think you are right, the solution could be isosurfaces (I suppose they are
> similar to contours or to equipotential surfaces) using the y=1/r^2 as a first
> attempt. If you can find a solution on this, it would be greatly appreciated.
>
> Ioannis
>
>

Isosurface ARE equipotential surfaces for a given equation. The surface 
is everywhere where the function evaluate to a thresshold value. That 
value can be zero, or just any arbitrary one.
For y=1/r^2, you need to replace (r^2) by sqrt(pow(x,2) + pow(y,2) + 
pow(z,2)) [working in 3D space]

Your formula mecomes:
sqrt(pow(x,2) + pow(y,2) + pow(z,2)) = r

If you use "r" as the treshold of your isosurface, it gives you a sphere 
of radius r.



Alain


Post a reply to this message

From: William F Pokorny
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 15:09:50
Message: <54285cfe$1@news.povray.org>
On 09/27/2014 11:39 AM, Johann wrote:
>
> Thanks Bill for your proposal! Just a few minutes ago POV RAY started to render
> the image and it took about 14 minutes for 320x240 AA 0.3. I believe that what I
> am looking for is relative easy and not so complicated.
>
Johann & all,

A memory came back to me a bit ago of work on some vector analysis 
functions a decade or more back. Sure enough in Pov-Ray's math.inc there 
is a collection of functions written by Christoph Hormann and Tor Olav 
Kristensen. Also an example  povray file in

scenes/incdemo/f_guncradient.pov.

Stealing code almost directly from func_gradient.pov and using our 
functions to control pigments instead of generate isosurfaces we can get 
something which runs quite a lot faster.

While likely not as artistic an output as I think you want, the result 
at least touches on all the elements I believe you seek.

I'll post an image generated by the code below to p.b.images shortly.

Bill P.

//-------------- e_static_v2.pov --------------------
#version 3.7;
global_settings {
     assumed_gamma 1
     ambient_light srgb <1,1,1>
}
#declare White = srgbft <1,1,1,0,0>;
background {
     color White
}
#declare Camera00 = camera {
     orthographic
     location <0,0,-10>
     sky <0,1,0>
     right x*(image_width/image_height)
     look_at <0,0,0>
}
#declare Light00 = light_source {
     <50,150,-250>, White
}
#declare Red = srgbft <1,0,0,0,0>;
#declare Blue = srgbft <0,0,1,0,0>;
#include "functions.inc"
#declare Fn00 = function (x,y,z,k,q) {
     (k*q)/(x*x+y*y+z*z+1e-7)
}
#declare Fn01 = function (x,y,z,_X,_Y,_Z,k,q) {
     Fn00(x-_X,y-_Y,z-_Z,k,q)
}
#declare Fn02 = function (x,y,z) {
     Fn01(x,y,z,2.5,0.0,0.0,1.0,-1.0)
}
#declare Fn03 = function (x,y,z) {
     Fn01(x,y,z,-2.5,0.0,0.0,1.0,1.0)
}
#declare Fn04 = function (x,y,z) {
     Fn02(x,y,z)+Fn03(x,y,z)
}
#declare Fn04normalized = function (x,y,z) {
     (Fn04(x*10,y*10,z*10)+1.0)/2.001
}
#declare Clear100 = srgbft <1,1,1,1,0>;
#declare ColorMapField = color_map {
     [ 0 Blue ]
     [ 0.5 Clear100 ]
     [ 1 Red ]
}
#declare PigmentField = pigment {
     function { Fn04normalized(x,y,z) }
     color_map { ColorMapField }
}
#declare TextureField = texture {
     pigment { PigmentField }
}
#declare Magenta = srgbft <1,0,1,0,0>;
#declare ColorMapContour = color_map {
     [ 0 Clear100 ]
     [ 0.5-(0.5/pow(2,1))-0.005 Clear100 ]
     [ 0.5-(0.5/pow(2,1))+0.000 Magenta ]
     [ 0.5-(0.5/pow(2,1))+0.005 Clear100 ]
     [ 0.5-(0.5/pow(2,2))-0.005 Clear100 ]
     [ 0.5-(0.5/pow(2,2))+0.000 Magenta ]
     [ 0.5-(0.5/pow(2,2))+0.005 Clear100 ]
     [ 0.5-(0.5/pow(2,3))-0.005 Clear100 ]
     [ 0.5-(0.5/pow(2,3))+0.000 Magenta ]
     [ 0.5-(0.5/pow(2,3))+0.005 Clear100 ]
     [ 0.5-(0.5/pow(2,4))-0.005 Clear100 ]
     [ 0.5-(0.5/pow(2,4))+0.000 Magenta ]
     [ 0.5-(0.5/pow(2,4))+0.005 Clear100 ]
     [ 0.5-0.005 Clear100 ]
     [ 0.5+0.000 Magenta ]
     [ 0.5+0.005 Clear100 ]
     [ 0.5+(0.5/pow(2,4))-0.005 Clear100 ]
     [ 0.5+(0.5/pow(2,4))+0.000 Magenta ]
     [ 0.5+(0.5/pow(2,4))+0.005 Clear100 ]
     [ 0.5+(0.5/pow(2,3))-0.005 Clear100 ]
     [ 0.5+(0.5/pow(2,3))+0.000 Magenta ]
     [ 0.5+(0.5/pow(2,3))+0.005 Clear100 ]
     [ 0.5+(0.5/pow(2,2))-0.005 Clear100 ]
     [ 0.5+(0.5/pow(2,2))+0.000 Magenta ]
     [ 0.5+(0.5/pow(2,2))+0.005 Clear100 ]
     [ 0.5+(0.5/pow(2,1))-0.005 Clear100 ]
     [ 0.5+(0.5/pow(2,1))+0.000 Magenta ]
     [ 0.5+(0.5/pow(2,1))+0.005 Clear100 ]
     [ 1 Clear100 ]
}
#declare PigmentContour = pigment {
     function { Fn04normalized(x,y,z) }
     color_map { ColorMapContour }
}
#declare TextureContour = texture {
     pigment { PigmentContour }
}
#macro Texture2Dslice_ListOf_0 ()
     texture { TextureContour }
     texture { TextureField }
#end
#declare Box00 = box {
     <-9.5,-9.5,-0.001>,<9.5,9.5,0.001>
}
#declare Sphere00 = sphere { <-0.25,0,0>, 0.1
     pigment { color Red }
     no_shadow
}
#declare Sphere01 = sphere { <0.25,0,0>, 0.1
     pigment { color Blue }
     no_shadow
}
#declare Obj2DSlice = object {
     object { Box00 }
     Texture2Dslice_ListOf_0()
}

//---
camera { Camera00 }
light_source { Light00 }
object { Sphere00 }
object { Sphere01 }
object { Obj2DSlice }


//--------------- Code below from scenes/incdemo/func_gradient.pov
#include "math.inc"
#declare PosX=-1.0;
#declare Spacing=0.018; // 0.018

union {
   #while (PosX < 1.0)
     #declare PosY=-0.5;
       #while (PosY < 0.5)
         #declare Pos=<PosX, PosY, 0>;
         #declare Vgrd=vGradient(Fn04normalized, Pos);
         #declare Vgrd=<Vgrd.x, Vgrd.y, 0>*0.1;
         #if (vlength(Vgrd)<0.300)
           cylinder {
             <PosX, PosY, 0>-Vgrd*0.105,
             <PosX, PosY, 0>+Vgrd*0.105,
             0.001
             texture {
               pigment { color srgb y*Gradient_Length(Fn04normalized, 
Pos)*0.25 }
             }
           }
         #end
         #declare PosY=PosY+Spacing;
       #end
     #declare PosX=PosX+Spacing;
   #end
}


Post a reply to this message

From: Johann
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 28 Sep 2014 16:15:01
Message: <web.54286b6b266802cb16298ca60@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
> On 09/27/2014 11:39 AM, Johann wrote:
> >
> > Thanks Bill for your proposal! Just a few minutes ago POV RAY started to render
> > the image and it took about 14 minutes for 320x240 AA 0.3. I believe that what I
> > am looking for is relative easy and not so complicated.
> >
> Johann & all,
>
> A memory came back to me a bit ago of work on some vector analysis
> functions a decade or more back. Sure enough in Pov-Ray's math.inc there
> is a collection of functions written by Christoph Hormann and Tor Olav
> Kristensen. Also an example  povray file in
>
> scenes/incdemo/f_guncradient.pov.
>
> Stealing code almost directly from func_gradient.pov and using our
> functions to control pigments instead of generate isosurfaces we can get
> something which runs quite a lot faster.
>
> While likely not as artistic an output as I think you want, the result
> at least touches on all the elements I believe you seek.
>
> I'll post an image generated by the code below to p.b.images shortly.
>
> Bill P.

Thank you Bill  very much! This is really very close to what I am trying to
achieve. May I ask something:
If I modify only the following declare expression:
#declare Fn00 = function (x,y,z,k,q) {
(k*q)/(x*x+y*y+z*z+1e-7)
}
would be enough to see a different rendered image or it is required in more
places? I am not speaking about rotation just different field distribution. Is
it possible the field lines to look like arrows that will show the direction of
the field? Besides that the equipotential lines are really beautiful!

Great Job and thank you for once more!

Johann


Post a reply to this message

From: Alain
Subject: Re: How to: Sphere with 3D Electric Field Lines
Date: 1 Oct 2014 19:01:33
Message: <542c87cd$1@news.povray.org>

> William F Pokorny <ano### [at] anonymousorg> wrote:
>> On 09/27/2014 11:39 AM, Johann wrote:
>>>
>>> Thanks Bill for your proposal! Just a few minutes ago POV RAY started to render
>>> the image and it took about 14 minutes for 320x240 AA 0.3. I believe that what I
>>> am looking for is relative easy and not so complicated.
>>>
>> Johann & all,
>>
>> A memory came back to me a bit ago of work on some vector analysis
>> functions a decade or more back. Sure enough in Pov-Ray's math.inc there
>> is a collection of functions written by Christoph Hormann and Tor Olav
>> Kristensen. Also an example  povray file in
>>
>> scenes/incdemo/f_guncradient.pov.
>>
>> Stealing code almost directly from func_gradient.pov and using our
>> functions to control pigments instead of generate isosurfaces we can get
>> something which runs quite a lot faster.
>>
>> While likely not as artistic an output as I think you want, the result
>> at least touches on all the elements I believe you seek.
>>
>> I'll post an image generated by the code below to p.b.images shortly.
>>
>> Bill P.
>
> Thank you Bill  very much! This is really very close to what I am trying to
> achieve. May I ask something:
> If I modify only the following declare expression:
> #declare Fn00 = function (x,y,z,k,q) {
> (k*q)/(x*x+y*y+z*z+1e-7)
> }
> would be enough to see a different rendered image or it is required in more
> places? I am not speaking about rotation just different field distribution. Is
> it possible the field lines to look like arrows that will show the direction of
> the field? Besides that the equipotential lines are really beautiful!
>
> Great Job and thank you for once more!
>
> Johann
>
>

If you want to replace the lines representing the field orientation and 
strength with arrows, you need to change where they are placed:
union {
   #while (PosX < 1.0)
     #declare PosY=-0.5;
       #while (PosY < 0.5)
         #declare Pos=<PosX, PosY, 0>;
         #declare Vgrd=vGradient(Fn04normalized, Pos);
         #declare Vgrd=<Vgrd.x, Vgrd.y, 0>*0.1;
         #if (vlength(Vgrd)<0.300)
           cylinder {
             <PosX, PosY, 0>-Vgrd*0.105,
             <PosX, PosY, 0>+Vgrd*0.105,
             0.001
             texture {
               pigment { color srgb y*Gradient_Length(Fn04normalized, 
Pos)*0.25 }
             }
           }
         #end
         #declare PosY=PosY+Spacing;
       #end
     #declare PosX=PosX+Spacing;
   #end
}

To become something like this:

union {
   #while (PosX < 1.0)
     #declare PosY=-0.5;
       #while (PosY < 0.5)
         #declare Pos=<PosX, PosY, 0>;
         #declare Vgrd=vGradient(Fn04normalized, Pos);
         #declare Vgrd=<Vgrd.x, Vgrd.y, 0>*0.1;
         #if (vlength(Vgrd)<0.300)
     union{
           cylinder {
             <PosX, PosY, 0>-Vgrd*0.105,
             <PosX, PosY, 0>,
             0.001}
	cone{
	   <PosX, PosY, 0>,0.03,
	   <PosX, PosY, 0>+Vgrd*0.105, 0}
             texture {
               pigment { color srgb y*Gradient_Length(Fn04normalized, 
Pos)*0.25 }
             }
           }
	cone{<PosX, PosY, 0>,0.03, <PosX, PosY, 0>+Vgrd*0.105, 0}
         #end
         #declare PosY=PosY+Spacing;
       #end
     #declare PosX=PosX+Spacing;
   #end
}

Now, one half of each lines stay the same while the other half is 
replaced by a cone. They are placed in an union so that they can get the 
pigment in one statement.


Alain


Post a reply to this message

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

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