POV-Ray : Newsgroups : povray.advanced-users : Question about Material and documentation : Re: Question about Material and documentation Server Time
16 Apr 2024 17:51:56 EDT (-0400)
  Re: Question about Material and documentation  
From: Kenneth
Date: 15 May 2017 10:05:00
Message: <web.5919b4b8ce4acd17883fb31c0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

>
> "If the object already has a texture, then the material texture is layered over
> it."
>

It's always been my understanding that, once an object already has a texture,
that texture can't be replaced or overlayed later with an additional one. I
think the docs are in error.

My own simple code experiment...

#declare MY_MATERIAL =
    material{texture{pigment{rgb 1} finish{emission .2 diffuse .4 phong 1}}}

union{ // to group *all* of the scene objects together
sphere{0,1
    texture{
        pigment{rgb <1,.5,.5>}
        finish{emission .2 diffuse .8}
        }
       translate 1.5*x
       }

sphere{0,1
    texture{
        pigment{rgb <.5,1,.5>}
        finish{emission .2 diffuse .8}
        }
       translate -1.5*x
       }
       material{MY_MATERIAL} // to try and replace or overlay the
                             // previous textures.
       } // end of union

This doesn't work. (However, commenting-out one of the object's textures shows
that the added 'material' does replace it.)

In past newsgroup posts, I've read that the only way to do this kind of thing is
to pre-write the scene with the added texture or material already in mind--
i.e., to pre-plan for it. One example might be to create a #default texture (in
your case, a pigment with a black-to-white color map), then add #if blocks to
*all* the scene's textures. Then just switch between textures. Not very elegant,
I admit! (BTW, adding this type of feature to POV-Ray has been discussed in the
newsgroups, from time to time, if memory serves me correctly-- and possibly
other workarounds as well.)

Strangely, I have a dim memory of making your original material question
actually work, to a degree (this was years ago)-- although it was some kind of
special arrangement of objects or unions or *something.* Sadly, I can't recall
which old scene I did that in, or how.


Post a reply to this message

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