POV-Ray : Newsgroups : povray.news-submissions : change color of the input sphere Server Time
28 Mar 2024 07:41:53 EDT (-0400)
  change color of the input sphere (Message 1 to 2 of 2)  
From: yinfunglo5063
Subject: change color of the input sphere
Date: 8 Nov 2013 19:10:00
Message: <web.527d7d4a1bbd2f6fe661c9d70@news.povray.org>
He everyone,

I am a new user on povray. Recently I try to draw some atomic structure by
importing two file externally, labeling each atomic position. However, since I
am working on some multi-component system, I would like to color each type of
sphere by different color, in which the color of the sphere depend on the radius
of the species.( eg. I have 3 type of sphere, in total there are 2000 of them)
How can I achieve this?

Thanks so much!!!!


Post a reply to this message

From: Stephen
Subject: Re: change color of the input sphere
Date: 9 Nov 2013 07:04:18
Message: <527e24c2$1@news.povray.org>
On 09/11/2013 12:09 AM, yinfunglo5063 wrote:
> He everyone,
>
> I am a new user on povray.
...
> How can I achieve this?
>
> Thanks so much!!!!
>
>

Hi yinfunglo5063 and welcome.

You have posted in the wrong newsgroup and your question will probably 
not be seen by those who could help you. Try povray.newusers

There are several ways of doing what you want. If you use a variable for 
the radius, try using the #switch directive:

#declare Rad_Val = 10.00 ; // Your radius variable

sphere {
0.0, Rad_Val

texture{

#switch (Rad_Val)
         #case( 10 )
                 _texture_1
               #break
         #case( 15  )
                 _texture_2
               #break
          #case( 20 )
                 _texture_3
               #break
          #else
                 _texture_0
                 #break
#end
           }
}

Where _texture_0 to _texture_4 have been declared earlier.



-- 
Regards
     Stephen


Post a reply to this message

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