<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.povray.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SharkD</id>
	<title>POV-Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.povray.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SharkD"/>
	<link rel="alternate" type="text/html" href="https://wiki.povray.org/content/Special:Contributions/SharkD"/>
	<updated>2026-04-19T15:51:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10381</id>
		<title>HowTo Talk:Install POV</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10381"/>
		<updated>2021-01-26T04:22:32Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Running POV from the command line */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Windows==&lt;br /&gt;
I recommend logging into an actual administrator account before installing POV-Ray on Windows. I have had trouble when installing as a non-admin, and the installer does not ask you first. Also, keep in mind that the include files and so forth are installed under the profile of the user doing the installing by default. Make sure to explicitly switch the destination to the &amp;quot;Public&amp;quot; folder or your non-admin account during installation. [[User:SharkD|SharkD]] 04:13, 26 January 2021 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Running POV from the command line ==&lt;br /&gt;
&lt;br /&gt;
We could use some instructions on how to set up and run POV from the command line. Specifically under Linux. Thanks. [[User:SharkD|SharkD]] 04:22, 26 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10380</id>
		<title>HowTo Talk:Install POV</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10380"/>
		<updated>2021-01-26T04:15:36Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Windows */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Windows==&lt;br /&gt;
I recommend logging into an actual administrator account before installing POV-Ray on Windows. I have had trouble when installing as a non-admin, and the installer does not ask you first. Also, keep in mind that the include files and so forth are installed under the profile of the user doing the installing by default. Make sure to explicitly switch the destination to the &amp;quot;Public&amp;quot; folder or your non-admin account during installation. [[User:SharkD|SharkD]] 04:13, 26 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10379</id>
		<title>HowTo Talk:Install POV</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10379"/>
		<updated>2021-01-26T04:14:55Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Windows */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Windows==&lt;br /&gt;
I recommend logging into an actual administrator account before installing POV-Ray on Windows. I have had trouble when installing as a non-admin, and the installer does not ask you first. Also, keep in mind that the include files and so forth are installed for the current user only by default. Make sure to explicitly switch the destination to the &amp;quot;Public&amp;quot; folder or your non-admin account during installation. [[User:SharkD|SharkD]] 04:13, 26 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10378</id>
		<title>HowTo Talk:Install POV</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10378"/>
		<updated>2021-01-26T04:14:40Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Windows */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Windows==&lt;br /&gt;
I recommend logging into an actual administrator account before installing POV-Ray on Windows. I have had trouble when installing as a non-admin. Also, keep in mind that the include files and so forth are installed for the current user only by default. Make sure to explicitly switch the destination to the &amp;quot;Public&amp;quot; folder or your non-admin account during installation. [[User:SharkD|SharkD]] 04:13, 26 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10377</id>
		<title>HowTo Talk:Install POV</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10377"/>
		<updated>2021-01-26T04:13:58Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Windows */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Windows==&lt;br /&gt;
I recommend logging into an actual administrator account before installing POV-Ray on Windows. I have had trouble when using &amp;quot;Run as...&amp;quot; or the &amp;quot;Run as administrator&amp;quot; option. Also, keep in mind that the include files and so forth are installed for the current user only by default. Make sure to explicitly switch the destination to the &amp;quot;Public&amp;quot; folder or your non-admin account during installation. [[User:SharkD|SharkD]] 04:13, 26 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10376</id>
		<title>HowTo Talk:Install POV</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10376"/>
		<updated>2021-01-26T04:13:29Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Windows */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Windows==&lt;br /&gt;
I recommend logging into an actual administrator account before installing POV-Ray on Windows. I have had trouble when using &amp;quot;Run as...&amp;quot; or the &amp;quot;Run as administrator&amp;quot; option. Also, keep in mind that the include files and so forth are installed for the current user only by default. Make sure to explicitly switch the destination to the &amp;quot;Public&amp;quot; folder or your non-admin account. [[User:SharkD|SharkD]] 04:13, 26 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10375</id>
		<title>HowTo Talk:Install POV</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo_Talk:Install_POV&amp;diff=10375"/>
		<updated>2021-01-26T04:13:14Z</updated>

		<summary type="html">&lt;p&gt;SharkD: add section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Windows==&lt;br /&gt;
I recommend logging into an actual administrator account before installing POV-Ray. I have had trouble when using &amp;quot;Run as...&amp;quot; or the &amp;quot;Run as administrator&amp;quot; option. Also, keep in mind that the include files and so forth are installed for the current user only by default. Make sure to explicitly switch the destination to the &amp;quot;Public&amp;quot; folder or your non-admin account. [[User:SharkD|SharkD]] 04:13, 26 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Fix_old_scenes_to_work_with_the_new_gamma_system&amp;diff=9694</id>
		<title>HowTo:Fix old scenes to work with the new gamma system</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Fix_old_scenes_to_work_with_the_new_gamma_system&amp;diff=9694"/>
		<updated>2019-06-29T22:59:14Z</updated>

		<summary type="html">&lt;p&gt;SharkD: moved HowTo:Fix old scenes to work with the new gamma system to HowTo:Migrate old scenes to work with the new gamma system: This article is not really about fixing stuff.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[HowTo:Migrate old scenes to work with the new gamma system]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Migrate_old_scenes_to_work_with_the_new_gamma_system&amp;diff=9693</id>
		<title>HowTo:Migrate old scenes to work with the new gamma system</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Migrate_old_scenes_to_work_with_the_new_gamma_system&amp;diff=9693"/>
		<updated>2019-06-29T22:59:14Z</updated>

		<summary type="html">&lt;p&gt;SharkD: moved HowTo:Fix old scenes to work with the new gamma system to HowTo:Migrate old scenes to work with the new gamma system: This article is not really about fixing stuff.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p class=&amp;quot;Note&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Note:&amp;lt;/strong&amp;gt; The title of this page and part of its contents are somewhat outdated, as POV-Ray 3.7.0 proper will now support virtually full backward compatibility for legacy scenes, and in this sense there will be almost nothing to fix. The information in this page rather applies to &amp;lt;em&amp;gt;migrating&amp;lt;/em&amp;gt; a scene to use the physically realistic &amp;lt;code&amp;gt;assumed_gamma 1.0&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before &amp;quot;assumed_gamma 1.0&amp;quot; or the most recent 3.7 betas, the colour math was simply ''wrong''. So in order to get exactly the same result, you'd have to mimic that wrong colour math - which 3.7 refuses to, except for legacy scenes using &amp;quot;#version 3.6&amp;quot; (or anything smaller than 3.7) and &amp;quot;assumed_gamma 2.2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If you do want to port the scene to the right math, here's what I expect to be the most important steps:&lt;br /&gt;
&lt;br /&gt;
#In the ini-file, set the &amp;quot;Display_Gamma&amp;quot; to whatever fits your system; set &amp;quot;File_Gamma&amp;quot; to the same. (Ideally, your system should have a Display_Gamma of 2.2.)&lt;br /&gt;
#In the scene file, use &amp;quot;#version 3.7&amp;quot;, and remove any &amp;quot;assumed_gamma&amp;quot; statement.&lt;br /&gt;
#Gamma-adjust all colour literals, by raising the R,G,B components to the power of 2.2 (or wait for the next beta, and use &amp;quot;srgb&amp;quot; instead of &amp;quot;rgb&amp;quot;). Check your scene for colour values that are computed from some other values - you may (or may not) want to gamma-adjust these as well.&lt;br /&gt;
#Check your scene for input image files, and whether they are handled properly regarding gamma. For images that are used as anything non-color (e.g. height field data, bump map, texture map or what-have-you), explicitly specify &amp;quot;gamma 1.0&amp;quot; after the filename. For any images that do wind up being used as a colour, try the default first (i.e. no &amp;quot;gamma&amp;quot; statement); if the colours appear too washed-out or too strong, try explicitly specifying &amp;quot;gamma srgb&amp;quot;.&lt;br /&gt;
#Toy around with overall brightness and/or brightness of individual light sources, until you feel comfortable with the illumination. You may also want to tweak some of the colours in your scene (both pigment and light sources). If you're using self-made input image files, you may also want to tweak their gamma setting, but try to avoid this with 3rd party input images (you should usually find a way to make them work by tweaking the scene rather than the image).&lt;br /&gt;
&lt;br /&gt;
===Color literals===&lt;br /&gt;
As of version 3.7.0.beta.41, POV-Ray natively supports gamma-adjustment of color literals, provided they conform to the sRGB standard:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pov&amp;quot;&amp;gt;&lt;br /&gt;
pigment {color srgb &amp;lt;110,160,008&amp;gt;/255 }&lt;br /&gt;
pigment {color srgbft &amp;lt;1,1,1,0,1&amp;gt; }&lt;br /&gt;
pigment {color srgbt &amp;lt;1,1,1,1&amp;gt; }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are still using version 3.6, or need more flexibility of the gamma parameter:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;pov&amp;quot;&amp;gt;&lt;br /&gt;
#macro gamma_color_adjust(in_color, out_gamma)&lt;br /&gt;
	rgbft &amp;lt;&lt;br /&gt;
		pow(in_color.red, out_gamma),&lt;br /&gt;
		pow(in_color.green, out_gamma),&lt;br /&gt;
		pow(in_color.blue, out_gamma),&lt;br /&gt;
		in_color.filter,&lt;br /&gt;
		in_color.transmit&lt;br /&gt;
	&amp;gt;&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
pigment {color gamma_color_adjust(rgb &amp;lt;110,160,008&amp;gt;/255, 2.2)}&lt;br /&gt;
pigment {color gamma_color_adjust(rgbft &amp;lt;1,1,1,0,1&amp;gt;, 2.2)}&lt;br /&gt;
pigment {color gamma_color_adjust(rgbt &amp;lt;1,1,1,1&amp;gt;, 2.2)}&lt;br /&gt;
pigment {color gamma_color_adjust(red 1 green 1 blue 1 transmit 1, 2.2)}&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	-z * 40960&lt;br /&gt;
	color gamma_color_adjust(rgb &amp;lt;240,240,240&amp;gt;/255, 2.2)&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Transparency===&lt;br /&gt;
Colors with partial transparency (filter and/or transmit) suffer additional degradation that is not resolved by the above fix. For instance, Chris Colefax's lens flare macro. It is not clear yet how to resolve this issue. (See [http://news.povray.org/povray.binaries.scene-files/thread/%3C4c64d773%40news.povray.org%3E/ here].)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[http://news.povray.org/povray.advanced-users/thread/%3C4c0f1128%40news.povray.org%3E/ Converting pre-gamma scenes to assumed_gamma = 1?] - discussion thread&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=Reference_Talk:Camera&amp;diff=9692</id>
		<title>Reference Talk:Camera</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=Reference_Talk:Camera&amp;diff=9692"/>
		<updated>2019-06-23T23:13:39Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Angles */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Aspect Ratio===&lt;br /&gt;
&amp;lt;p&amp;gt;Together the &amp;lt;code&amp;gt;right&amp;lt;/code&amp;gt; &amp;lt;em&amp;gt;(width)&amp;lt;/em&amp;gt; and &amp;lt;code&amp;gt;up&amp;lt;/code&amp;gt; &amp;lt;em&amp;gt;(height)&amp;lt;/em&amp;gt; vectors define the &amp;lt;em&amp;gt;aspect ratio&amp;lt;/em&amp;gt; of the resulting image.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A {{Change}} in version 3.8 redefines how the &amp;lt;code&amp;gt;right&amp;lt;/code&amp;gt; vector default is derived. Previously a fixed value, it is now a calculated value that is based on the image width and height specified at render time. As usual, the image width and height can be specified from either the pull down menu available in &amp;lt;em&amp;gt;GUI&amp;lt;/em&amp;gt; versions &amp;lt;em&amp;gt;ONLY&amp;lt;/em&amp;gt; or the &amp;lt;code&amp;gt;+Wn&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;+Hn&amp;lt;/code&amp;gt; command-line options available to &amp;lt;em&amp;gt;ALL&amp;lt;/em&amp;gt; versions. This behavior is conditional upon the &amp;lt;em&amp;gt;last&amp;lt;/em&amp;gt; effective &amp;lt;code&amp;gt;#version&amp;lt;/code&amp;gt; directive before the camera definition. The default &amp;lt;code&amp;gt;up&amp;lt;/code&amp;gt; vector remains as &amp;lt;code&amp;gt;&amp;amp;lt;0,1,0&amp;amp;gt;&amp;lt;/code&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;To retain legacy behavior see the example below:&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#version X.y; // X.y is a version less than 3.8&lt;br /&gt;
camera {&lt;br /&gt;
  location &amp;amp;lt;3,5,-10&amp;amp;gt;&lt;br /&gt;
  look_at &amp;amp;lt;0,2,1&amp;amp;gt;&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Angles ==&lt;br /&gt;
&lt;br /&gt;
Might want to re-mention in the Angles section that the default angle is ~67.380. [[User:SharkD|SharkD]] 23:13, 23 June 2019 (UTC)&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9681</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9681"/>
		<updated>2019-05-28T18:31:11Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Steps */ edit link description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup. Make sure to grab the script from the latest post.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
Note that the direction of the y axis in GeoGebra is reversed when compared to most image editing programs. You will need to compensate for this by multiplying each of the y values by -1.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9680</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9680"/>
		<updated>2019-05-28T18:28:16Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Steps */ clarify text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
Note that the direction of the y axis in GeoGebra is reversed when compared to most image editing programs. You will need to compensate for this by multiplying each of the y values by -1.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:High_precision_heightfields&amp;diff=9679</id>
		<title>HowTo:High precision heightfields</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:High_precision_heightfields&amp;diff=9679"/>
		<updated>2019-05-28T18:07:54Z</updated>

		<summary type="html">&lt;p&gt;SharkD: Point of view&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Overview===&lt;br /&gt;
The following is a tentative method of generating 24- and 32-bit heightfields in POV-Ray using standard raster image output formats such as PNG. It is based on some discussion that occurred in povray.general toward the end of 2008.&lt;br /&gt;
&lt;br /&gt;
The technique involves encoding different levels of heightfield precision in each color channel. The first 8 bits of precision are in the blue channel; the second 8 bits in the green channel; and the third 8 bits in the red channel. The channels are then concatenated to produce a single 24 bit number.&lt;br /&gt;
&lt;br /&gt;
The benefit of this technique is that it results in standard 24-bit bitmaps that can be imported into regular image editing software. (By regular image editing software, I actually mean Photoshop and a few other select programs. More on that below.) I think that [http://www.daylongraphics.com/products/leveller/ Leveller] uses this format to export its heightfields. Of course, this technique can be extended to 32 bits as well (as you'll see below).&lt;br /&gt;
&lt;br /&gt;
===Sample code===&lt;br /&gt;
A sample scene with the 24-bit function applied as a pigment to a one-unit-high cone is as follows. You should be able to render the scene and import the resulting image back into POV-Ray to generate a new heightfield.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
camera&lt;br /&gt;
{&lt;br /&gt;
	orthographic&lt;br /&gt;
	location	-z * 10&lt;br /&gt;
	direction	+z&lt;br /&gt;
	up		+y * 2&lt;br /&gt;
	right		+x * 2 * image_width/image_height&lt;br /&gt;
	rotate		+x * 90&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local hf_pigment_function_pow = function&lt;br /&gt;
{&lt;br /&gt;
	y * pow(256,3)&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_function_b = function&lt;br /&gt;
{&lt;br /&gt;
	mod(hf_pigment_function_pow(x,y,z), pow(256,1))&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_function_g = function&lt;br /&gt;
{&lt;br /&gt;
	mod(hf_pigment_function_pow(x,y,z)&lt;br /&gt;
	- hf_pigment_function_b(x,y,z), pow(256,2))&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_function_r = function&lt;br /&gt;
{&lt;br /&gt;
	mod(hf_pigment_function_pow(x,y,z)&lt;br /&gt;
	- hf_pigment_function_b(x,y,z)&lt;br /&gt;
	- hf_pigment_function_g(x,y,z), pow(256,3))&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local hf_pigment_b = pigment&lt;br /&gt;
{&lt;br /&gt;
	function {hf_pigment_function_b(x,y,z) / pow(256,1)}&lt;br /&gt;
	color_map {[0 rgb 0][1 rgb z * 3]}&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_g = pigment&lt;br /&gt;
{&lt;br /&gt;
	function {hf_pigment_function_g(x,y,z) / pow(256,2)}&lt;br /&gt;
	color_map {[0 rgb 0][1 rgb y * 3]}&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_r = pigment&lt;br /&gt;
{&lt;br /&gt;
	function {hf_pigment_function_r(x,y,z) / pow(256,3)}&lt;br /&gt;
	color_map {[0 rgb 0][1 rgb x * 3]}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// This is the one you want&lt;br /&gt;
#local hf_pigment_rgb = pigment&lt;br /&gt;
{&lt;br /&gt;
	average&lt;br /&gt;
	pigment_map&lt;br /&gt;
	{&lt;br /&gt;
		[hf_pigment_b]&lt;br /&gt;
		[hf_pigment_g]&lt;br /&gt;
		[hf_pigment_r]&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
cone&lt;br /&gt;
{&lt;br /&gt;
	0, 1, y, 0&lt;br /&gt;
	texture&lt;br /&gt;
	{&lt;br /&gt;
		pigment	{hf_pigment_rgb}&lt;br /&gt;
		finish {ambient 1}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 32-bit version of the function (which I haven't tested by importing back into POV-Ray yet) is as follows. Make sure to turn on the alpha channel in the output image by modifying the corresponding INI setting.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
camera&lt;br /&gt;
{&lt;br /&gt;
	orthographic&lt;br /&gt;
	location	-z * 10&lt;br /&gt;
	direction	+z&lt;br /&gt;
	up		+y * 2&lt;br /&gt;
	right		+x * 2 * image_width/image_height&lt;br /&gt;
	rotate		+x * 90&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local hf_pigment_function_pow = function&lt;br /&gt;
{&lt;br /&gt;
	y * pow(256,4)&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_function_t = function&lt;br /&gt;
{&lt;br /&gt;
	mod(hf_pigment_function_pow(x,y,z), pow(256,1))&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_function_b = function&lt;br /&gt;
{&lt;br /&gt;
	mod(hf_pigment_function_pow(x,y,z)&lt;br /&gt;
	- hf_pigment_function_t(x,y,z), pow(256,2))&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_function_g = function&lt;br /&gt;
{&lt;br /&gt;
	mod(hf_pigment_function_pow(x,y,z)&lt;br /&gt;
	- hf_pigment_function_t(x,y,z)&lt;br /&gt;
	- hf_pigment_function_b(x,y,z), pow(256,3))&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_function_r = function&lt;br /&gt;
{&lt;br /&gt;
	mod(hf_pigment_function_pow(x,y,z)&lt;br /&gt;
	- hf_pigment_function_t(x,y,z)&lt;br /&gt;
	- hf_pigment_function_b(x,y,z)&lt;br /&gt;
	- hf_pigment_function_g(x,y,z), pow(256,4))&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local hf_pigment_t = pigment&lt;br /&gt;
{&lt;br /&gt;
	function {hf_pigment_function_t(x,y,z) / pow(256,1)}&lt;br /&gt;
	color_map {[0 rgbt 0][1 rgbt &amp;lt;0,0,0,4,&amp;gt;]}&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_b = pigment&lt;br /&gt;
{&lt;br /&gt;
	function {hf_pigment_function_b(x,y,z) / pow(256,2)}&lt;br /&gt;
	color_map {[0 rgbt 0][1 rgbt &amp;lt;0,0,4,0,&amp;gt;]}&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_g = pigment&lt;br /&gt;
{&lt;br /&gt;
	function {hf_pigment_function_g(x,y,z) / pow(256,3)}&lt;br /&gt;
	color_map {[0 rgbt 0][1 rgbt &amp;lt;0,4,0,0,&amp;gt;]}&lt;br /&gt;
}&lt;br /&gt;
#local hf_pigment_r = pigment&lt;br /&gt;
{&lt;br /&gt;
	function {hf_pigment_function_r(x,y,z) / pow(256,4)}&lt;br /&gt;
	color_map {[0 rgbt 0][1 rgbt &amp;lt;4,0,0,0,&amp;gt;]}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// This is the one you want&lt;br /&gt;
#local hf_pigment_rgbt = pigment&lt;br /&gt;
{&lt;br /&gt;
	average&lt;br /&gt;
	pigment_map&lt;br /&gt;
	{&lt;br /&gt;
		[hf_pigment_t]&lt;br /&gt;
		[hf_pigment_b]&lt;br /&gt;
		[hf_pigment_g]&lt;br /&gt;
		[hf_pigment_r]&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
cone&lt;br /&gt;
{&lt;br /&gt;
	0, 1, y, 0&lt;br /&gt;
	open&lt;br /&gt;
	texture&lt;br /&gt;
	{&lt;br /&gt;
		pigment	{hf_pigment_rgbt}&lt;br /&gt;
		finish {ambient 1}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues===&lt;br /&gt;
You may notice that when importing the rendered image back into POV-Ray as a heightfield, the heightfield looks less smooth than it really should. This is not due to a deficiency in the technique as far as I can tell, but probably rather due to the gamut POV-Ray (as well as most image editing programs, but excluding Photoshop and a few others) uses when outputting bitmap images. This issue is discussed in more detail [http://www.bundysoft.com/phpBB2/viewtopic.php?t=639 here]. Heightfield images outputted by Leveller don't seem to suffer from this problem, and I suspect the 16-bit &amp;quot;hf_gray_16&amp;quot; format already natively supported by POV-Ray gets around this issue somehow as well.&lt;br /&gt;
&lt;br /&gt;
Criticisms of this technique include:&lt;br /&gt;
*While such images are easy to view in standard imaging software, they are more difficult to modify than a simple grayscale image.&lt;br /&gt;
*Such a high level of precision is unnecessary. 16-bit heightfields should be more than sufficient.&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9594</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9594"/>
		<updated>2018-09-01T13:05:16Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ tweak description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
Note that the direction of the y axis in GeoGebra is reversed when compared to most image editing programs. You will need to compensate for this by multiplying each of the y values by -1.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9593</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9593"/>
		<updated>2018-09-01T13:04:41Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like. (Note that the direction of the y axis in GeoGebra is reversed when compared to most image editing programs. You will need to compensate for this by multiplying each of the y values by -1.)&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9592</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9592"/>
		<updated>2018-09-01T13:03:48Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ reword&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like. (Note that the direction of the y axis in GeoGebra is reversed when compared to most image editing programs. You will need to compensate for this by multiplying each y value by -1.)&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9591</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9591"/>
		<updated>2018-09-01T13:00:49Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ edit description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like. (Note that the direction of the y axis in GeoGebra is reversed when compared to most image editing programs. You will need to compensate for this by using negative y values instead of positive ones.)&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9590</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9590"/>
		<updated>2018-09-01T13:00:07Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ edit description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like. (Note that the direction of the y axis in GeoGebra is reversed when compared to most image editing programs. You will need to compensate for this.)&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9589</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9589"/>
		<updated>2018-09-01T12:59:24Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ note about y axis&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like. (Note that the direction of the y axis in GeoGebra is reversed when compared to most image editing programs.)&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9588</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9588"/>
		<updated>2018-09-01T12:57:12Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ edit description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well! The &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function makes this possible.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9587</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9587"/>
		<updated>2018-09-01T12:55:51Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Introduction */ edit description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the anti-spam captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9586</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9586"/>
		<updated>2018-09-01T12:55:07Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Introduction */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this wiki is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9585</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9585"/>
		<updated>2018-09-01T12:51:18Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of additional transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9584</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9584"/>
		<updated>2018-09-01T12:43:51Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ edit description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera and a series of transforms:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9583</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9583"/>
		<updated>2018-09-01T12:41:55Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Introduction */ edit lead&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape for this purpose as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Contents&amp;diff=9582</id>
		<title>HowTo:Contents</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Contents&amp;diff=9582"/>
		<updated>2018-09-01T12:41:01Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Special output in POV-Ray */ edit article title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is a list of the currently-available and wished for 'How To' articles. If you add a new article, please list and link it here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p class=&amp;quot;Note&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Note:&amp;lt;/strong&amp;gt; Some of the older articles, written while 3.7.0 was being developed, are in need of update.&amp;lt;/p&amp;gt;    &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Please read our '''[[Help:Editing_Guidelines|Editing Guidelines]]''' prior to creating any articles.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Discussions about this page should be held on the [[HowTo_Talk:Contents|talk]] page, not here.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Subject Areas==&lt;br /&gt;
&lt;br /&gt;
====Animating your creations====&lt;br /&gt;
*[[HowTo:Create animations | How to: Create animations]]&lt;br /&gt;
*[[HowTo:Create more complex animations | How to: Create more complex animations]]&lt;br /&gt;
*[[HowTo:Animation pitfalls | How to: Animation pitfalls]]&lt;br /&gt;
*[[HowTo:Encode animations as Ogg Theora Video | How to: Encode animations as Ogg Theora Video]]  (A non-proprietary video file format)&lt;br /&gt;
&lt;br /&gt;
====Lighting====&lt;br /&gt;
*[[HowTo:Make soft shadows using the area_light | How to: Make soft shadows using the area_light]]&lt;br /&gt;
*[[HowTo:Use radiosity | How to: Simulate real-world ambient light]]&lt;br /&gt;
*[[HowTo:Use photons | How to: Simulate real-world optical effects]]&lt;br /&gt;
*[[HowTo:Make realistic outdoor lighting | How to: Make realistic outdoor lighting]]&lt;br /&gt;
*[[HowTo:Make realistic indoor lighting | How to: Make realistic indoor lighting]]&lt;br /&gt;
&lt;br /&gt;
====Modeling====&lt;br /&gt;
*[[HowTo:Use POV-Ray with Blender | How to: Use POV-Ray with Blender]]&lt;br /&gt;
&lt;br /&gt;
====Objects====&lt;br /&gt;
*[[HowTo:Use constructive solid geometry | How to: Use constructive solid geometry]]&lt;br /&gt;
*[[HowTo:Use the blob object | How to: Use the blob object]]&lt;br /&gt;
*[[HowTo:Use the isosurface object | How to: Use the isosurface object]]&lt;br /&gt;
*[[HowTo:Use the lathe object | How to: Use the lathe object]]&lt;br /&gt;
*[[HowTo:Use the plane object | How to: Use the plane object]]&lt;br /&gt;
*[[HowTo:Use spline and bezier curves | How to: Use spline and bezier curves]]&lt;br /&gt;
&lt;br /&gt;
====Scene Description Language====&lt;br /&gt;
*[[HowTo:Manage your variables | How to: Manage your variables]]&lt;br /&gt;
*[[HowTo:Use conditional structures | How to: Use conditional structures]]&lt;br /&gt;
*[[HowTo:Use macros and loops | How to: Use macros and loops]]&lt;br /&gt;
*[[HowTo:Use for loop over traditional while loop | How to: Use for loop over traditional while loop]]&lt;br /&gt;
&lt;br /&gt;
====Scenes in POV-Ray====&lt;br /&gt;
*[[HowTo:Build a basic scene | How to: Build a basic scene]]&lt;br /&gt;
*[[HowTo:Plan your scenes | How to: Plan your scenes]]&lt;br /&gt;
*[http://www.buckosoft.com/povclipse2 How to use PovClipse2 : An Eclipse plugin to manage POV-Ray source] &lt;br /&gt;
*[[HowTo:Place objects on another object | Place objects on another object]]&lt;br /&gt;
&lt;br /&gt;
====Special effects in POV-Ray====&lt;br /&gt;
*[[HowTo:Use fog and media | How to: Use fog and media]]&lt;br /&gt;
*[[HowTo:Use photons | How to: Use photons]]&lt;br /&gt;
*[[HowTo:Use radiosity | How to: Use radiosity]]&lt;br /&gt;
*[[HowTo:Use sky_sphere and background | How to: Use sky_sphere and background]]&lt;br /&gt;
*[http://www.ldraw.org/Article528.html How to: Render LDraw scenes for polarized glasses] (off site, needs to be re-written in more general terms that are not LDraw-specific)&lt;br /&gt;
*[[HowTo:Manual focal blur | How to create focal blur manually]]&lt;br /&gt;
&lt;br /&gt;
====Special input in POV-Ray====&lt;br /&gt;
*[[HowTo:Use SVG images as the basis for prisms and lathes | How to: Use SVG images as the basis for prisms and lathes]]&lt;br /&gt;
&lt;br /&gt;
====Special output in POV-Ray====&lt;br /&gt;
*[[HowTo:Create anaglyph images                 | How to: Create anaglyph images]]&lt;br /&gt;
*[[HowTo:High precision heightfields            | How to: Create high precision heightfields using POV-Ray]]&lt;br /&gt;
*[[HowTo:Create images for use as a heightfield | How to: Create images for use as a heightfield]]&lt;br /&gt;
*[[HowTo:Create multi-phase web buttons         | How to: Create multi-phase web buttons]]&lt;br /&gt;
*[[HowTo:ODS                                    | How to: Create omni­directional stereo (ODS) images]]&lt;br /&gt;
*[[HowTo:Extract 2D screen coordinates from 3D scenes          | How to: Extract 2D screen coordinates from 3D scenes]]&lt;br /&gt;
&lt;br /&gt;
====Texturing====&lt;br /&gt;
*[[HowTo:Use UV-mapping | How to: Use UV-mapping]]&lt;br /&gt;
*[[HowTo:Use an image as a texture | How to: Use an image as a texture]]&lt;br /&gt;
*[[HowTo:Turn a continuous function into a stepped function | How to: Turn a continuous function into a stepped function]]&lt;br /&gt;
&lt;br /&gt;
==== Working with POV-Ray ====&lt;br /&gt;
Tips to get the most out of POV-ray:&lt;br /&gt;
*[[HowTo:Fix old scenes to work with the new gamma system | How to: Fix old scenes to work with the new gamma system]]&lt;br /&gt;
*[[HowTo:Install multiple versions of POV-Ray | How to: Install multiple versions of POV-Ray]]&lt;br /&gt;
*[[HowTo:Configure your favorite text editor to work with POV-Ray| How to: Configure your favorite text editor to work with POV-Ray]]&lt;br /&gt;
&lt;br /&gt;
=====POV-Ray for Microsoft Windows=====&lt;br /&gt;
*[[HowTo:Take full advantage of the Insert menu | How to: Take full advantage of the Insert menu]]&lt;br /&gt;
&lt;br /&gt;
==POV-Ray troubleshooting==&lt;br /&gt;
This section is for software problems with POV-Ray.  If you are trying to figure out why your scene isn't rendering as expected, see [[HowTo:Contents#Troubleshooting your scene|Troubleshooting Your Scene]].&lt;br /&gt;
*Installation Troubleshooting currently via [http://news.povray.org/groups/ newsgroups]. &lt;br /&gt;
*[[HowTo:Known Issues | Known Issues and Possible Work-arounds]]&lt;br /&gt;
*[[HowTo:Make A Bug Report | How to make a Bug Report]]&lt;br /&gt;
*[[HowTo:POV-Ray Feature Requests | How to make a feature request]]&lt;br /&gt;
&lt;br /&gt;
====Troubleshooting your scene====&lt;br /&gt;
This section is for figuring out why your scene isn't rendering as expected.  For problems related to installation or removal of POV-Ray, updates, crashes, or other software-related issues, see [[#POV-Ray troubleshooting | POV-Ray troubleshooting]].&lt;br /&gt;
*[[HowTo:Fix unexpected image output | Why is my image completely black?]]&lt;br /&gt;
*[[HowTo:Fix unexpected invisibility#Objects | Why aren't all of my objects showing up?]]&lt;br /&gt;
*[[HowTo:Fix unexpected invisibility#Media | Why doesn't my fog or other media show up?]]&lt;br /&gt;
*[[HowTo:Fix artifacts#Coincident surfaces | What are all of these weird speckles on my object?]]&lt;br /&gt;
*[[HowTo:Fix artifacts#Isosurfaces | What is the best way to fix holes in my isosurface?]]&lt;br /&gt;
*[[HowTo:Fix artifacts#Floating-point expressions | Why are my expressions not evaluating to 1 (or some other integer)?]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Output_2D_screen_coordinates&amp;diff=9581</id>
		<title>HowTo:Output 2D screen coordinates</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Output_2D_screen_coordinates&amp;diff=9581"/>
		<updated>2018-09-01T12:40:17Z</updated>

		<summary type="html">&lt;p&gt;SharkD: moved HowTo:Output 2D screen coordinates to HowTo:Extract 2D screen coordinates from 3D scenes: Tutorial not really about &amp;quot;exporting&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[HowTo:Extract 2D screen coordinates from 3D scenes]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9580</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9580"/>
		<updated>2018-09-01T12:40:17Z</updated>

		<summary type="html">&lt;p&gt;SharkD: moved HowTo:Output 2D screen coordinates to HowTo:Extract 2D screen coordinates from 3D scenes: Tutorial not really about &amp;quot;exporting&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9579</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9579"/>
		<updated>2018-09-01T12:39:03Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Steps */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image or mathematics program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9578</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9578"/>
		<updated>2018-09-01T12:37:28Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ tweak long string&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9577</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9577"/>
		<updated>2018-09-01T12:37:06Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ tweak long string&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
// requires the latest version appearing in this thread:&lt;br /&gt;
// http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=File:czech_hedge_hog_vector.png&amp;diff=9576</id>
		<title>File:czech hedge hog vector.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=File:czech_hedge_hog_vector.png&amp;diff=9576"/>
		<updated>2018-09-01T12:35:08Z</updated>

		<summary type="html">&lt;p&gt;SharkD: uploaded a new version of &amp;amp;quot;File:czech hedge hog vector.png&amp;amp;quot;: Use orthographic camera.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SVG image is not displaying, so here's a PNG version.&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=File:czech_hedge_hog.png&amp;diff=9575</id>
		<title>File:czech hedge hog.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=File:czech_hedge_hog.png&amp;diff=9575"/>
		<updated>2018-09-01T12:34:41Z</updated>

		<summary type="html">&lt;p&gt;SharkD: uploaded a new version of &amp;amp;quot;File:czech hedge hog.png&amp;amp;quot;: Use orthographic camera.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Result of rendering a tutorial's sample scene.&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9574</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9574"/>
		<updated>2018-09-01T12:29:57Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Steps */ spelling/grammar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, as well as input values that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9573</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9573"/>
		<updated>2018-09-01T12:27:21Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ edit description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a very simple sample scene I created for this tutorial, using a perspective camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9572</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9572"/>
		<updated>2018-09-01T12:26:51Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ edit description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial, this time using an orthographic camera:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
// orthographic camera&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9571</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9571"/>
		<updated>2018-09-01T12:25:55Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ use one camera per sample scene&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
// perspective camera&lt;br /&gt;
#local cam_dist = 12;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 300&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9570</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9570"/>
		<updated>2018-09-01T12:16:53Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ exclamation mark&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well!&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9569</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9569"/>
		<updated>2018-09-01T12:15:44Z</updated>

		<summary type="html">&lt;p&gt;SharkD: fix links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/thread/%3C5b889a96%40news.povray.org%3E/&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9568</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9568"/>
		<updated>2018-09-01T12:10:47Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;transform&amp;lt;/tt&amp;gt; block and the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9567</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9567"/>
		<updated>2018-09-01T12:10:18Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the many instances of the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the ''same'' transformations to your point coordinates as well.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=File:screen_cube_vector.png&amp;diff=9566</id>
		<title>File:screen cube vector.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=File:screen_cube_vector.png&amp;diff=9566"/>
		<updated>2018-09-01T12:09:03Z</updated>

		<summary type="html">&lt;p&gt;SharkD: uploaded a new version of &amp;amp;quot;File:screen cube vector.png&amp;amp;quot;: Use newer version of Geogebra.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Another image for the tutorial.&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9565</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9565"/>
		<updated>2018-09-01T12:03:08Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #2 */ tweak code a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the several instances of the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the *same* transformations to the points as well.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9564</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9564"/>
		<updated>2018-09-01T12:01:35Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene #1 */ add image&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube vector.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.6&lt;br /&gt;
// Desc: Trigonometry and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the updated version available here: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the several instances of the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the *same* transformations to the points as well.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=File:screen_cube_vector.png&amp;diff=9563</id>
		<title>File:screen cube vector.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=File:screen_cube_vector.png&amp;diff=9563"/>
		<updated>2018-09-01T12:00:30Z</updated>

		<summary type="html">&lt;p&gt;SharkD: Another image for the tutorial.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Another image for the tutorial.&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9562</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9562"/>
		<updated>2018-09-01T11:49:48Z</updated>

		<summary type="html">&lt;p&gt;SharkD: add image #3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:screen cube.png]]&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.6&lt;br /&gt;
// Desc: Trigonometry and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the updated version available here: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the several instances of the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the *same* transformations to the points as well.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=File:screen_cube.png&amp;diff=9561</id>
		<title>File:screen cube.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=File:screen_cube.png&amp;diff=9561"/>
		<updated>2018-09-01T11:48:30Z</updated>

		<summary type="html">&lt;p&gt;SharkD: Another image used in the &amp;quot;screen.inc&amp;quot; tutorial.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Another image used in the &amp;quot;screen.inc&amp;quot; tutorial.&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9560</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9560"/>
		<updated>2018-09-01T11:47:24Z</updated>

		<summary type="html">&lt;p&gt;SharkD: sample 2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #2==&lt;br /&gt;
&lt;br /&gt;
Here is another sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: czech_hedge_hog.pov&lt;br /&gt;
// Vers: 3.6&lt;br /&gt;
// Desc: Trigonometry and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;colors.inc&amp;quot;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the updated version available here: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric (axonometric)&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_move = 1/2;&lt;br /&gt;
		#local cam_area = 2;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 045&lt;br /&gt;
			translate	+y * cam_move&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
sky_sphere {&lt;br /&gt;
  pigment {&lt;br /&gt;
    gradient y&lt;br /&gt;
    color_map {&lt;br /&gt;
      [0.0 rgb &amp;lt;0.6,0.7,1.0&amp;gt;]&lt;br /&gt;
      [0.7 rgb &amp;lt;0.0,0.1,0.8&amp;gt;]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ----------------------------------------&lt;br /&gt;
&lt;br /&gt;
plane {&lt;br /&gt;
  +y, 0&lt;br /&gt;
  pigment {&lt;br /&gt;
  	checker&lt;br /&gt;
  	pigment {Gray}&lt;br /&gt;
  	pigment {White}&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#local TempAngle = pi/2 - atan(1/cos(pi/4));&lt;br /&gt;
#local TempTrans = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * 45&lt;br /&gt;
	rotate		+z * degrees(TempAngle)&lt;br /&gt;
	translate	+y * sin(TempAngle)&lt;br /&gt;
	translate	+y * 1/10&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
union {&lt;br /&gt;
	cylinder {-x,+x,0.1 pigment {Red}}&lt;br /&gt;
	cylinder {-y,+y,0.1 pigment {Green}}&lt;br /&gt;
	cylinder {-z,+z,0.1 pigment {Blue}}&lt;br /&gt;
	transform {TempTrans}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = vtransform(-x, TempTrans);&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = vtransform(+x, TempTrans);&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {Cyan}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = vtransform(-y, TempTrans);&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = vtransform(+y, TempTrans);&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {Magenta}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = vtransform(-z, TempTrans);&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = vtransform(+z, TempTrans);&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {Yellow}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. Note the several instances of the &amp;lt;tt&amp;gt;vtransform&amp;lt;/tt&amp;gt; function. If you apply transformations to objects in your scene, then you're likely going to need to apply the *same* transformations to the points as well.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9559</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9559"/>
		<updated>2018-09-01T11:44:16Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Result */ merge sections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. You should be able to confirm in an 2D image editor that the measurements the script made are the correct ones.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
	<entry>
		<id>https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9558</id>
		<title>HowTo:Extract 2D screen coordinates from 3D scenes</title>
		<link rel="alternate" type="text/html" href="https://wiki.povray.org/content?title=HowTo:Extract_2D_screen_coordinates_from_3D_scenes&amp;diff=9558"/>
		<updated>2018-09-01T11:43:56Z</updated>

		<summary type="html">&lt;p&gt;SharkD: /* Sample Scene */ #1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
At some point in your POV-Ray career you may need to retrieve high precision 2D screen coordinates of a point in a 3D POV-Ray render. Simply measuring the number of pixels in MS Paint is rarely a good solution because the precision is too low, even for very large renders. Instead, you need to use POV-Ray's own mechanisms to calculate and output finer measurements.&lt;br /&gt;
&lt;br /&gt;
I faced this problem when designing two images for Wikipedia. For the first image, I needed to overlay 2D vector elements on top of a 3D POV-Ray render in order to show a series of measurements I made of important angles in the 3D bitmap. For the second image, I used the points outputted from a POV-Ray render to create a brand new 2D vector image from scratch. In both cases I used GeoGebra to create the 2D vector elements, but you could use InkScape as well.&lt;br /&gt;
&lt;br /&gt;
(The first image is named &amp;quot;Graphical projection comparison.png&amp;quot;. The second image is named &amp;quot;Various projections of cube above plane.svg&amp;quot;. I can't link to them from here because the captcha widget on this website is broken.)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
The first thing you will need to do is download the updated version of &amp;quot;screen.inc&amp;quot; I created several years back, and place it somewhere in your library path. (Again, I cannot link to the file, but the thread with the attachment is named &amp;quot;Updated screen.inc&amp;quot; and is located in the &amp;quot;povray.text.scene-files&amp;quot; newsgroup.) Once you have copied the script file to the correct directory, you will need to include it in your scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next step is to reconfigure your camera code to make it compatible with &amp;quot;screen.inc&amp;quot;. Here is some camera code I created for a test scene:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_look = 0;&lt;br /&gt;
#local cam_angl = 45;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(30))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(false)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The updated script can also handle orthographic renders, and input vulues that take the form of ''location'', ''direction'', ''up'' and ''right'' instead of ''location'', ''look_at'', ''angle'' and ''sky''. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local cam_aspc = image_width/image_height;&lt;br /&gt;
#local cam_dist = 8;&lt;br /&gt;
#local cam_move = 1/2;&lt;br /&gt;
#local cam_area = 2;&lt;br /&gt;
#local cam_loca = -z * cam_dist;&lt;br /&gt;
#local cam_dirc = +z;&lt;br /&gt;
#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
#local cam_upvc = +y * cam_area;&lt;br /&gt;
#local cam_tran = transform&lt;br /&gt;
{&lt;br /&gt;
	rotate		+x * asind(tand(030))&lt;br /&gt;
	rotate		+y * 045&lt;br /&gt;
	translate	+y * cam_move&lt;br /&gt;
}&lt;br /&gt;
Set_Camera_Orthographic(true)&lt;br /&gt;
Set_Camera_Transform(cam_tran)&lt;br /&gt;
Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From that point onward, all you need to do is choose which 3D points you want to capture and output them as 2D screen coordinates. For instance, maybe there is a light source in your scene that you want to record the 2D position of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_3d = &amp;lt;+30, +30, -30&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
light_source&lt;br /&gt;
{&lt;br /&gt;
	light_location_3d&lt;br /&gt;
	color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
	parallel&lt;br /&gt;
	point_at 0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have the 3D coordinates, just plug them into the ''Get_Screen_XY'' macro, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#local light_location_2d = Get_Screen_XY(light_location_3d);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and send the result to the Messages window like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#debug concat(&amp;quot;light_location_2d = (&amp;quot;, vstr(2, light_location_2d, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you render the scene, additional text will appear in the Messages window, looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
light_location_2d = (205.036679,371.407180)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now use these coordinates to place 2D objects in a vector image program such as GeoGebra or InkScape.&lt;br /&gt;
&lt;br /&gt;
==Sample Scene #1==&lt;br /&gt;
&lt;br /&gt;
Here is a sample scene I created for this tutorial:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Persistence of Vision Ray Tracer Scene Description File&lt;br /&gt;
// This file is licensed under the terms of the CC-LGPL.&lt;br /&gt;
// File: screen_cube.pov&lt;br /&gt;
// Vers: 3.7&lt;br /&gt;
// Desc: Screen and camera test&lt;br /&gt;
// Date: 08/30/2018&lt;br /&gt;
// Updt: 09/01/2018&lt;br /&gt;
// Auth: Michael Horvath&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#version 3.7;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;screen.inc&amp;quot;		// requires the latest version appearing in this thread: http://news.povray.org/povray.text.scene-files/message/%3C5b889a96%40news.povray.org%3E/#%3C5b889a96%40news.povray.org%3E&lt;br /&gt;
&lt;br /&gt;
global_settings {&lt;br /&gt;
  assumed_gamma 1.0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
#local cam_view = 0;&lt;br /&gt;
&lt;br /&gt;
#switch (cam_view)&lt;br /&gt;
	#case (0)	// perspective&lt;br /&gt;
		#local cam_dist = 12;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_look = 0;&lt;br /&gt;
		#local cam_angl = 45;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(30))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(false)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera(cam_loca, cam_look, cam_angl)&lt;br /&gt;
	#break&lt;br /&gt;
	#case (1)	// isometric&lt;br /&gt;
		#local cam_aspc = image_width/image_height;&lt;br /&gt;
		#local cam_dist = 8;&lt;br /&gt;
		#local cam_area = 4;&lt;br /&gt;
		#local cam_loca = -z * cam_dist;&lt;br /&gt;
		#local cam_dirc = +z;&lt;br /&gt;
		#local cam_rgvc = +x * cam_area * cam_aspc;&lt;br /&gt;
		#local cam_upvc = +y * cam_area;&lt;br /&gt;
		#local cam_tran = transform&lt;br /&gt;
		{&lt;br /&gt;
			rotate		+x * asind(tand(030))&lt;br /&gt;
			rotate		+y * 300&lt;br /&gt;
		}&lt;br /&gt;
		Set_Camera_Orthographic(true)&lt;br /&gt;
		Set_Camera_Transform(cam_tran)&lt;br /&gt;
		Set_Camera_Alt(cam_loca, cam_dirc, cam_rgvc, cam_upvc)&lt;br /&gt;
	#break&lt;br /&gt;
#end&lt;br /&gt;
&lt;br /&gt;
background {color srgb &amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;0, 0, 0&amp;gt;&lt;br /&gt;
  color rgb &amp;lt;1, 1, 1&amp;gt;&lt;br /&gt;
  translate &amp;lt;+30, +30, -30&amp;gt;&lt;br /&gt;
  rotate y * 30&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// -------------------------------------&lt;br /&gt;
&lt;br /&gt;
box {&lt;br /&gt;
	&amp;lt;-1,-1,-1&amp;gt;, &amp;lt;+1,+1,+1&amp;gt;&lt;br /&gt;
	pigment {&lt;br /&gt;
		color srgbt &amp;lt;1,1,1,1/4&amp;gt;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_1 = &amp;lt;+1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_1 = Get_Screen_XY(SphereLoc_1);&lt;br /&gt;
sphere {SphereLoc_1, 0.1 pigment {color srgb SphereLoc_1}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_1 = (&amp;quot;, vstr(2, ScreenLoc_1, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_2 = &amp;lt;+1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_2 = Get_Screen_XY(SphereLoc_2);&lt;br /&gt;
sphere {SphereLoc_2, 0.1 pigment {color srgb SphereLoc_2}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_2 = (&amp;quot;, vstr(2, ScreenLoc_2, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_3 = &amp;lt;+1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_3 = Get_Screen_XY(SphereLoc_3);&lt;br /&gt;
sphere {SphereLoc_3, 0.1 pigment {color srgb SphereLoc_3}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_3 = (&amp;quot;, vstr(2, ScreenLoc_3, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_4 = &amp;lt;+1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_4 = Get_Screen_XY(SphereLoc_4);&lt;br /&gt;
sphere {SphereLoc_4, 0.1 pigment {color srgb SphereLoc_4}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_4 = (&amp;quot;, vstr(2, ScreenLoc_4, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_5 = &amp;lt;-1,+1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_5 = Get_Screen_XY(SphereLoc_5);&lt;br /&gt;
sphere {SphereLoc_5, 0.1 pigment {color srgb SphereLoc_5}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_5 = (&amp;quot;, vstr(2, ScreenLoc_5, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_6 = &amp;lt;-1,+1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_6 = Get_Screen_XY(SphereLoc_6);&lt;br /&gt;
sphere {SphereLoc_6, 0.1 pigment {color srgb SphereLoc_6}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_6 = (&amp;quot;, vstr(2, ScreenLoc_6, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_7 = &amp;lt;-1,-1,+1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_7 = Get_Screen_XY(SphereLoc_7);&lt;br /&gt;
sphere {SphereLoc_7, 0.1 pigment {color srgb SphereLoc_7}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_7 = (&amp;quot;, vstr(2, ScreenLoc_7, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#local SphereLoc_8 = &amp;lt;-1,-1,-1&amp;gt;;&lt;br /&gt;
#local ScreenLoc_8 = Get_Screen_XY(SphereLoc_8);&lt;br /&gt;
sphere {SphereLoc_8, 0.1 pigment {color srgb SphereLoc_8}}&lt;br /&gt;
#debug concat(&amp;quot;ScreenLoc_8 = (&amp;quot;, vstr(2, ScreenLoc_8, &amp;quot;,&amp;quot;, 0, -1), &amp;quot;)\n&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#debug &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Result==&lt;br /&gt;
&lt;br /&gt;
Here is what a rendering of the above sample scene should look like:&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog.png]]&lt;br /&gt;
&lt;br /&gt;
The center points of the spheres at the end of each arm are the points I am recording. You should be able to confirm in an 2D image editor that the measurements the script made are the correct ones.&lt;br /&gt;
&lt;br /&gt;
SVG files are not working properly on this wiki, so here is a bitmap image of what a very simple GeoGebra image might look like.&lt;br /&gt;
&lt;br /&gt;
[[File:czech hedge hog vector.png]]&lt;/div&gt;</summary>
		<author><name>SharkD</name></author>
	</entry>
</feed>