POV-Ray : Newsgroups : povray.advanced-users : Override textures/materials? : Re: Override textures/materials? Server Time
25 Apr 2024 08:15:54 EDT (-0400)
  Re: Override textures/materials?  
From: clipka
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

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