POV-Ray : Newsgroups : povray.text.scene-files : find edges postprocess using functions Server Time
22 Dec 2024 23:03:51 EST (-0500)
  find edges postprocess using functions (Message 1 to 4 of 4)  
From: Simon Adameit
Subject: find edges postprocess using functions
Date: 24 Jul 2002 13:02:40
Message: <3d3eddb0@news.povray.org>
See p.b.i.

// Persistence of Vision Ray Tracer Scene Description File
// File: pp.pov
// Vers: 3.5
// Desc: find edges postprocess with pov
// Auth: Simon Adameit

//
// +fn16 +kff3 -a
//

#include"math.inc"

#declare Step=frame_number;
#declare Cam_pos=<-8,10,-12>;
#declare Cam_look_at=<0,0,0>;
#declare Scene_scale=30;
#declare Radius_Dist=2;
#declare Radius_Norm=1;
#declare Di_Dist=0.02;
#declare Di_Norm=0.01;


#declare Boden=
union{
  plane{y,-2}
  box{<-5,-2,-5><5,0,5>}
}

#declare Haus=
difference{
  superellipsoid{<0.5,0.5>
    translate y/2
    scale 2.5
  }
  cylinder{<-3,0,0><3,0,0>,1.5 scale<1,2,1>}
  cylinder{<0,0,-3><0,0,3>,1.5 scale<1,2,1>}
}

#declare Dach=
union{
  sphere{0,3 scale<1,0.3,1> translate<0,4,0>}
  sphere{0,2.3 scale<1,0.7,1> translate<0,4.5,0>}
  sphere{0,1.7 translate<0,5,0>}
}

/* Camera for Step 1 and 2 */

#if(Step!=3)
  camera{
    location Cam_pos
    right x*image_width/image_height
    up y
    look_at Cam_look_at
    angle 60
  }
#end

/* Step 1 */

#if(Step=1)


al_settings{  
    assumed_gamma 1  
  }
    
  #declare Tex1=
  texture{
    pigment{rgb<1,0.4,0.1>}
    finish{diffuse 1 ambient 0.5 brilliance 0.01}
  }
    
  #declare Tex2=
  texture{
    pigment{rgb<0.2,1,0.6>*0.5}
    finish{diffuse 1 ambient 0.5 brilliance 0.01}
  }
    
  #declare Tex3=
  texture{
    pigment{checker rgb 1, rgb<0.2,0.19,1> scale 6}
    finish{diffuse 1 ambient 0.5 brilliance 0.01}
  }
  
  light_source{<20,50,-10> rgb 1.4}
  
  object{Boden texture{Tex3}}
  object{Haus texture{Tex1}}
  object{Dach texture{Tex2}}

#end

/* Step 2 */

#if(Step=2)

  #declare Info_Tex=
  texture{
    pigment{
      average
      pigment_map{
        [ 
          spherical scale Scene_scale translate Cam_pos
          color_map{
            [0 rgb 0]
            [1 red 3]  
          }
        ]
        [
          slope{VPerp_Adjust(x,Cam_pos-Cam_look_at)}
          color_map{
            [0 
rgb 0]
            [1 green 3]
          }
        ]
        [
          slope{VPerp_Adjust(y,Cam_pos-Cam_look_at)}
          color_map{
            [0 rgb 0]
            [1 blue 3]
          }
        ]
      }
    }
    finish{diffuse 0 ambient 1}
  }

  object{Boden texture{Info_Tex}}
  object{Haus texture{Info_Tex}}
  object{Dach texture{Info_Tex}}

#end

/* Step 3 */

#if(Step=3)

  camera{
    orthographic
    location -z
    right image_width*x
    up image_height*y
    look_at 0
  }

  plane{z,2
    pigment{
      image_map{
        png "pp1"
      }
      translate -.5
      scale <image_width,image_height,1>
    }
    finish{diffuse 0 ambient 1}
  }

  #declare Ifun=
  function{
    pigment{
      image_map{
        png "pp2"
      }
      translate -.5
      scale <image_width,image_height,1>
    }
  }

  #declare Ifun_red_blur=
  function{
    (
    #local Z1=-Radius_Dist;
    #while(Z1<Radius_Dist)
      #local Z2=-Radius_Dist;
      #while(Z2<Radius_Dist)
        Ifun(x+Z1,y+Z2,z).red+
        #local Z2=Z2+1;
      #end
      #local Z1=Z1+1;
    #end
    0
    )
    /(Radius_Dist*Radius_Dist*4)
  }

  #declare Ifun_green_blur=
  function{
    (
    #local Z1=-Radius_Norm;
    #while(Z1<Radius_Norm)
      #local Z2=-Radius_Norm;
      #while(Z2<Radius_Norm)
        Ifun(x+Z1,y+Z2,z).green+
        #local Z2=Z2+1;
      #end
      #local Z1=Z1+1;
    #end
    0
    )
    /(Radius_Norm*Radius_Norm*4)
  }

  #declare Ifun_blue_blur=
  function{
    (
    #local Z1=-Radius_Norm;
    #while(Z1<Radius_Norm)
      #local Z2=-Radius_Norm;
      #while(Z2<Radius_Norm)
        Ifun(x+Z1,y+Z2,z).blue+
        #local Z2=Z2+1;
      #end
      #local Z1=Z1+1;
    #end
    0
    )
    /(Radius_Norm*Radius_Norm*4)
  }

  #declare Ofun_Distance=
  function{
    select(abs(Ifun_red_blur(x,y,z)-Ifun(x,y,z).red)-Di_Dist,0,1)
  }

  #declare Ofun_Norm=
  function{
    max
    (
    select(abs(Ifun_green_blur(x,y,z)-Ifun(x,y,z).green)-Di_Dist,0,1),
    select(abs(Ifun_blue_blur(x,y,z)-Ifun(x,y,z).blue)-Di_Dist,0,1)
    )
  }

  plane{z,1
    pigment{
      function{Ofun_Norm(x,y,z)}
      color_map{
        [0 rgbt 1]
        [1 rgb 0]
      }
    }
    finish{ambient 1 diffuse 0}
  }

  plane{z,0
    pigment{
      function{Ofun_Distance(x,y,z)}
      color_map{
        [0 rgbt 1]
        [1 rgb 0]
      }
    }
    finish{ambient 1 diffuse 0}
  }

#end


Post a reply to this message

From: Simon Adameit
Subject: Re: find edges postprocess using functions
Date: 25 Jul 2002 05:38:50
Message: <3d3fc72a@news.povray.org>
>   #declare Ofun_Norm=
>   function{
>     max
>     (
>     select(abs(Ifun_green_blur(x,y,z)-Ifun(x,y,z).green)-Di_Dist,0,1),
>     select(abs(Ifun_blue_blur(x,y,z)-Ifun(x,y,z).blue)-Di_Dist,0,1)
>     )
>   }
>

This has to be:

#declare Ofun_Norm=
  function{
    max
    (
    select(abs(Ifun_green_blur(x,y,z)-Ifun(x,y,z).green)-Di_Norm,0,1),
    select(abs(Ifun_blue_blur(x,y,z)-Ifun(x,y,z).blue)-Di_Norm,0,1)
    )
  }


Post a reply to this message

From:  Light Beam 
Subject: Re: find edges postprocess using functions
Date: 25 Jul 2002 06:08:02
Message: <3d3fce02@news.povray.org>
I try and I obtain a black image !?... how does it works ?


3d3fc72a@news.povray.org...
>
> >   #declare Ofun_Norm=
> >   function{
> >     max
> >     (
> >     select(abs(Ifun_green_blur(x,y,z)-Ifun(x,y,z).green)-Di_Dist,0,1),
> >     select(abs(Ifun_blue_blur(x,y,z)-Ifun(x,y,z).blue)-Di_Dist,0,1)
> >     )
> >   }
> >
>
> This has to be:
>
> #declare Ofun_Norm=
>   function{
>     max
>     (
>     select(abs(Ifun_green_blur(x,y,z)-Ifun(x,y,z).green)-Di_Norm,0,1),
>     select(abs(Ifun_blue_blur(x,y,z)-Ifun(x,y,z).blue)-Di_Norm,0,1)
>     )
>   }
>
>


Post a reply to this message

From:  Light Beam 
Subject: Re: find edges postprocess using functions
Date: 25 Jul 2002 06:17:32
Message: <3d3fd03c@news.povray.org>
Ok, that's right now...


Post a reply to this message

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