POV-Ray : Newsgroups : povray.binaries.images : Anamorphic images for mirrored cylinder. : Anamorphic images for mirrored cylinder. Server Time
7 Nov 2024 13:37:05 EST (-0500)
  Anamorphic images for mirrored cylinder.  
From: William F Pokorny
Date: 8 Dec 2015 16:43:48
Message: <56674f14@news.povray.org>
In answer to a question to povray.general yesterday on how to do this in 
POV-Ray I worked up the following code to both create and visualize the 
distorted image from any input image.

//---------------------------------------------------------------------------
// POV-Ray code to render both result and distorted image
// I used png formatted square image. Camera00 renders
// both distorted image and its reflection off cylinder.
// Camera01 renders just the distorted image for the table
// top. Of course, endless variations possible.
//---------------------------------------------------------------------------
#version 3.7;
global_settings {
     assumed_gamma 1
     ambient_light srgb <1,1,1>
}
#declare Grey50 = srgbft <0.5,0.5,0.5,0,0>;
#declare White = srgbft <1,1,1,0,0>;
background {
     color Grey50
   //color White   // Likely use this with Camera01
}
#declare Camera00 = camera {
     perspective
     location <1.2,1.2,-1.2>
     sky <0,1,0>
     angle 35
     right x*(image_width/image_height)
     look_at <0,0,0>
}
#declare Camera01 = camera {
     orthographic
     location <0,1,0>
     direction <0,-1,0>
     right x*(2)
     up <0,0,2>
}
#declare Light00 = light_source {
     <50,150,-250>, White
}
#declare Red = srgbft <1,0,0,0,0>;
#declare CylinderX = cylinder {
     <-1,0,0>, <1,0,0>, 0.01
     pigment { color Red }
}
#declare Green = srgbft <0,1,0,0,0>;
#declare CylinderY = cylinder {
     <0,-1,0>, <0,1,0>, 0.01
     pigment { color Green }
}
#declare Blue = srgbft <0,0,1,0,0>;
#declare CylinderZ = cylinder {
     <0,0,-1>, <0,0,1>, 0.01
     pigment { color Blue }
}
#declare CylinderM = cylinder {
     <0,0,0>, <0,0.5,0>, 0.1
}
#declare Cyan = srgbft <0,1,1,0,0>;
#declare CylinderB = cylinder {
     <0,-0.01,0>, <0,0,0>, 0.11
     pigment { color Cyan }
}
#declare Magenta = srgbft <1,0,1,0,0>;
#declare CylinderT = cylinder {
     <0,0.5,0>, <0,0.51,0>, 0.11
     pigment { color Magenta }
}
#declare BoxTableTop = box {
     <-1,-0.001,-1>,<1,0.001,1>
}
#declare Pigm = pigment {
     image_map { "example.png" once map_type 0 }
     rotate x*90
     translate <0,0,0.3>  // Moving image up some
     warp {
         cylindrical
         orientation z
     }
}
#include "finish.inc"
#declare Ttabletop = texture {
     pigment { Pigm }
     finish { Luminous }
     scale 0.7            // Shrink partly due translate up
     scale <-1,1,-1>
     rotate y*45
}
#declare Tcylinder = texture {
     pigment { color White }
     finish { Mirror }
}
#declare ObjCylinder = object {
     object { CylinderM }
     texture { Tcylinder }
}
#declare ObjTableTop = object {
     object { BoxTableTop }
     texture { Ttabletop }
}

//---
    camera { Camera00 }  // Use to see final result
// camera { Camera01 }  // Use to create distorted image.
light_source { Light00 }
    object { CylinderX } // Axis & cyl top bottom shapes as aids
    object { CylinderY } // Normally comment when using Camera01
    object { CylinderZ }
    object { CylinderB }
    object { CylinderT }
object { ObjCylinder }
object { ObjTableTop }
//---------------------------------------------------------------------------

Bill P.


Post a reply to this message


Attachments:
Download 'camera00.jpg' (93 KB) Download 'camera01.jpg' (63 KB)

Preview of image 'camera00.jpg'
camera00.jpg

Preview of image 'camera01.jpg'
camera01.jpg


 

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