POV-Ray : Newsgroups : povray.advanced-users : Override textures/materials? Server Time
31 Oct 2024 19:35:32 EDT (-0400)
  Override textures/materials? (Message 1 to 10 of 31)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Mike Horvath
Subject: Override textures/materials?
Date: 18 Jun 2021 08:42:01
Message: <60cc9499$1@news.povray.org>
Is there a way to override textures or materials that have already been 
declared or applied?

I am trying to create a depth map, and need to apply a custom texture to 
the entire object.

Thanks.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 08:43:45
Message: <60cc9501$1@news.povray.org>
On 6/18/2021 8:41 AM, Mike Horvath wrote:
> Is there a way to override textures or materials that have already been 
> declared or applied?
> 
> I am trying to create a depth map, and need to apply a custom texture to 
> the entire object.
> 
> Thanks.
> 
> 
> Mike


Specifying an empty texture

texture {}

to the original object does not seem to do the trick.


Mike


Post a reply to this message

From: clipka
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 09:30:45
Message: <60cca005$1@news.povray.org>
Am 18.06.2021 um 14:41 schrieb Mike Horvath:
> Is there a way to override textures or materials that have already been 
> declared or applied?
> 
> I am trying to create a depth map, and need to apply a custom texture to 
> the entire object.


If the object in question is a primitive, then I _think_ this should be 
possible simply by referencing the object in question and specifying a 
new `texture` block, like so:

     // original object
     #declare OriginalObject = sphere { ... texture { ... } };

     // override texture
     #declare ClonedObject = object { OriginalObject texture { ... } };

However, if the object in question is a compound object (merge, union or 
the like), then I don't think it is possible. At least if the texture is 
defined at the component level.

The reason is that the mechanism is designed for use cases in which part 
of a compound object's textures are defined while others can be 
overridden later. Think e.g. a car, where you can later apply the 
texture to use for the car's body, but all the other textures like rims, 
tyres, headlights, windscreen etc. are already fixed and immutable.

To achive this, a "texture override" on compound objects only affects 
those components that have no explicit texture definition of their own, 
while all other components will cling to their textures like superglue.


Post a reply to this message

From: Alain Martel
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 10:44:05
Message: <60ccb135$1@news.povray.org>
Le 2021-06-18 à 08:41, Mike Horvath a écrit :
> Is there a way to override textures or materials that have already been 
> declared or applied?
> 
> I am trying to create a depth map, and need to apply a custom texture to 
> the entire object.
> 
> Thanks.
> 
> 
> Mike

In the case of a texture or material that have been declared but not 
used yet, a new #declare will completely replace the original with the 
new definition.
If it have been applied to something, then redefined, then, any object 
that received it will keep the original definition.

In your case, you need to remove, or at least comment out, any texture 
or material from your object. Then, apply your new texture to that 
object as a whole.


Post a reply to this message

From: Bald Eagle
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 13:35:00
Message: <web.60ccd8d4eaa343741f9dae3025979125@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> Is there a way to override textures or materials that have already been
> declared or applied?

What if you union everything together and do an intersection with a box that is
the size of the union's bounding box?  The intersection ought to be its own
object that you can give a fresh texture to.


Post a reply to this message

From: Mike Horvath
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 13:50:19
Message: <60ccdcdb$1@news.povray.org>
On 6/18/2021 9:30 AM, clipka wrote:
> Am 18.06.2021 um 14:41 schrieb Mike Horvath:
>> Is there a way to override textures or materials that have already 
>> been declared or applied?
>>
>> I am trying to create a depth map, and need to apply a custom texture 
>> to the entire object.
> 
> 
> If the object in question is a primitive, then I _think_ this should be 
> possible simply by referencing the object in question and specifying a 
> new `texture` block, like so:
> 
>      // original object
>      #declare OriginalObject = sphere { ... texture { ... } };
> 
>      // override texture
>      #declare ClonedObject = object { OriginalObject texture { ... } };
> 
> However, if the object in question is a compound object (merge, union or 
> the like), then I don't think it is possible. At least if the texture is 
> defined at the component level.
> 
> The reason is that the mechanism is designed for use cases in which part 
> of a compound object's textures are defined while others can be 
> overridden later. Think e.g. a car, where you can later apply the 
> texture to use for the car's body, but all the other textures like rims, 
> tyres, headlights, windscreen etc. are already fixed and immutable.
> 
> To achive this, a "texture override" on compound objects only affects 
> those components that have no explicit texture definition of their own, 
> while all other components will cling to their textures like superglue.

It would be nice if I could flag a texture as "important" such that it 
overrides all previously defined textures. I can do this in CSS and it 
is very handy.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 13:50:37
Message: <60ccdced$1@news.povray.org>
On 6/18/2021 1:33 PM, Bald Eagle wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>> Is there a way to override textures or materials that have already been
>> declared or applied?
> 
> What if you union everything together and do an intersection with a box that is
> the size of the union's bounding box?  The intersection ought to be its own
> object that you can give a fresh texture to.
> 
> 
> 


Interesting. I will try this.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 13:52:19
Message: <60ccdd53$1@news.povray.org>
On 6/18/2021 10:44 AM, Alain Martel wrote:
> Le 2021-06-18 à 08:41, Mike Horvath a écrit :
>> Is there a way to override textures or materials that have already 
>> been declared or applied?
>>
>> I am trying to create a depth map, and need to apply a custom texture 
>> to the entire object.
>>
>> Thanks.
>>
>>
>> Mike
> 
> In the case of a texture or material that have been declared but not 
> used yet, a new #declare will completely replace the original with the 
> new definition.
> If it have been applied to something, then redefined, then, any object 
> that received it will keep the original definition.
> 
> In your case, you need to remove, or at least comment out, any texture 
> or material from your object. Then, apply your new texture to that 
> object as a whole.
> 

Instead of declaring my textures, I may start using macros instead. That 
way, I can just comment out the texture declaration inside the macro. 
But might this not consume more memory?


Mike


Post a reply to this message

From: Norbert Kern
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 14:20:00
Message: <web.60cce2aeeaa34374d81232a3b7ae6630@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> Is there a way to override textures or materials that have already been
> declared or applied?
>
> I am trying to create a depth map, and need to apply a custom texture to
> the entire object.
>
> Thanks.
>
>
> Mike


Hi Mike,

for depth_maps I use a variable to change every finish ( e.g. finish {specular
dfac*0.3 roughness 0.0003 diffuse dfac*0.6 reflection {dfac*0.03, dfac*0.1}}.
For the "normal" render dfac is defined as 1 and for depthmaps or other
effectmaps dfac is 0.
Together with a white fog you get your depthmap.


Norbert


Post a reply to this message

From: clipka
Subject: Re: Override textures/materials?
Date: 18 Jun 2021 14:53:20
Message: <60cceba0$1@news.povray.org>
Am 18.06.2021 um 19:33 schrieb Bald Eagle:
> Mike Horvath <mik### [at] gmailcom> wrote:
>> Is there a way to override textures or materials that have already been
>> declared or applied?
> 
> What if you union everything together and do an intersection with a box that is
> the size of the union's bounding box?  The intersection ought to be its own
> object that you can give a fresh texture to.

That's a smart idea.

You may need to specify `cutaway_textures` though, and I'm not sure 
whether it does indeed work with objects that are already explicitly 
textured.


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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