POV-Ray : Newsgroups : povray.newusers : normals and pigments in a csg : Re: normals and pigments in a csg Server Time
6 Sep 2024 04:18:48 EDT (-0400)
  Re: normals and pigments in a csg  
From: Chris Colefax
Date: 20 Jul 1999 20:26:41
Message: <379513c1@news.povray.org>
Daniel Pirch wrote:
> But if the objects are part of other transplated CSGs?
>
> #declare spheres = union{
>   sphere{ -2*x, 1 pigment{ rgb<1,0,0>}}
>   sphere{0, 1 pigment{rgb <0,1,0>}}
>   sphere{ 2*x,1 pigment{ rgb<0,0,1>}}
> }
> union{
>   object{spheres translate 2*z}
>   object{spheres}
>   object{spheres translate -2*z}
>   normal{Norm}
> }

What you wish to do is not possible because specifying a
pigment/normal/finish for an object is actually shorthand for specifying an
entire texture.  In the examples you give above, the pigment statements
apply the default texture to each sphere, with the pigment changed as
desired.  Similarly, the normal applied to the union is shorthand for the
default texture with a changed normal.  CSG textures are only applied to
those child objects that don't have textures specified - and all the spheres
now do, thanks to the pigments.

One possible solution is to predeclare the normal, and apply it to each
object with the pigment.  Or, you can take advantage of the default texture
I mentioned above, by specifying the changed normal *before* declaring the
spheres, eg:

   default {normal {bumps .5}}

This saves typing because you don't need to add it to each object.
Unfortunately, neither method will allow you to transform copies of the
declared object without transforming the texture.  For this, you need to
transform the object, and then apply the texture - perhaps you could use a
macro that creates and places the objects prior to texturing?


Post a reply to this message

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