POV-Ray : Newsgroups : povray.general : Random colors or textures on mesh triangles? Server Time
6 Aug 2024 02:22:05 EDT (-0400)
  Random colors or textures on mesh triangles? (Message 1 to 3 of 3)  
From: Glen Berry
Subject: Random colors or textures on mesh triangles?
Date: 5 Jul 2002 13:39:47
Message: <eNglPZHxUJU++7jXESWFJ=KRzx6A@4ax.com>
Using POV 3.5, is it possible to randomly color each triangle in a
mesh? I thought I had done this in earlier versions of POV, but can't
seem to get it to work now.

Ideally, I'd want each triangle's RGB color values to be selected from
the full RGB gamut, and not to be selected from a list of sample
colors or textures.

Can it be done? What syntax do I use?

thanks,
Glen


Later,
Glen

7no### [at] ezwvcom     (Remove the numeral "7")


Post a reply to this message

From:
Subject: Re: Random colors or textures on mesh triangles?
Date: 5 Jul 2002 13:58:07
Message: <sbnbiu8ntemmbfeqc5lgblrhk7ruf03cld@4ax.com>
On Fri, 05 Jul 2002 13:38:49 -0400, Glen Berry <7no### [at] ezwvcom> wrote:
> Using POV 3.5, is it possible to randomly color each triangle in a
> mesh? I thought I had done this in earlier versions of POV, but can't
> seem to get it to work now.

Take a look in documentation for all keywords started from 'triangle'. The
second one should be 'triangle texture interpolation'. Is it what you are
looking for ?

ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: Random colors or textures on mesh triangles?
Date: 5 Jul 2002 18:23:22
Message: <chrishuff-7830FA.17204805072002@netplex.aussie.org>
In article <eNglPZHxUJU++7jXESWFJ=KRzx6A@4ax.com>,
 Glen Berry <7no### [at] ezwvcom> wrote:

> Using POV 3.5, is it possible to randomly color each triangle in a
> mesh? I thought I had done this in earlier versions of POV, but can't
> seem to get it to work now.
> 
> Ideally, I'd want each triangle's RGB color values to be selected from
> the full RGB gamut, and not to be selected from a list of sample
> colors or textures.

Making each triangle a random solid color? Just generate a unique 
texture for each triangle. The only restriction is that you have to 
declare the texture before you can use it in the mesh triangle. 
Something like this should work:

#declare RS = seed(328947);

#macro RColorTri(ptA, ptB, ptC)
    #local triTex =
    texture {pigment {color rgb < rand(RS), rand(RS), rand(RS)>}}
    
    triangle {ptA, ptB, ptC texture {triTex}}
#end

Actually, this should probably work:
#macro RColorTri()
    #local triTex =
    texture {pigment {color rgb < rand(RS), rand(RS), rand(RS)>}}
    
    triTex
#end

mesh {
    triangle {ptA, ptB, ptC texture {RColorTri()}}
}

This will increase memory usage quite a bit though...if you used a list 
of textures instead of having a separate texture for every triangle, it 
would cut this down. You might also use the color macros in colors.inc 
to make only the hue random, making all the random colors of the same 
saturation and brightness.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

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