POV-Ray : Newsgroups : povray.general : Coloring spheres based on their specified size : Re: Coloring spheres based on their specified size Server Time
29 May 2024 04:26:18 EDT (-0400)
  Re: Coloring spheres based on their specified size  
From: ingo
Date: 1 May 2024 12:00:00
Message: <web.663265fcd66fa1317bac71e8ffb8ce3@news.povray.org>
"esfoster" <nomail@nomail> wrote:

> I want to add a color to them based on their size. e.g larger particles green
> and smaller particles blue and there would be a gradient assigned to fill the
> particles in between.

divide the radius of every sphere by that of the largest sphere, that gives a
value between 1 and very small. The range depends on the sphere variation. Use
the value you get as an index to pick a colour, as jr suggest from a spline.

or use one of the interpolation (lerp) macro's to find an index between 1 and
zero from the radii.

ingo


Post a reply to this message

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