POV-Ray : Newsgroups : povray.newusers : plotting a 3D gaussian question Server Time
21 Dec 2024 08:09:12 EST (-0500)
  plotting a 3D gaussian question (Message 1 to 10 of 10)  
From: Martin
Subject: plotting a 3D gaussian question
Date: 27 Oct 2016 11:10:00
Message: <web.58121806ce56b72edd4282660@news.povray.org>
Hi,

i am new to povray and want to use it for scientific images. I want to plot a
semitransparent 3D gaussian function into my image: (at the spot of the green
balls)

http://www.directupload.net/file/d/4521/38isrmk6_png.htm

I have tried playing around with isosurface functions, but for some reason it
just doesnt just show up inside the structure. Can you give me a hint how to
position a plotted function at an arbitrary position? For Example I want to
create it with the center peak at the sharp cone end pointing into the green
stuff.

thanks for help,
Martin


Post a reply to this message

From: Bald Eagle
Subject: Re: plotting a 3D gaussian question
Date: 27 Oct 2016 12:25:01
Message: <web.5812296ca0290900b488d9aa0@news.povray.org>
"Martin" <mar### [at] t-onlinede> wrote:
> Hi,

Welcome!

> i am new to povray and want to use it for scientific images.

> I have tried playing around with isosurface functions, but for some reason it
> just doesnt just show up inside the structure. Can you give me a hint how to
> position a plotted function at an arbitrary position? For Example I want to
> create it with the center peak at the sharp cone end pointing into the green
> stuff.
>
> thanks for help,
> Martin

This very topic was covered recently:
http://news.povray.org/web.5794faac1a150b855e7df57c0%40news.povray.org

I think A is the amplitude, so just translate the whole curve by using
translate -y*A
to make the peak be at or close to <0, 0, 0>

then you can use an other transformations to move it anywhere you wish.


Post a reply to this message

From: Bald Eagle
Subject: Re: plotting a 3D gaussian question
Date: 27 Oct 2016 12:50:01
Message: <web.58122fc6a0290900b488d9aa0@news.povray.org>
This ought to do it:


#version 3.7;

// 3D Gussian isosurface with peak at origin
// October 2016, Bald Eagle

#include "colors.inc"
#include "debug.inc"

global_settings {
  assumed_gamma 1.0
}

camera {
   location  <5, 10, -30.0>
   look_at   <0, 0,  0.0>
 right    x*image_width/image_height
}

light_source { < 10, 20, -50>  color White}

// Create an infinite sphere around scene and allow any pigment on it
sky_sphere{ pigment { gradient <0,1,0>
                      color_map { [0.00 rgb <0.6,0.7,1.0>]
                                  [0.35 rgb <0.0,0.1,0.8>]
                                  [0.65 rgb <0.0,0.1,0.8>]
                                  [1.00 rgb <0.6,0.7,1.0>]
                                }
                      scale 2
                    } // end of pigment
          } //end of skysphere -------------------------------------


#declare X0 = 0;
#declare Z0 = 0;
#declare A = 5;
#declare a = 0.5;
#declare b = 0;
#declare c = 0.5;

sphere {<0, 0, 0> 0.25 texture {pigment {Yellow} finish {specular 0.6}} }

cylinder {<0, 0, 0>, <10, 0, 0> 0.1 pigment {Red} } // x axis
cylinder {<0, 0, 0>, <0, 10, 0> 0.1 pigment {Green} } // y axis
cylinder {<0, 0, 0>, <0, 0, 10> 0.1 pigment {Blue} } // z axis

#declare Gaussian = function {y - A * exp(   -( a*pow((x-X0),2) -
2*b*(x-X0)*(z-Z0) + c*pow((z-Z0),2) )   ) }

isosurface{ //------------------------- "sombrero"
  function {Gaussian (x, y, z)}
  max_gradient 10    // <=== adjust this if there is a notification in the
message window after rendering!
 open
  threshold 0
  contained_by{box{<-10, -0.1, -10>, <10, 5, 10>}}  // make sure your
contained_by box is the right size

          texture{ pigment{ spiral1 5 rotate<90,0,0>
                            color_map{
                                [ 0.0 color rgb<1,1,1> ]
                                [ 0.5 color rgb<1,1,1> ]
                                [ 0.5 color rgb<1,0,0> ]
                                [ 1.0 color rgb<1,0,0> ]
                               } // end color_map
                             scale 0.5
                           } // end pigment
                 //normal  { bumps 0.5 scale  0.005 }
                   finish  { phong 1 reflection 0.00 }
                 } // end of texture ------------------



  scale <1, 1, 1>
  rotate <0,0,0>
  translate <0, -A, 0>
} // end of isosurface ----------------

box{<-10, -0.1, -10>, <10, 5, 10> pigment {rgbt <1, 1, 1, 0.9>} translate <0,
-A, 0>}


Post a reply to this message

From: Martin
Subject: Re: plotting a 3D gaussian question
Date: 27 Oct 2016 13:50:01
Message: <web.58123e18a0290900dd4282660@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> This ought to do it:
>
>
> #version 3.7;
>
> // 3D Gussian isosurface with peak at origin
> // October 2016, Bald Eagle
>
> #include "colors.inc"
> #include "debug.inc"
>
> global_settings {
>   assumed_gamma 1.0
> }
>
> camera {
>    location  <5, 10, -30.0>
>    look_at   <0, 0,  0.0>
>  right    x*image_width/image_height
> }
>
> light_source { < 10, 20, -50>  color White}
>
> // Create an infinite sphere around scene and allow any pigment on it
> sky_sphere{ pigment { gradient <0,1,0>
>                       color_map { [0.00 rgb <0.6,0.7,1.0>]
>                                   [0.35 rgb <0.0,0.1,0.8>]
>                                   [0.65 rgb <0.0,0.1,0.8>]
>                                   [1.00 rgb <0.6,0.7,1.0>]
>                                 }
>                       scale 2
>                     } // end of pigment
>           } //end of skysphere -------------------------------------
>
>
> #declare X0 = 0;
> #declare Z0 = 0;
> #declare A = 5;
> #declare a = 0.5;
> #declare b = 0;
> #declare c = 0.5;
>
> sphere {<0, 0, 0> 0.25 texture {pigment {Yellow} finish {specular 0.6}} }
>
> cylinder {<0, 0, 0>, <10, 0, 0> 0.1 pigment {Red} } // x axis
> cylinder {<0, 0, 0>, <0, 10, 0> 0.1 pigment {Green} } // y axis
> cylinder {<0, 0, 0>, <0, 0, 10> 0.1 pigment {Blue} } // z axis
>
> #declare Gaussian = function {y - A * exp(   -( a*pow((x-X0),2) -
> 2*b*(x-X0)*(z-Z0) + c*pow((z-Z0),2) )   ) }
>
> isosurface{ //------------------------- "sombrero"
>   function {Gaussian (x, y, z)}
>   max_gradient 10    // <=== adjust this if there is a notification in the
> message window after rendering!
>  open
>   threshold 0
>   contained_by{box{<-10, -0.1, -10>, <10, 5, 10>}}  // make sure your
> contained_by box is the right size
>
>           texture{ pigment{ spiral1 5 rotate<90,0,0>
>                             color_map{
>                                 [ 0.0 color rgb<1,1,1> ]
>                                 [ 0.5 color rgb<1,1,1> ]
>                                 [ 0.5 color rgb<1,0,0> ]
>                                 [ 1.0 color rgb<1,0,0> ]
>                                } // end color_map
>                              scale 0.5
>                            } // end pigment
>                  //normal  { bumps 0.5 scale  0.005 }
>                    finish  { phong 1 reflection 0.00 }
>                  } // end of texture ------------------
>
>
>
>   scale <1, 1, 1>
>   rotate <0,0,0>
>   translate <0, -A, 0>
> } // end of isosurface ----------------
>
> box{<-10, -0.1, -10>, <10, 5, 10> pigment {rgbt <1, 1, 1, 0.9>} translate <0,
> -A, 0>}

Thanks a lot! This worked like a charm. I just have one more problem, now my
green balls are disappearing behind my gaussian function, if I make it too
transparent then I wont see the Gaussian. Is there a possibility to make the
green balls "inside" the gaussian much stronger so they are able to be seen
through the gaussian ?

http://www.directupload.net/file/d/4521/t8e5wc5t_png.htm


Post a reply to this message

From: Bald Eagle
Subject: Re: plotting a 3D gaussian question
Date: 27 Oct 2016 14:05:01
Message: <web.581241b5a0290900b488d9aa0@news.povray.org>
"Martin" <mar### [at] t-onlinede> wrote:

> Thanks a lot! This worked like a charm. I just have one more problem, now my
> green balls are disappearing behind my gaussian function, if I make it too
> transparent then I wont see the Gaussian. Is there a possibility to make the
> green balls "inside" the gaussian much stronger so they are able to be seen
> through the gaussian ?
>
> http://www.directupload.net/file/d/4521/t8e5wc5t_png.htm

Just add a transparent or filter term to the color map entries of the Gaussian,

          texture{ pigment{ spiral1 5 rotate<90,0,0>
                             color_map{
                                 [ 0.0 color rgbt<1,1,1,0.9> ]
                                 [ 0.5 color rgbt<1,1,1,0.9> ]
                                 [ 0.5 color rgbt<1,0,0,0.9> ]
                                [ 1.0 color rgbt<1,0,0,0.9> ]
                                } // end color_map

or just give it a simple transparent coloration like the box at the end of the
file
pigment {rgbt <1, 1, 1, 0.9>}


Post a reply to this message

From: Jim Holsenback
Subject: Re: plotting a 3D gaussian question
Date: 27 Oct 2016 15:14:13
Message: <58125205$1@news.povray.org>
On 10/27/2016 1:49 PM, Martin wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>> This ought to do it:
>>
>>
>> #version 3.7;
>>
>> // 3D Gussian isosurface with peak at origin
>> // October 2016, Bald Eagle
>>
>> #include "colors.inc"
>> #include "debug.inc"
>>
>> global_settings {
>>   assumed_gamma 1.0
>> }
>>
>> camera {
>>    location  <5, 10, -30.0>
>>    look_at   <0, 0,  0.0>
>>  right    x*image_width/image_height
>> }
>>
>> light_source { < 10, 20, -50>  color White}
>>
>> // Create an infinite sphere around scene and allow any pigment on it
>> sky_sphere{ pigment { gradient <0,1,0>
>>                       color_map { [0.00 rgb <0.6,0.7,1.0>]
>>                                   [0.35 rgb <0.0,0.1,0.8>]
>>                                   [0.65 rgb <0.0,0.1,0.8>]
>>                                   [1.00 rgb <0.6,0.7,1.0>]
>>                                 }
>>                       scale 2
>>                     } // end of pigment
>>           } //end of skysphere -------------------------------------
>>
>>
>> #declare X0 = 0;
>> #declare Z0 = 0;
>> #declare A = 5;
>> #declare a = 0.5;
>> #declare b = 0;
>> #declare c = 0.5;
>>
>> sphere {<0, 0, 0> 0.25 texture {pigment {Yellow} finish {specular 0.6}} }
>>
>> cylinder {<0, 0, 0>, <10, 0, 0> 0.1 pigment {Red} } // x axis
>> cylinder {<0, 0, 0>, <0, 10, 0> 0.1 pigment {Green} } // y axis
>> cylinder {<0, 0, 0>, <0, 0, 10> 0.1 pigment {Blue} } // z axis
>>
>> #declare Gaussian = function {y - A * exp(   -( a*pow((x-X0),2) -
>> 2*b*(x-X0)*(z-Z0) + c*pow((z-Z0),2) )   ) }
>>
>> isosurface{ //------------------------- "sombrero"
>>   function {Gaussian (x, y, z)}
>>   max_gradient 10    // <=== adjust this if there is a notification in the
>> message window after rendering!
>>  open
>>   threshold 0
>>   contained_by{box{<-10, -0.1, -10>, <10, 5, 10>}}  // make sure your
>> contained_by box is the right size
>>
>>           texture{ pigment{ spiral1 5 rotate<90,0,0>
>>                             color_map{
>>                                 [ 0.0 color rgb<1,1,1> ]
>>                                 [ 0.5 color rgb<1,1,1> ]
>>                                 [ 0.5 color rgb<1,0,0> ]
>>                                 [ 1.0 color rgb<1,0,0> ]
>>                                } // end color_map
>>                              scale 0.5
>>                            } // end pigment
>>                  //normal  { bumps 0.5 scale  0.005 }
>>                    finish  { phong 1 reflection 0.00 }
>>                  } // end of texture ------------------
>>
>>
>>
>>   scale <1, 1, 1>
>>   rotate <0,0,0>
>>   translate <0, -A, 0>
>> } // end of isosurface ----------------
>>
>> box{<-10, -0.1, -10>, <10, 5, 10> pigment {rgbt <1, 1, 1, 0.9>} translate <0,
>> -A, 0>}
>
> Thanks a lot! This worked like a charm. I just have one more problem, now my
> green balls are disappearing behind my gaussian function, if I make it too
> transparent then I wont see the Gaussian. Is there a possibility to make the
> green balls "inside" the gaussian much stronger so they are able to be seen
> through the gaussian ?
>
> http://www.directupload.net/file/d/4521/t8e5wc5t_png.htm

shame on you ... ah well shame on me for clicking. this brought up one 
of those virus alert page pages and wouldn't let me close it out. went 
straight for the restart button and did a scan that came up with nothing 
on my machine. if i weren't so embarrassed i'd be pissed!


Post a reply to this message

From: Alain
Subject: Re: plotting a 3D gaussian question
Date: 27 Oct 2016 19:41:47
Message: <581290bb$1@news.povray.org>

> "Bald Eagle" <cre### [at] netscapenet> wrote:
>> This ought to do it:
>>
>>
>> #version 3.7;
>>
>> // 3D Gussian isosurface with peak at origin
>> // October 2016, Bald Eagle
>>
>> #include "colors.inc"
>> #include "debug.inc"
>>
>> global_settings {
>>   assumed_gamma 1.0
>> }
>>
>> camera {
>>    location  <5, 10, -30.0>
>>    look_at   <0, 0,  0.0>
>>  right    x*image_width/image_height
>> }
>>
>> light_source { < 10, 20, -50>  color White}
>>
>> // Create an infinite sphere around scene and allow any pigment on it
>> sky_sphere{ pigment { gradient <0,1,0>
>>                       color_map { [0.00 rgb <0.6,0.7,1.0>]
>>                                   [0.35 rgb <0.0,0.1,0.8>]
>>                                   [0.65 rgb <0.0,0.1,0.8>]
>>                                   [1.00 rgb <0.6,0.7,1.0>]
>>                                 }
>>                       scale 2
>>                     } // end of pigment
>>           } //end of skysphere -------------------------------------
>>
>>
>> #declare X0 = 0;
>> #declare Z0 = 0;
>> #declare A = 5;
>> #declare a = 0.5;
>> #declare b = 0;
>> #declare c = 0.5;
>>
>> sphere {<0, 0, 0> 0.25 texture {pigment {Yellow} finish {specular 0.6}} }
>>
>> cylinder {<0, 0, 0>, <10, 0, 0> 0.1 pigment {Red} } // x axis
>> cylinder {<0, 0, 0>, <0, 10, 0> 0.1 pigment {Green} } // y axis
>> cylinder {<0, 0, 0>, <0, 0, 10> 0.1 pigment {Blue} } // z axis
>>
>> #declare Gaussian = function {y - A * exp(   -( a*pow((x-X0),2) -
>> 2*b*(x-X0)*(z-Z0) + c*pow((z-Z0),2) )   ) }
>>
>> isosurface{ //------------------------- "sombrero"
>>   function {Gaussian (x, y, z)}
>>   max_gradient 10    // <=== adjust this if there is a notification in the
>> message window after rendering!
>>  open
>>   threshold 0
>>   contained_by{box{<-10, -0.1, -10>, <10, 5, 10>}}  // make sure your
>> contained_by box is the right size
>>
>>           texture{ pigment{ spiral1 5 rotate<90,0,0>
>>                             color_map{
>>                                 [ 0.0 color rgb<1,1,1> ]
>>                                 [ 0.5 color rgb<1,1,1> ]
>>                                 [ 0.5 color rgb<1,0,0> ]
>>                                 [ 1.0 color rgb<1,0,0> ]
>>                                } // end color_map
>>                              scale 0.5
>>                            } // end pigment
>>                  //normal  { bumps 0.5 scale  0.005 }
>>                    finish  { phong 1 reflection 0.00 }
>>                  } // end of texture ------------------
>>
>>
>>
>>   scale <1, 1, 1>
>>   rotate <0,0,0>
>>   translate <0, -A, 0>
>> } // end of isosurface ----------------
>>
>> box{<-10, -0.1, -10>, <10, 5, 10> pigment {rgbt <1, 1, 1, 0.9>} translate <0,
>> -A, 0>}
>
> Thanks a lot! This worked like a charm. I just have one more problem, now my
> green balls are disappearing behind my gaussian function, if I make it too
> transparent then I wont see the Gaussian. Is there a possibility to make the
> green balls "inside" the gaussian much stronger so they are able to be seen
> through the gaussian ?
>

Replace the rgb keyword by rgbf or rgbt and add a fourth value to the 
colours : rgbf<1,1,1,0.5> or rgbt<1,1,1,0.5>
Play around with the fourth value untill you get a result that you like.
You can also use this form : rgbft<1,1,1,0.3,0.2>
If you use a transmit value of 1, your pigment become totally 
transparent with no hint of colouration. A filter of 1 will always stay 
visible, but rgbf<0,0,0,1> will show an opaque black.

If you get black, or to dark areas, add max_trace_level 10 (or a larger 
value) to your global_settings block.


Post a reply to this message

From: clipka
Subject: Re: plotting a 3D gaussian question
Date: 27 Oct 2016 21:12:26
Message: <5812a5fa$1@news.povray.org>
Am 27.10.2016 um 21:14 schrieb Jim Holsenback:

>> http://www.directupload.net/file/d/4521/t8e5wc5t_png.htm
> 
> shame on you ... ah well shame on me for clicking. this brought up one
> of those virus alert page pages and wouldn't let me close it out. went
> straight for the restart button and did a scan that came up with nothing
> on my machine. if i weren't so embarrassed i'd be pissed!

And shame on you for not giving the user the benefit of doubt, maybe?

I was greeted by some technically aggressive ads there, but nothing
really out of the ordinary. My guess would be that you just happened to
get a slightly more obtrusive version of the run-of-the-mill scareware
ad, presumably popped up by directupload.net, not the user.

So shame on directupload.net for partnering with pretty obtrusive
advertisers, but as far as I can tell that's all.


Post a reply to this message

From: clipka
Subject: Re: plotting a 3D gaussian question
Date: 27 Oct 2016 21:29:00
Message: <5812a9dc@news.povray.org>
Am 27.10.2016 um 17:07 schrieb Martin:

> i am new to povray and want to use it for scientific images. I want to plot a
> semitransparent 3D gaussian function into my image: (at the spot of the green
> balls)

For posts with accompanying files, we highly recommend to use one of the
povray.binaries.* newsgroups and the official file attachment feature
provided there, rather than resorting to potentially shady 3rd party
file upload sites, so that readers can enjoy the posts without being
pestered by any ads whatsoever.

If the accompanying file is an image, povray.binaries.images is the most
suitable place.


Post a reply to this message

From: Alain
Subject: Re: plotting a 3D gaussian question
Date: 28 Oct 2016 21:29:30
Message: <5813fb7a$1@news.povray.org>


>> http://www.directupload.net/file/d/4521/t8e5wc5t_png.htm
>
> shame on you ... ah well shame on me for clicking. this brought up one
> of those virus alert page pages and wouldn't let me close it out. went
> straight for the restart button and did a scan that came up with nothing
> on my machine. if i weren't so embarrassed i'd be pissed!
>
You obviously don't use an ad blocker. Just went and did not see 
anything obstrusive at all :) Just a clean, ad free page.
Try AdBlock plus on Firefox or Chrome. It also exist for Internet 
explorer and probably Opera and others.


Alain


Post a reply to this message

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