POV-Ray : Newsgroups : povray.text.scene-files : Halftones : Halftones Server Time
3 Jul 2024 01:15:29 EDT (-0400)
  Halftones  
From: Ron Parker
Date: 27 Nov 2001 11:46:05
Message: <slrna07gqe.mu2.ron.parker@fwi.com>
I've been playing with color halftones, inspired by Rune's Pattern Control
Trick, and I have something y'all might enjoy.  The third case in the 
halftone.pov file loses something if you don't have the image I used, 
because my image has a radio tower with its tip at the center of the 
onion pattern, but go ahead and try it with your favorite image anyway.

POV 3.5 is required, due to all those functions.

---- begin Halftone.inc: 

#macro CustomHalftone( Pigment, Dotsize, DotPigment, CAngle, MAngle, YAngle ) 
  #local PIG=function{pigment{Pigment}}
  #local CDOTS=function{pigment{DotPigment scale Dotsize rotate CAngle*z}}
  #local MDOTS=function{pigment{DotPigment scale Dotsize rotate MAngle*z}}
  #local YDOTS=function{pigment{DotPigment scale Dotsize rotate YAngle*z}}
  #local CYAN=function{ select(PIG(x,y,z).red-CDOTS(x,y,z).red,1,0) }
  #local YELLOW=function{ select(PIG(x,y,z).blue-YDOTS(x,y,z).red,1,0) }
  #local MAGENTA=function{ select(PIG(x,y,z).green-MDOTS(x,y,z).red,1,0) }
  average pigment_map{
    [1 function{1-CYAN(x,y,z)} color_map {[0 rgb 0][1 red 3]}]
    [1 function{1-YELLOW(x,y,z)} color_map {[0 rgb 0][1 blue 3]}]
    [1 function{1-MAGENTA(x,y,z)} color_map {[0 rgb 0][1 green 3]}]
  }
#end

#macro Halftone( Pigment, Dotsize )
  #local DOTPIG=pigment{quilted control0 1/3 control1 2/3 
                        color_map {[.1 rgb 0][.45 rgb 1]}}
  CustomHalftone( Pigment, Dotsize, DOTPIG, 15, 45, 75 )
#end

#macro LineHalftone( Pigment, Dotsize, Angle )
  #local DOTPIG=pigment{gradient y}
  CustomHalftone( Pigment, Dotsize, DOTPIG, Angle, Angle, Angle )
#end      

---- end Halftone.inc

---- begin Halftone.pov:
#include "halftone.inc"
#declare Example=1;
camera {location -2*z}

#declare Picture=pigment {
  image_map{jpeg "d:\\myfiles\\golden_gate_bridge_from_marin.jpg"} 
  translate -.5 
  scale 2*<4/3,1,1>
}

plane {
  -z, 0  
  #switch (Example)            
    #case (1)
      pigment {Halftone(Picture, .02)}
      #break
    #case (2)
      pigment {LineHalftone(Picture, .02, 30)} 
      #break
    #case (3)
      #declare OnionScale=.02;
      pigment {CustomHalftone(Picture, OnionScale, 
        pigment{onion translate <(144/320-1)*4/3,1-260/240,0>/OnionScale},
        0, 0, 0)}
      #break
  #end // switch
  finish {ambient 1}
}
---- end Halftone.pov

-- 
#local R=<7084844682857967,0787982,826975826580>;#macro L(P)concat(#while(P)chr(
mod(P,100)),#local P=P/100;#end"")#end background{rgb 1}text{ttf L(R.x)L(R.y)0,0
translate<-.8,0,-1>}text{ttf L(R.x)L(R.z)0,0translate<-1.6,-.75,-1>}sphere{z/9e3
4/26/2001finish{reflection 1}}//ron.parker@povray.org My opinions, nobody else's


Post a reply to this message

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