POV-Ray : Newsgroups : povray.advanced-users : L*C*h(uv) color solid : Re: L*C*h(uv) color solid Server Time
23 Apr 2024 06:01:43 EDT (-0400)
  Re: L*C*h(uv) color solid  
From: clipka
Date: 24 Nov 2016 14:33:30
Message: <5837408a$1@news.povray.org>
Am 24.11.2016 um 20:10 schrieb Mike Horvath:

> Next issue: What is the best way to create an accurate pigment to paint
> the isosurface?

The main problem to solve is that POV-Ray's mechanisms to generate
gradient-ish pigments only supports 1-dimensional gradients.

A common solution is to construct three 1-dimensional gradient-ish
pigments -- one for each colour component -- and then mix them together
using the `average` pseudo-pattern:

    #declare FinalPigment = pigment {
      average
      pigment_map {
        [ 1.0 RedPigment   ]
        [ 1.0 GreenPigment ]
        [ 1.0 BluePigment  ]
      }
    }

Each of the `RedPigment`, `GreenPigment` and `BluePigment` component
patterns is designed in such a way that it only has the corresponding
component set to non-zero.

An important thing to note here is that the `average` pseudo-pattern
does not add colours, but averages them; so in order to achieve the full
range of colours, the component patterns must have colour ranges from 0
to 3 for the corresponding channel:

    #declare RedPigment = pigment {
      function { fR(fL(x,y,z),fc(x,y,z),fh(x,y,z), }
      colour_map {
        [ 0.0 colour rgb <0,0,0> ]
        [ 1.0 colour rgb <3,0,0> ]
      }
    }

Note that there is no need for clipping the function result: This is
automatically achieved by the colour_map.


Post a reply to this message

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