POV-Ray : Newsgroups : povray.advanced-users : Question about Material and documentation Server Time
28 Mar 2024 05:02:10 EDT (-0400)
  Question about Material and documentation (Message 1 to 5 of 5)  
From: Bald Eagle
Subject: Question about Material and documentation
Date: 15 May 2017 08:35:01
Message: <web.5919a04cb18151ffc437ac910@news.povray.org>
The POV-Ray documentation states:

"Internally, the "material" is not attached to the object. The material is just
a container that brings the texture and interior to the object. It is the
texture and interior itself that is attached to the object. Users should still
consider texture and interior as separate items attached to the object.
The material is just a "bucket" to carry them.

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

I was looking for some way to take a full scene and replace all the texturing in
it with a black & white gradient, and thought this might be the way.

I did a simple experiment with a simple scene, and no textures were "layered
over".

Am I misreading / misinterpreting this, or just doing something wrong?

Thanks.


Post a reply to this message

From: Kenneth
Subject: Re: Question about Material and documentation
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

From: Kenneth
Subject: Re: Question about Material and documentation
Date: 15 May 2017 11:45:00
Message: <web.5919c992ce4acd17883fb31c0@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> "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.
>

Sorry, I'm completely mistaken. The 'material' container DOES work, and indeed
overlays the previous texture, like *this* example... (but it has to be added to
each object individually)...

--Change my #declared 'material' texture to this instead (so that its blue
translucent color can be seen to overlay the objects' own texture colors)--

#declare MY_MATERIAL =
material{
texture{
pigment{rgbt <.1,.1,1,.5>} // change t to see different effects
finish{emission .2 diffuse .8 phong 1}
}
}

// NO union-- an added 'material' container doesn't work at the end of a union,
// it seems...
sphere{0,1
    texture{
        pigment{rgb <1,.5,.5>}
        finish{emission .2 diffuse .8}
        }
        material{MY_MATERIAL}
        translate 1.5*x
       }

sphere{0,1
    texture{
        pigment{rgb <.5,1,.5>}
        finish{emission .2 diffuse .8}
        }
        material{MY_MATERIAL}
        translate -1.5*x
       }

(BTW, this also works if the 'material' container itself is not used, and just
its texture is #declared. OR, the 2nd texture can be added to the objects
directly, with no previous #declare.) Of course, a 'material' container is made
for combining lots of stuff, like interior etc.

This overlayed-texture effect seems to be different(?) behavior from what I
remember in v3.62 or v3.61; adding a '2nd texture' to an object *completely*
replaced the first texture, IIRC. Not so now, at least using v3.7.1 beta 7.
Unless my eyes are deceiving me!


Post a reply to this message

From: Alain
Subject: Re: Question about Material and documentation
Date: 16 May 2017 13:22:49
Message: <591b3569$1@news.povray.org>
Le 17-05-15 à 11:42, Kenneth a écrit :
> "Kenneth" <kdw### [at] gmailcom> wrote:
>> "Bald Eagle" <cre### [at] netscapenet> wrote:
>>
>>>
>>> "If the object already has a texture, then the material texture is layered
>>> over it."
This ONLY work on textures applied at the same level.
>>>
>>
>> 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.
>>
> 
> Sorry, I'm completely mistaken. The 'material' container DOES work, and indeed
> overlays the previous texture, like *this* example... (but it has to be added to
> each object individually)...
> 
> --Change my #declared 'material' texture to this instead (so that its blue
> translucent color can be seen to overlay the objects' own texture colors)--
> 
> #declare MY_MATERIAL =
> material{
> texture{
> pigment{rgbt <.1,.1,1,.5>} // change t to see different effects
> finish{emission .2 diffuse .8 phong 1}
> }
> }
> 
> // NO union-- an added 'material' container doesn't work at the end of a union,
> // it seems...
> sphere{0,1
>      texture{
>          pigment{rgb <1,.5,.5>}
>          finish{emission .2 diffuse .8}
>          }
>          material{MY_MATERIAL}
>          translate 1.5*x
>         }
> 
> sphere{0,1
>      texture{
>          pigment{rgb <.5,1,.5>}
>          finish{emission .2 diffuse .8}
>          }
>          material{MY_MATERIAL}
>          translate -1.5*x
>         }
> 
> (BTW, this also works if the 'material' container itself is not used, and just
> its texture is #declared. OR, the 2nd texture can be added to the objects
> directly, with no previous #declare.) Of course, a 'material' container is made
> for combining lots of stuff, like interior etc.
> 
> This overlayed-texture effect seems to be different(?) behavior from what I
> remember in v3.62 or v3.61; adding a '2nd texture' to an object *completely*
> replaced the first texture, IIRC. Not so now, at least using v3.7.1 beta 7.
> Unless my eyes are deceiving me!
> 
> 
> 
> 
> 
Whenever you apply a pigment, finish, complete texture or material to a 
CSG entity, any object that already have any of those are never 
affected. ONLY those that don't already have any texture or pigment can 
receive the CSG level texture.

If you add a second texture over a previous one, as in a layered 
texture, if the second texture don't have any transparency, it will 
totally cover and visually replace the underlying one. The underlying 
texture is still there, it's just hidden under the top one. Think of it 
as a coat of paint over the previous one.

If you add a texture to a CSG, it can overlay previous textures of that 
CSG, but never those of it's components.
As an object can have only one ior, only the last one should be used. If 
you have an union and some of it's component have an ior, the union 
level ior will never affect those. No change with the last versions.

There have been no behaviour change for layered textures since, at 
least, version 3.1G. (time when I discovered POV-Ray)


Post a reply to this message

From: Kenneth
Subject: Re: Question about Material and documentation
Date: 16 May 2017 17:10:00
Message: <web.591b694bce4acd17883fb31c0@news.povray.org>
Alain <kua### [at] videotronca> wrote:
> Le 17-05-15 à 11:42, Kenneth a écrit :
> > "Kenneth" <kdw### [at] gmailcom> wrote:

> >
> > This overlayed-texture effect seems to be different(?) behavior from what I
> > remember in v3.62 or v3.61; adding a '2nd texture' to an object *completely*
> > replaced the first texture, IIRC. Not so now, at least using v3.7.1 beta 7.
> > Unless my eyes are deceiving me!
> >

>
> There have been no behaviour change for layered textures since, at
> least, version 3.1G. (time when I discovered POV-Ray)

Yes, you're correct. Ignore my statement above; I must have been thinking of
multiple PIGMENTS in a single texture. The final pigment does completely
override any previous pigments.


Post a reply to this message

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