POV-Ray : Newsgroups : povray.binaries.images : Revisiting Norbert Kern's Position Pattern Trick : Revisiting Norbert Kern's Position Pattern Trick Server Time
18 Apr 2024 22:16:19 EDT (-0400)
  Revisiting Norbert Kern's Position Pattern Trick  
From: Thomas de Groot
Date: 11 Jul 2018 07:22:03
Message: <5b45e85b@news.povray.org>
I refer to Norbert's 2012 message 
http://news.povray.org/povray.binaries.images/thread/%3C4f661a38%241%40news.povray.org%3E/

I wanted to find out by myself how to model an autumn tree/shrub, using 
the mesh2 file provided by Poseray as a basis. So, I did not use 
Norbert's trick here. And indeed, like Nobert said, the render speed 
dropped dramatically, but at least I understand texture patterning 
better. As an example I used an Xfrog shrub (Cotoneaster integerriums - 
Wild cotoneaster). The image is from my tree testing code.

For those interested, here is the code used (beware line breaks):

//start code
//=================================================================
#declare Obj_Leaf_ =
//The leaf image_map:
#declare PR_DIFFUSE = pigment {p_map2}
//Two colour variations using Poseray's pigment_multiply macro:
#declare PR_DIFFUSE1 = pigment {pigment_multiply(PR_DIFFUSE, 
pigment{color srgb ((<1.00, 1.00, 0.00>-<1,1,1>)*1.00+<1,1,1>) })}
#declare PR_DIFFUSE2 = pigment {pigment_multiply(PR_DIFFUSE, pigment 
{color srgb ((<1.00, 0.00, 0.00>-<1,1,1>)*1.00+<1,1,1>) })}
//A facultative uv-map scaling that may be set in Poseray:
#declare PatternScale = <1.25, 1.25, 1>;

//Finish decalration:
#declare F1 =
finish {
   specular  0.2
   roughness 0.001
   diffuse  0.8
   reflection {0 }
   conserve_energy
}

//First texture definition with variation 1 of the leaf image_map:
#declare T1 =
texture {
   pigment {uv_mapping PR_DIFFUSE1 scale PatternScale }
   finish {F1}
}

//Second texture definition with variation 2 of the leaf image_map:
#declare T2 =
texture {
   pigment {uv_mapping PR_DIFFUSE2 scale PatternScale }
   finish {F1}
}

//A general transparency texture definition:
#declare T3 =
texture {
   pigment {rgbft <0, 0, 0, 1, 1> }
}

//First patterned texture definition using a leaf mask image_map:
#declare T4 =
texture {/*uv_mapping*/
   pigment_pattern {uv_mapping p_map3 scale PatternScale }
   texture_map {
     [0 T3]
     [1 T1]
   }
}

//Second patterned texture definition using a leaf mask image_map:
#declare T5 =
texture {/*uv_mapping*/
   pigment_pattern {uv_mapping p_map3 scale PatternScale }
   texture_map {
     [0 T3]
     [1 T2]
   }
}

//Final material bringing it all together in a spherical texture pattern:
material {
   texture {
     spherical
     texture_map {
       [0.10 T5]
       [0.90 T4]
     }
     translate 1*y  //the spherical pattern is at the origin; you need 
to position it
     warp {turbulence 0.3} //some warp makes the pattern more natural 
looking
   }
}

//=================================================================
//end code

-- 
Thomas


Post a reply to this message


Attachments:
Download 'povtree_test.jpg' (256 KB)

Preview of image 'povtree_test.jpg'
povtree_test.jpg


 

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