POV-Ray : Newsgroups : povray.general : Help filling in radial gradient colors Server Time
25 Nov 2024 19:39:47 EST (-0500)
  Help filling in radial gradient colors (Message 1 to 5 of 5)  
From: Nicolas
Subject: Help filling in radial gradient colors
Date: 14 May 2013 15:25:00
Message: <web.51928ef4b3d76fcadd09a49f0@news.povray.org>
I have a shape that is a sideways extrusion of a hemisphere, and I want to fill
it in such that it goes blue-red-blue radially outward, looking like colorful
fog (media) is filling the shape. I've tried using the spherical density/color
map, but the colors overlap each other so that the blue-red-blue just ends up
looking like purple. I've resorted to using just solid colors, but am not happy
with the result. In my code I'm referring to the "sensitive slice." If you could
help me make this shape I'd much appreciate it, it's for a paper on magnetic
resonance force microscopy.

#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "golds.inc"
#include "transforms.inc"
#include "shapes.inc"
#include  "finish.inc"

//---------------------------------------------

// Photons //

global_settings {
max_trace_level 10
}

//------------------------------------------

light_source {
   <0,2,-30>
   //<100,8,-15>
   color 1.6*White
   spotlight
    radius 50
    falloff 20
    tightness 1
    point_at <0,2,0>
  //  shadowless

   media_interaction off
   media_attenuation off
   photons { reflection off refraction off }
}


light_source {
   <20,3,0>
   color 1*White
   spotlight
    radius 50
    falloff 20
    tightness 1
    point_at <0,3,0>
    shadowless
   media_interaction off
   media_attenuation off
   photons { reflection off refraction off }
}


camera {

   location<1,1,-2.2>
   look_at <0,0,0>

}

//--------------------------------

background { rgb < 0, 0, 0 > }


//--------------------------------------------------
// Coil//

#declare coil_y=-2;
#declare n=3.5;
#declare R=5;
#declare dL=(2/3)*R;
#declare r=R/10;

#declare begin=1;
#declare x1=(0.25-n/2)*dL;
#while(x1<=(n/2-0.25)*dL)
 #declare theta=2*pi*(x1/dL+n/2);
 #declare p2=<x1,R*sin(theta),-R*cos(theta)>;
 sphere{p2,r texture{Chrome_Metal} rotate <0,90,180> translate <-1,coil_y,11.5>
photons { collect off }}
 #declare begin=0;
 #declare p1=p2;
 #declare x1=x1+0.005*dL;
#end

//--------------------------------------------------
//Resonant Slice


#declare NumberOfSteps=10;
#declare StepNumber=0;
#declare r=1;
#declare oscillationamplitude=0.5;
#declare separation=oscillationamplitude/NumberOfSteps;

#while(StepNumber<NumberOfSteps)
  #declare xcoordinate= StepNumber*separation;

   difference{isosurface{function { sqrt(pow(x-xcoordinate,2) + pow(y,2) +
pow(z,2)) - r} contained_by { box { <-20,-20,-20>,<20, .001,20> }}
                         texture{pigment{color red
abs(sin(pi*StepNumber/NumberOfSteps)) green 0 blue
abs(cos(pi*StepNumber/NumberOfSteps))}
                                 normal { bumps 0.01 scale 0.1 }
                                 finish { phong 1 } }}
                         sphere{<xcoordinate,0,0>,r-separation
                         }
             }
   sphere{<xcoordinate,0,0>,r-separation clipped_by{plane{y,0}}
           texture{pigment{color red abs(sin(pi*StepNumber/NumberOfSteps)) green
0 blue abs(cos(pi*StepNumber/NumberOfSteps))}
                   normal { bumps 0.1 scale 0.1 }
                   finish { phong 1 } }}

   isosurface{function { sqrt(pow(x-xcoordinate,2) + pow(y,2) + pow(z,2)) -
(r+separation/5)}  clipped_by{plane{y,0}}
                         texture{pigment{color red 0 green 0 blue 1}
                                 normal { bumps 0.01 scale 0.1 }
                                 finish { phong 1 } }}



  #declare StepNumber=StepNumber+1;
#end






//-------------------------------------------------------
 //Substrate //

  box{ <-6, -2, -6>, <7, -0.001, 3>
        material{
   texture{ T_Glass3

   finish {
    ambient .6
    diffuse .5
     reflection {0.1}
        }
     }
     }
   interior { //I_Glass
      ior 1

    }
         photons { collect off }
        }

   light_source{
      <-5,-1,-2>
      color 2*White
      shadowless
      media_interaction off
   media_attenuation off
   photons { reflection off refraction off }
     }


Post a reply to this message

From: Kenneth
Subject: Re: Help filling in radial gradient colors
Date: 15 May 2013 03:00:01
Message: <web.51933182aceea820c2d977c20@news.povray.org>
"Nicolas" <nomail@nomail> wrote:
> I have a shape that is a sideways extrusion of a hemisphere, and I want to fill
> it in such that it goes blue-red-blue radially outward, looking like colorful
> fog (media) is filling the shape. I've tried using the spherical density/color
> map, but the colors overlap each other so that the blue-red-blue just ends up
> looking like purple. I've resorted to using just solid colors, but am not happy
> with the result. In my code I'm referring to the "sensitive slice." If you could
> help me make this shape I'd much appreciate it, it's for a paper on magnetic
> resonance force microscopy.

Playing around with your code and rendering it, it's difficult to understand
what the color result is that your looking for. I assume that you don't really
want 'individual infinitely-thin shells' representing the colors. Are the many
nested isosurfaces just an expedient way of making those shells (that is, rather
than filling *one* overall shape with, say, media?) And do you want the sliced
surface of the hemisphere to appear 'solid'?

Sorry if this seems like a lot of questions; I'm just trying to get an idea of
how to simplify you example, to reduce it to a single problem. (I commented out
some extraneous stuff--the coils and the 'substrate' box--but I'm still not
clear about what the end result should be.)

Your original media idea would seem to be the way to go (*if* you want a
translucent look to the color changes.) But media, by nature, is also going to
produce the (unwanted} color blending--red/blue to purple, as seen by the
camera. Unless you use much more opague media, like the scattering type (with
extinction.)

BTW, each isosurface block in your #while loop, when rendered as an individual
10-unit 'group,' looks dark (either by design or not.) When all the elements are
rendered together, it's kind of a hodge-podge, visually. Perhaps you could
re-post a trimmed down version of the code?


Post a reply to this message

From: Nicolas
Subject: Re: Help filling in radial gradient colors
Date: 15 May 2013 10:45:00
Message: <web.51939e3eaceea820dd09a49f0@news.povray.org>
Thanks a lot for your quick reply Kenneth.

The color result I want is the shape to be glowing blue on the outside, like a
fluorescent neon sign like this:
http://www.perma-laboratories.com/Neon_Signs__LED_Signs__Backlite_Signs__Neon_Clock.jpg

I would like to be able to see that it gradually gets more red as you move
towards the center of the "sensitive volume," which as you said will probably
look purple, and that's fine (I think the eye will be able to understand that
there's red inside even though it looks purple).
On the top I want the color profile to be obvious though, blue-red-blue, even
though there will again be some inevitable purple-ing.
I want it all to have a BRIGHT, beautiful glow.

Thanks again, and let me know if you have some ideas.


Post a reply to this message

From: waggy
Subject: Re: Help filling in radial gradient colors
Date: 15 May 2013 13:10:01
Message: <web.5193bff8aceea82021be1230@news.povray.org>
Something like this? (You'll need to make the substrate box hollow.) You may
want to make the other objects darker so a brighter glow can be seen against
them.

intersection{
  plane{y,0}
  sphere{<0,0,0>,1}
  interior{
    media{
    emission 1
    density{ spherical triangle_wave
      density_map{
        [0.0 rgb<0.0, 0, 1.0>]
        [0.9 rgb<0.3, 0, 0.8>]
        [1.0 rgb<1.0, 0, 0.0>]
      } }
    }//end emission media
    media{
    absorption 1
    density{ spherical //poly_wave 0.5
      density_map{
        [0.0,rgb<0.0, 0, 0.2>]
        [0.0,rgb<1.0, 0, 0.0>]}
      }
    }//end absorption media
  }//end interior
  texture{ pigment{color rgbt<1,1,1,1>} }
hollow
}//end intersection

Hope this helps
~waggy


Post a reply to this message

From: Nicolas
Subject: Re: Help filling in radial gradient colors
Date: 15 May 2013 14:15:00
Message: <web.5193d073aceea820dd09a49f0@news.povray.org>
Wow, the colors are EXACTLY what I was hoping for!

Now I just need to work on making it look good in the sample, thank you very
much!


Post a reply to this message

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