/********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : TdG_moss_mcr.pov Version : 3.6.1c / MegaPOV 1.21 Description : A macro for generating a believable moss texture, to be used on two instances of an object. See demo scene code at bottom. Date : December 2008 Author : Thomas A. M. de Groot Copyright (C) 2008. All rights reserved. Use and/or modification of this code is free, except for commercial purposes. Commercial distribution is not allowed without written permission from the author. **********************************************************************************/ /*==================================================================================================== Usage: ----- (1) Declare following parameters before calling the macro: Substrate: Texture of the object default Frequency: Higher means smaller/finer moss plants default: 20 LmossScale: Scaling of the underlying moss pattern default: 1.5 UmossScale: Scaling of the overlying moss pattern default: 1.5 LmossExtent: Extension of the underlying moss pattern vs. Substrate [0 - 1] default: 0.4 Lgrade: Sharp/gradual transition default: 0.1 UmossExtent: Extension of the overlying moss pattern vs. transparency [0 - 1] default: 0.6 Ugrade: Sharp/gradual transition default: 0.1 (2) Call the macro: Moss() (3) Use the textures: Instance 1 of the object gets texture {LowerMoss} Instance 2 of the object gets texture {UpperMoss} after translating the instance upwards a tiny bit. Any other transformation of instance 2 is possible, with varying results. ======================================================================================================*/ #macro Moss () #ifndef (Substrate) #local Substrate = texture { pigment { granite pigment_map { [0.0 VeryDarkBrown] [0.3 Brown] [0.5 DarkBrown] [0.7 DarkTan] [1.0 Maroon] } warp {turbulence 0.8} } scale 0.01 } #end #local Transparant = texture { pigment {Clear} } #local LowMoss = texture { pigment { agate frequency 100 color_map { [0.00 color rgb <0.1,0.4,0.2>*0.2 ] [0.33 color rgb <0.2,0.4,0.1>*0.2 ] [0.66 color rgb <0.4,1.0,0.2>*0.2 ] [1.00 color rgb <0.1,0.4,0.2>*0.2 ] } } finish{ specular 0.3 roughness 0.0002 } } #ifndef (Frequency) #local Frequency = 20; #end #local UpMoss = texture { pigment { granite frequency Frequency color_map { [0.33 color rgbt <0,0,0,1> ] [0.33 color rgb <0.3,0.4,0.1>*0.5 ] [0.40 color rgb <0.8,0.9,0.1>*0.9 ] [0.50 color rgb <0.4,0.4,0.1>*0.8 ] [0.50 color rgbt <0,0,0,1> ] [0.66 color rgbt <0,0,0,1> ] [0.66 color rgb <0.4,0.4,0.2>*0.8 ] [0.80 color rgb <0.8,0.8,0.2>*0.8 ] [0.99 color rgb <0.4,1.0,0.2>*0.5 ] [0.99 color rgbt <0,0,0,1> ] } } normal { granite 0.5 frequency Frequency bump_size 5 } finish{ specular 0.0 } } #ifndef (LmossScale) #local LmossScale = 1.5; #end #ifndef (LmossExtent) #local LmossExtent = 0.4; #end #ifndef (Lgrade) #local Lgrade = 0.1; #end #if (LmossExtent+Lgrade > 1) #local Lgrade = (1-LmossExtent)/2; #end #declare LowerMoss = texture { granite scale LmossScale warp {turbulence 0.8} texture_map { [LmossExtent LowMoss] [LmossExtent+Lgrade Substrate] [1.0 Substrate] } } #ifndef (UmossScale) #local UmossScale = 1.5; #end #ifndef (UmossExtent) #local UmossExtent = 0.6; #end #ifndef (Ugrade) #local Ugrade = 0.1; #end #if (UmossExtent+Ugrade > 1) #local Ugrade = (1-UmossExtent)/2; #end #declare UpperMoss = texture { granite scale UmossScale warp {turbulence 0.8} texture_map { [UmossExtent UpMoss] [UmossExtent+Ugrade Transparant] [1.0 Transparant] } } #end //of Moss macro /*====================================================================================================*/ // Demo scene: #ifndef (Standalone) #declare Standalone = true; #end // Render settings (right-click on a line below): // +w640 +h640 +a0.3 +am2 #if (Standalone) #default {pigment {rgb <1,0,0>}} #default {finish {ambient 0 diffuse 0.9}} #version 3.6; #include "colors.inc" global_settings { assumed_gamma 1.0 } // ---------------------------------------- camera { location <0.0, 1.5, -3.0> direction 1.5*z right x*image_width/image_height look_at <0.0, 0.0, 0.0> } sky_sphere { pigment { gradient y color_map { [0.0 rgb <0.6,0.7,1.0>] [0.7 rgb <0.0,0.1,0.8>] } } } light_source { <0, 0, 0> color rgb <1, 1, 1> translate <-30, 30, 30>*1000 } light_source { <0, 0, 0> color rgb <1, 1, 1>*0.3 translate <-30, 30, -30>*500 shadowless } plane { y, 0 pigment { color rgb <0.7,0.5,0.3>*0.3 } } // ---------------------------------------- #declare Substrate = texture { pigment { granite pigment_map { [0.0 VeryDarkBrown] [0.3 Brown] [0.5 DarkBrown] [0.7 DarkTan] [1.0 Maroon] } warp {turbulence 0.8} } scale 0.01 } #declare Frequency = 35; #declare LmossScale = 1.5; #declare UmossScale = 1.0; #declare LmossExtent = 0.4; #declare UmossExtent = 0.6; #declare Lgrade = 0.1; #declare Ugrade = 0.05; Moss() union { sphere { 0.0, 1 scale <1, 0.2, 1> texture {LowerMoss} } sphere { 0.0, 1 scale <1, 0.2, 1> translate 0.01*y texture {UpperMoss} } translate 2*z } height_field { png "plasma3.png" translate <-0.5,0,-0.5> scale <2, 0.1, 2> texture {LowerMoss} } height_field { png "plasma3.png" translate <-0.5,0,-0.5> scale <2, 0.1, 2> translate 0.01*y texture {UpperMoss} } #end //of Standalone