POV-Ray : Newsgroups : povray.general : Details on layered textures/materials : Re: Details on layered textures/materials Server Time
3 May 2024 00:34:40 EDT (-0400)
  Re: Details on layered textures/materials  
From: Chris R
Date: 4 Apr 2024 09:00:00
Message: <web.660ea4325a557964a364adf25cc1b6e@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 3-4-2024 om 23:25 schreef Bald Eagle:
> > "Chris R" <car### [at] comcastnet> wrote:
> >
> >> So, somewhere, the parsing for layered textures inside of a material is
> >> different than the parsing of layered textures when declaring a texture
> >> identifier.
> >
> > remove the texture {} wrapper
> >
> > https://wiki.povray.org/content/Reference:Layered_Textures
> >
> > You make a copy of the macro, and have a parallel macro with a slightly
> > different name to make a texture rather than a material.   Then your developer
> > heart will avoid any mRNA induced myocarditis.  :)
> >
> > Once you declare the texture, then I think you can use that in a final texture
> > definition with any other modifiers.  It seems to be just a matter of
> > hierarchies and syntax at this point.
> >
> > And I can tell you from experience that that "just" can drive you crazy.
> >
> > - BE
> >
> Hmmm... doesn't seem to be as /simple/ as that... Have you tried this? I
> am getting nowhere [drives me crazy indeed]
>
> --
> Thomas

A few posts back in this thread I posted my solution as an attachment.
Essentially I did the following:

1. Modify the CRand macro:
#macro CRand(Intensity)
   #local _t = texture { ... }
   _t
#end

2. Rename the DakotaRedGranite(...) macro to DakotaRedGranite_texture(...)
3. At the end of the macro I did the following:
   #local _t_crand = texture { CRand(0.25) }
   #local _t_result =
   #if (Pol)
   ...
   #else
      #if (Type=1)
         texture {T1_DakotaRedFro}
         texture {_t_crand}
      #else
         texture {T1_DakotaRedFro}
         texture {T2_DakotaRedFro}
         texture {_t_crand}
      #end

   #end

   _t_result

4. Create a new macro named DakotaRedGranite(...)
#macro DakotaRedGranite(...)
   #local _m = material {
      texture { DakotaRedGranite_texture(...) }
      interior { ior 1.6 }
      scale M_scale
      rotate M_rotate
      translate M_trans
   }

   _m
#end

That all seems to parse correctly and works.

-- Chris R


Post a reply to this message

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