POV-Ray : Newsgroups : povray.newusers : color_map Server Time
2 Jun 2024 15:08:09 EDT (-0400)
  color_map (Message 11 to 15 of 15)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: ltong
Subject: Re: color_map
Date: 28 Aug 2012 01:35:07
Message: <web.503c57dff6ca84721cd19dea0@news.povray.org>
ok, after some experimentation, the result looks much better. seems value_n is
defined as 1-min(1,Fn). Don't know how to attach a pic here, below follows the
code.

   #declare FALLOFF  = 1.3; // just an example, toy with it
   #declare a = 0.7;
   #declare b = 0;
   #declare c = 0.44;
   #declare FnRadial = function(r) {a*exp(-(r-b)*(r-b)/2/c/c)}
   #declare FnAxial  = function(z) {1/(1+(FALLOFF*z*FALLOFF*z))}

   // helper function to compute radius from x,y
   #declare FnR = function(x,y) { sqrt(x*x+y*y) }

   // the resulting 3D function
   #declare Fn = function(x,y,z) { FnRadial(FnR(x,y)) * FnAxial(z) }

object {gauss
  hollow
  pigment { color rgbt<1, 1, 1, 1> }
  interior {
    media {
      emission color rgb < 1.0, 0.0, 0.0>
      density{ function {Fn(x,z,y)}
               color_map {
                  [0 color rgb <0.0, 0.0, 0.0>]
                  [1.0 color rgb <1.0, 0.0, 0.0>*1.2]
                         }
             } // end density
     }//end of media
    } //end interior
   scale <1,1,1>*1.5
   translate<0,2.0,0.0>
} //end object


Post a reply to this message

From: cvanvlack
Subject: Re: color_map
Date: 12 Sep 2012 11:35:00
Message: <web.5050ab67f6ca84724538451a0@news.povray.org>
"ltong" <nomail@nomail> wrote:
> ok, after some experimentation, the result looks much better. seems value_n is
> defined as 1-min(1,Fn). Don't know how to attach a pic here, below follows the
> code.
>
>    #declare FALLOFF  = 1.3; // just an example, toy with it
>    #declare a = 0.7;
>    #declare b = 0;
>    #declare c = 0.44;
>    #declare FnRadial = function(r) {a*exp(-(r-b)*(r-b)/2/c/c)}
>    #declare FnAxial  = function(z) {1/(1+(FALLOFF*z*FALLOFF*z))}
>
>    // helper function to compute radius from x,y
>    #declare FnR = function(x,y) { sqrt(x*x+y*y) }
>
>    // the resulting 3D function
>    #declare Fn = function(x,y,z) { FnRadial(FnR(x,y)) * FnAxial(z) }
>
> object {gauss
>   hollow
>   pigment { color rgbt<1, 1, 1, 1> }
>   interior {
>     media {
>       emission color rgb < 1.0, 0.0, 0.0>
>       density{ function {Fn(x,z,y)}
>                color_map {
>                   [0 color rgb <0.0, 0.0, 0.0>]
>                   [1.0 color rgb <1.0, 0.0, 0.0>*1.2]
>                          }
>              } // end density
>      }//end of media
>     } //end interior
>    scale <1,1,1>*1.5
>    translate<0,2.0,0.0>
> } //end object

Hey, this is a great example! I have been trying to do this with Pov-Ray for a
while. I tried a direct copy and paste of this code into Pov-Ray but got (on
line "object {gauss"

---
Parse Error: Expected 'object', undeclared identifier 'gauss' found instead
---

I did a quick search for gauss and it doesn't seem to be an internal function.
Was this just a helper file or was there more to this example that I am missing?
I am relatively inexperienced...

Thanks in advance!!!!


Post a reply to this message

From: Alain
Subject: Re: color_map
Date: 12 Sep 2012 16:25:34
Message: <5050efbe$1@news.povray.org>

> "ltong" <nomail@nomail> wrote:
>> ok, after some experimentation, the result looks much better. seems value_n is
>> defined as 1-min(1,Fn). Don't know how to attach a pic here, below follows the
>> code.
>>
>>     #declare FALLOFF  = 1.3; // just an example, toy with it
>>     #declare a = 0.7;
>>     #declare b = 0;
>>     #declare c = 0.44;
>>     #declare FnRadial = function(r) {a*exp(-(r-b)*(r-b)/2/c/c)}
>>     #declare FnAxial  = function(z) {1/(1+(FALLOFF*z*FALLOFF*z))}
>>
>>     // helper function to compute radius from x,y
>>     #declare FnR = function(x,y) { sqrt(x*x+y*y) }
>>
>>     // the resulting 3D function
>>     #declare Fn = function(x,y,z) { FnRadial(FnR(x,y)) * FnAxial(z) }
>>
>> object {gauss
>>    hollow
>>    pigment { color rgbt<1, 1, 1, 1> }
>>    interior {
>>      media {
>>        emission color rgb < 1.0, 0.0, 0.0>
>>        density{ function {Fn(x,z,y)}
>>                 color_map {
>>                    [0 color rgb <0.0, 0.0, 0.0>]
>>                    [1.0 color rgb <1.0, 0.0, 0.0>*1.2]
>>                           }
>>               } // end density
>>       }//end of media
>>      } //end interior
>>     scale <1,1,1>*1.5
>>     translate<0,2.0,0.0>
>> } //end object
>
> Hey, this is a great example! I have been trying to do this with Pov-Ray for a
> while. I tried a direct copy and paste of this code into Pov-Ray but got (on
> line "object {gauss"
>
> ---
> Parse Error: Expected 'object', undeclared identifier 'gauss' found instead
> ---
>
> I did a quick search for gauss and it doesn't seem to be an internal function.
> Was this just a helper file or was there more to this example that I am missing?
> I am relatively inexperienced...
>
> Thanks in advance!!!!
>
>
>

This is a snippet from a larger scene.

Here, "gauss" is an object previously defined by the author in a 
#declare directive.
It /could/ look like:
#declare gauss= cylinder{<0,0,10><0,0,-10>,2}
Beter writing:
#declare Gauss= cylinder{<0,0,10><0,0,-10>,2}

The primitive used can be any ot the available ones, but should be built 
around the origin. In this case, it also should be longer along the Z axis.

Anyway, it's always beter to always use at least one UPER case leter in 
any user defined identifier, and leave all lower case ones for the 
reserved words.
There have been cases where scenes got broken by not following that 
guide line and used some variable that got used as key word in a later 
version.


Alain


Post a reply to this message

From: cvanvlack
Subject: Re: color_map
Date: 14 Sep 2012 10:10:00
Message: <web.50533a32f6ca84724538451a0@news.povray.org>
"ltong" <nomail@nomail> wrote:
> ok, after some experimentation, the result looks much better. seems value_n is
> defined as 1-min(1,Fn). Don't know how to attach a pic here, below follows the
> code.
>
>    #declare FALLOFF  = 1.3; // just an example, toy with it
>    #declare a = 0.7;
>    #declare b = 0;
>    #declare c = 0.44;
>    #declare FnRadial = function(r) {a*exp(-(r-b)*(r-b)/2/c/c)}
>    #declare FnAxial  = function(z) {1/(1+(FALLOFF*z*FALLOFF*z))}
>
>    // helper function to compute radius from x,y
>    #declare FnR = function(x,y) { sqrt(x*x+y*y) }
>
>    // the resulting 3D function
>    #declare Fn = function(x,y,z) { FnRadial(FnR(x,y)) * FnAxial(z) }
>
> object {gauss
>   hollow
>   pigment { color rgbt<1, 1, 1, 1> }
>   interior {
>     media {
>       emission color rgb < 1.0, 0.0, 0.0>
>       density{ function {Fn(x,z,y)}
>                color_map {
>                   [0 color rgb <0.0, 0.0, 0.0>]
>                   [1.0 color rgb <1.0, 0.0, 0.0>*1.2]
>                          }
>              } // end density
>      }//end of media
>     } //end interior
>    scale <1,1,1>*1.5
>    translate<0,2.0,0.0>
> } //end object


This is a really great example! I tried just a simple copy-paste into POV-Ray
and I keep getting the error

----
Parse Error: Expected 'object', undeclared identifier 'gauss' found instead
---
 on the "object {gauss" line. I did a quick search to see if 'gauss' was an
internal POV-Ray command but it appears that it isn't. Is this the full example?
Are there additional dependencies missing? I'm a little new at POV-Ray so please
excuse my inability to troubleshoot this for myself.

Thanks for your time!


Post a reply to this message

From: cvanvlack
Subject: Re: color_map
Date: 14 Sep 2012 10:15:01
Message: <web.50533b6af6ca84724538451a0@news.povray.org>
"cvanvlack" <nomail@nomail> wrote:
> "ltong" <nomail@nomail> wrote:
> > ok, after some experimentation, the result looks much better. seems value_n is
> > defined as 1-min(1,Fn). Don't know how to attach a pic here, below follows the
> > code.
> >
> >    #declare FALLOFF  = 1.3; // just an example, toy with it
> >    #declare a = 0.7;
> >    #declare b = 0;
> >    #declare c = 0.44;
> >    #declare FnRadial = function(r) {a*exp(-(r-b)*(r-b)/2/c/c)}
> >    #declare FnAxial  = function(z) {1/(1+(FALLOFF*z*FALLOFF*z))}
> >
> >    // helper function to compute radius from x,y
> >    #declare FnR = function(x,y) { sqrt(x*x+y*y) }
> >
> >    // the resulting 3D function
> >    #declare Fn = function(x,y,z) { FnRadial(FnR(x,y)) * FnAxial(z) }
> >
> > object {gauss
> >   hollow
> >   pigment { color rgbt<1, 1, 1, 1> }
> >   interior {
> >     media {
> >       emission color rgb < 1.0, 0.0, 0.0>
> >       density{ function {Fn(x,z,y)}
> >                color_map {
> >                   [0 color rgb <0.0, 0.0, 0.0>]
> >                   [1.0 color rgb <1.0, 0.0, 0.0>*1.2]
> >                          }
> >              } // end density
> >      }//end of media
> >     } //end interior
> >    scale <1,1,1>*1.5
> >    translate<0,2.0,0.0>
> > } //end object
>
>
> This is a really great example! I tried just a simple copy-paste into POV-Ray
> and I keep getting the error
>
> ----
> Parse Error: Expected 'object', undeclared identifier 'gauss' found instead
> ---
>  on the "object {gauss" line. I did a quick search to see if 'gauss' was an
> internal POV-Ray command but it appears that it isn't. Is this the full example?
> Are there additional dependencies missing? I'm a little new at POV-Ray so please
> excuse my inability to troubleshoot this for myself.
>
> Thanks for your time!

Sorry for the double post. Thank you for answering Alain, that worked perfectly.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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