POV-Ray : Newsgroups : povray.general : Details on layered textures/materials : Re: Details on layered textures/materials Server Time
14 Apr 2024 14:30:33 EDT (-0400)
  Re: Details on layered textures/materials  
From: Thomas de Groot
Date: 2 Apr 2024 11:28:57
Message: <660c2439@news.povray.org>
Op 1-4-2024 om 19:20 schreef Chris R:
> I will start with the parsing errors I ran into with my initial transformation.
> 
First comment:
I think that the necessity to explicitly /declare/ the texture of the 
Crand() macro comes from the fact that the material{} envelop has been 
dropped. So, it seems that in order to enable the layered texture built, 
the Crand() macro needs to be put /inside/ a texture declaration, as you 
did.

Second comment:
Your macro version works fine but you can simplify the output in the 
following way. Instead of:

> #macro DakotaRedGranite(CSC, Pol, Typ, Pat1, Pat2, Blend, SS)
>      #local _m   = material {
>          texture { DakotaRedGranite_texture(CSC, Pol, Typ, Pat1,
> Pat2, Blend, SS) }
>          interior { ior 1.6 }
>      }
> 
>      _m
> #end
> 
you can simply write:

#macro DakotaRedGranite(CSC, Pol, Typ, Pat1, Pat2, Blend, SS)
         texture { DakotaRedGranite_texture(CSC, Pol, Typ, Pat1, Pat2, 
Blend, SS) }
#end

And then apply the macro in a scene, in the following way if you 
need/want to wrap the texture in a material{} declaration:

// sample sphere
sphere { <0,0,0>, 1.00
   material {
     DakotaRedGranite (CSC, Pol, Typ, Pat1, Pat2, Blend, SS)
     interior { ior 1.6 }
   }
   scale<1,1,1>  rotate<0,0,0>  translate<0,1.35,0>
}  // end of sphere -----------------------------------

The macro returns a texture{} which can be then be used as such in any 
scene.

Bill will note other issues or improvements I am sure. ;-)

-- 
Thomas


Post a reply to this message


Attachments:
Download 'chrisr_test.png' (197 KB)

Preview of image 'chrisr_test.png'
chrisr_test.png


 

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