Jason McKesson avatar Jason McKesson committed 0bcbd7f

All Tutorial 10 images complete.

Comments (0)

Files changed (12)

Add a comment to this file

Documents/Illumination/Blinn Lighting.png

Added
New image
Add a comment to this file

Documents/Illumination/Blinn vs Phong Compare.png

Added
New image
Add a comment to this file

Documents/Illumination/Gaussian Small Highlight.png

Added
New image
Add a comment to this file

Documents/Illumination/GaussianPlot.svg

Added
New image
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="300px" width="600px" >
+	<style type="text/css" ><![CDATA[.__grid1
+{
+	stroke: #CCC;
+	stroke-width: 1px;
+	fill: none;
+}
+
+.tall
+{
+	fill: none;
+	stroke: blue;
+}
+
+.short
+{
+	fill: none;
+	stroke: orange;
+}
+
+.__axis1
+{
+	stroke: black;
+	stroke-width: 2px;
+	fill: none;
+}
+
+.label
+{
+	font-family: monospace;
+	font-size: 14pt;
+	font-weight: bold;
+	stroke: none;
+	text-anchor: middle;
+	fill: black;
+}
+
+.legend_text
+{
+	font-family: monospace;
+	font-weight: bold;
+	stroke: none;
+	font-size: 14pt;
+	fill: black;
+}
+
+.vertex
+{
+	fill: black;
+	stroke: none;
+}
+
+.std_normal
+{
+	fill: none;
+	stroke: red;
+}
+
+.__axis_arrow_end1
+{
+	marker-end: url(#__axis_arrow1);
+}]]></style>
+	<defs >
+		<marker markerWidth="10" markerHeight="8" refX="10" refY="4" markerUnits="userSpaceOnUse" orient="auto" id="__axis_arrow1" >
+			<path d="M 10 4 L 0 0 L 0 8 Z" class="fill_black thin" />
+		</marker>
+		<g id="g_axes" >
+			<path d="M 0 300 V 0 M 30 300 V 0 M 60 300 V 0 M 90 300 V 0 M 120 300 V 0 M 150 300 V 0 M 180 300 V 0 M 210 300 V 0 M 240 300 V 0 M 270 300 V 0 M 300 300 V 0 M 330 300 V 0 M 360 300 V 0 M 390 300 V 0 M 420 300 V 0 M 450 300 V 0 M 480 300 V 0 M 510 300 V 0 M 540 300 V 0 M 570 300 V 0 M 600 300 V 0 M 0 300 H 600 M 0 270 H 600 M 0 240 H 600 M 0 210 H 600 M 0 180 H 600 M 0 150 H 600 M 0 120 H 600 M 0 90 H 600 M 0 60 H 600 M 0 30 H 600 M 0 0 H 600" class="__grid1" />
+			<line x2="300" y2="300" y1="270" x1="300" class="__axis1 __axis_arrow_end1" />
+			<line x2="300" y2="0" y1="270" x1="300" class="__axis1 __axis_arrow_end1" />
+			<line x2="600" y2="270" y1="270" x1="300" class="__axis1 __axis_arrow_end1" />
+			<line x2="0" y2="270" y1="270" x1="300" class="__axis1 __axis_arrow_end1" />
+		</g>
+	</defs>
+	<defs >
+		<g id="g_point" >
+			<circle r="4" cy="0" cx="0" class="vertex" />
+		</g>
+	</defs>
+	<use xlink:href="#g_axes" y="0" x="0" height="300" width="600" />
+	<path d="M -300 270 L -292.5 270 L -285 270 L -277.5 270 L -270 270 L -262.5 270 L -255 270 L -247.5 270 L -240 270 L -232.5 270 L -225 270 L -217.5 270 L -210 270 L -202.5 270 L -195 270 L -187.5 270 L -180 270 L -172.5 270 L -165 269.99999999999 L -157.5 269.99999999998 L -150 269.99999999994 L -142.5 269.99999999985 L -135 269.99999999963 L -127.5 269.99999999909 L -120 269.99999999781 L -112.5 269.99999999478 L -105 269.99999998777 L -97.5 269.99999997179 L -90 269.99999993593 L -82.5 269.99999985674 L -75 269.99999968464 L -67.5 269.99999931655 L -60 269.99999854179 L -52.5 269.99999693699 L -45 269.99999366582 L -37.5 269.99998710424 L -30 269.99997415258 L -22.5 269.99994899629 L -15 269.9999009167 L -7.5 269.99981049821 L 0 269.99964318732 L 7.5 269.99933857378 L 15 269.99879291825 L 22.5 269.99783126691 L 30 269.99616390213 L 37.5 269.99331983179 L 45 269.98854752723 L 52.5 269.98067029235 L 60 269.96788074582 L 67.5 269.94745640694 L 75 269.91537703623 L 82.5 269.86582523466 L 90 269.79055615319 L 97.5 269.67813147036 L 105 269.51302846625 L 112.5 269.27465807155 L 120 268.93635638113 L 127.5 268.46445112543 L 135 267.81754499962 L 142.5 266.94619641676 L 150 265.79320788154 L 157.5 264.29474380082 L 165 262.38248355944 L 172.5 259.98696353848 L 180 257.04216803683 L 187.5 253.49129380159 L 195 249.29344348164 L 202.5 244.43081564866 L 210 238.91577704019 L 217.5 232.79705629001 L 225 226.16421950663 L 232.5 219.14960501383 L 240 211.92702611541 L 247.5 204.70680038915 L 255 197.72701628285 L 262.5 191.24136754791 L 270 185.50432157657 L 277.5 180.75477747126 L 285 177.19965196732 L 292.5 174.99895513326 L 300 174.25385270366 L 307.5 174.99895513326 L 315 177.19965196732 L 322.5 180.75477747126 L 330 185.50432157657 L 337.5 191.24136754791 L 345 197.72701628285 L 352.5 204.70680038915 L 360 211.92702611541 L 367.5 219.14960501383 L 375 226.16421950663 L 382.5 232.79705629001 L 390 238.91577704019 L 397.5 244.43081564866 L 405 249.29344348164 L 412.5 253.49129380159 L 420 257.04216803683 L 427.5 259.98696353848 L 435 262.38248355944 L 442.5 264.29474380082 L 450 265.79320788154 L 457.5 266.94619641676 L 465 267.81754499962 L 472.5 268.46445112543 L 480 268.93635638113 L 487.5 269.27465807155 L 495 269.51302846625 L 502.5 269.67813147036 L 510 269.79055615319 L 517.5 269.86582523466 L 525 269.91537703623 L 532.5 269.94745640694 L 540 269.96788074582 L 547.5 269.98067029235 L 555 269.98854752723 L 562.5 269.99331983179 L 570 269.99616390213 L 577.5 269.99783126691 L 585 269.99879291825 L 592.5 269.99933857378 L 600 269.99964318732 L 607.5 269.99981049821 L 615 269.9999009167 L 622.5 269.99994899629 L 630 269.99997415258 L 637.5 269.99998710424 L 645 269.99999366582 L 652.5 269.99999693699 L 660 269.99999854179 L 667.5 269.99999931655 L 675 269.99999968464 L 682.5 269.99999985674 L 690 269.99999993593 L 697.5 269.99999997179 L 705 269.99999998777 L 712.5 269.99999999478 L 720 269.99999999781 L 727.5 269.99999999909 L 735 269.99999999963 L 742.5 269.99999999985 L 750 269.99999999994 L 757.5 269.99999999998 L 765 269.99999999999 L 772.5 270 L 780 270 L 787.5 270 L 795 270 L 802.5 270 L 810 270 L 817.5 270 L 825 270 L 832.5 270 L 840 270 L 847.5 270 L 855 270 L 862.5 270 L 870 270 L 877.5 270 L 885 270 L 892.5 270 L 900 270" class="std_normal" />
+	<path d="M -300 270 L -292.5 270 L -285 270 L -277.5 270 L -270 270 L -262.5 270 L -255 270 L -247.5 270 L -240 270 L -232.5 270 L -225 270 L -217.5 270 L -210 270 L -202.5 270 L -195 270 L -187.5 270 L -180 270 L -172.5 270 L -165 270 L -157.5 270 L -150 270 L -142.5 270 L -135 270 L -127.5 270 L -120 270 L -112.5 270 L -105 270 L -97.5 270 L -90 270 L -82.5 270 L -75 270 L -67.5 270 L -60 270 L -52.5 270 L -45 270 L -37.5 270 L -30 270 L -22.5 270 L -15 270 L -7.5 270 L 0 270 L 7.5 270 L 15 270 L 22.5 270 L 30 270 L 37.5 270 L 45 270 L 52.5 270 L 60 270 L 67.5 270 L 75 270 L 82.5 270 L 90 269.99999999999 L 97.5 269.99999999991 L 105 269.99999999927 L 112.5 269.99999999466 L 120 269.99999996378 L 127.5 269.99999977285 L 135 269.99999868257 L 142.5 269.99999293349 L 150 269.99996494459 L 157.5 269.99983916686 L 165 269.99931755639 L 172.5 269.99732188785 L 180 269.99028010685 L 187.5 269.96737391488 L 195 269.89871638759 L 202.5 269.70920686871 L 210 269.22785324791 L 217.5 268.10379058942 L 225 265.69331121136 L 232.5 260.95369084497 L 240 252.42602092569 L 247.5 238.4252785497 L 255 217.53378984176 L 262.5 189.37112416324 L 270 155.40326123195 L 277.5 119.36542866568 L 285 86.874932869469 L 292.5 64.106952647795 L 300 55.905106061667 L 307.5 64.106952647795 L 315 86.874932869469 L 322.5 119.36542866568 L 330 155.40326123195 L 337.5 189.37112416324 L 345 217.53378984176 L 352.5 238.4252785497 L 360 252.42602092569 L 367.5 260.95369084497 L 375 265.69331121136 L 382.5 268.10379058942 L 390 269.22785324791 L 397.5 269.70920686871 L 405 269.89871638759 L 412.5 269.96737391488 L 420 269.99028010685 L 427.5 269.99732188785 L 435 269.99931755639 L 442.5 269.99983916686 L 450 269.99996494459 L 457.5 269.99999293349 L 465 269.99999868257 L 472.5 269.99999977285 L 480 269.99999996378 L 487.5 269.99999999466 L 495 269.99999999927 L 502.5 269.99999999991 L 510 269.99999999999 L 517.5 270 L 525 270 L 532.5 270 L 540 270 L 547.5 270 L 555 270 L 562.5 270 L 570 270 L 577.5 270 L 585 270 L 592.5 270 L 600 270 L 607.5 270 L 615 270 L 622.5 270 L 630 270 L 637.5 270 L 645 270 L 652.5 270 L 660 270 L 667.5 270 L 675 270 L 682.5 270 L 690 270 L 697.5 270 L 705 270 L 712.5 270 L 720 270 L 727.5 270 L 735 270 L 742.5 270 L 750 270 L 757.5 270 L 765 270 L 772.5 270 L 780 270 L 787.5 270 L 795 270 L 802.5 270 L 810 270 L 817.5 270 L 825 270 L 832.5 270 L 840 270 L 847.5 270 L 855 270 L 862.5 270 L 870 270 L 877.5 270 L 885 270 L 892.5 270 L 900 270" class="tall" />
+	<path d="M -300 269.99805602137 L -292.5 269.99750777917 L -285 269.99681489036 L -277.5 269.99594206504 L -270 269.9948461876 L -262.5 269.99347478298 L -255 269.99176423123 L -247.5 269.98963770007 L -240 269.98700276409 L -232.5 269.98374867875 L -225 269.97974327752 L -217.5 269.97482946126 L -210 269.96882125187 L -202.5 269.96149938509 L -195 269.95260642301 L -187.5 269.94184137374 L -180 269.92885381437 L -172.5 269.91323752497 L -165 269.89452365467 L -157.5 269.8721734569 L -150 269.84557064958 L -142.5 269.81401347722 L -135 269.77670657518 L -127.5 269.73275276255 L -120 269.68114491745 L -112.5 269.62075811788 L -105 269.55034226121 L -97.5 269.46851540524 L -90 269.37375810331 L -82.5 269.26440903299 L -75 269.13866224227 L -67.5 268.9945663571 L -60 268.83002610813 L -52.5 268.6428065417 L -45 268.43054027816 L -37.5 268.19073816899 L -30 267.92080368106 L -22.5 267.61805130061 L -15 267.2797292007 L -7.5 266.90304635267 L 0 266.48520418514 L 7.5 266.02343280253 L 15 265.51503167112 L 22.5 264.95741456383 L 30 264.34815842844 L 37.5 263.68505570994 L 45 262.96616951828 L 52.5 262.189890893 L 60 261.35499727868 L 67.5 260.46071119518 L 75 259.50675796835 L 82.5 258.49342128566 L 90 257.42159526113 L 97.5 256.29283164039 L 105 255.10938075335 L 112.5 253.87422483265 L 120 252.59110236386 L 127.5 251.26452222003 L 135 249.89976645965 L 142.5 248.50288083307 L 150 247.08065224639 L 157.5 245.64057267059 L 165 244.19078925284 L 172.5 242.74004068138 L 180 241.29758016785 L 187.5 239.87308573314 L 195 238.47655880748 L 202.5 237.11821247189 L 210 235.80835096733 L 217.5 234.5572423707 L 225 233.37498657389 L 232.5 232.27138089484 L 240 231.25578579083 L 247.5 230.33699322857 L 255 229.52310028734 L 262.5 228.82139052956 L 270 228.23822556546 L 277.5 227.77894906779 L 285 227.44780526117 L 292.5 227.24787362464 L 300 227.18102121233 L 307.5 227.24787362464 L 315 227.44780526117 L 322.5 227.77894906779 L 330 228.23822556546 L 337.5 228.82139052956 L 345 229.52310028734 L 352.5 230.33699322857 L 360 231.25578579083 L 367.5 232.27138089484 L 375 233.37498657389 L 382.5 234.5572423707 L 390 235.80835096733 L 397.5 237.11821247189 L 405 238.47655880748 L 412.5 239.87308573314 L 420 241.29758016785 L 427.5 242.74004068138 L 435 244.19078925284 L 442.5 245.64057267059 L 450 247.08065224639 L 457.5 248.50288083307 L 465 249.89976645965 L 472.5 251.26452222003 L 480 252.59110236386 L 487.5 253.87422483265 L 495 255.10938075335 L 502.5 256.29283164039 L 510 257.42159526113 L 517.5 258.49342128566 L 525 259.50675796835 L 532.5 260.46071119518 L 540 261.35499727868 L 547.5 262.189890893 L 555 262.96616951828 L 562.5 263.68505570994 L 570 264.34815842844 L 577.5 264.95741456383 L 585 265.51503167112 L 592.5 266.02343280253 L 600 266.48520418514 L 607.5 266.90304635267 L 615 267.2797292007 L 622.5 267.61805130061 L 630 267.92080368106 L 637.5 268.19073816899 L 645 268.43054027816 L 652.5 268.6428065417 L 660 268.83002610813 L 667.5 268.9945663571 L 675 269.13866224227 L 682.5 269.26440903299 L 690 269.37375810331 L 697.5 269.46851540524 L 705 269.55034226121 L 712.5 269.62075811788 L 720 269.68114491745 L 727.5 269.73275276255 L 735 269.77670657518 L 742.5 269.81401347722 L 750 269.84557064958 L 757.5 269.8721734569 L 765 269.89452365467 L 772.5 269.91323752497 L 780 269.92885381437 L 787.5 269.94184137374 L 795 269.95260642301 L 802.5 269.96149938509 L 810 269.96882125187 L 817.5 269.97482946126 L 825 269.97974327752 L 832.5 269.98374867875 L 840 269.98700276409 L 847.5 269.98963770007 L 855 269.99176423123 L 862.5 269.99347478298 L 870 269.9948461876 L 877.5 269.99594206504 L 885 269.99681489036 L 892.5 269.99750777917 L 900 269.99805602137" class="short" />
+	<use xlink:href="#g_point" y="270" x="420" height="8" width="8" />
+	<text y="290" x="420" class="label" >8</text>
+	<use xlink:href="#g_point" y="270" x="180" height="8" width="8" />
+	<text y="290" x="180" class="label" >-8</text>
+	<use xlink:href="#g_point" y="270" x="540" height="8" width="8" />
+	<text y="290" x="540" class="label" >16</text>
+	<use xlink:href="#g_point" y="270" x="60" height="8" width="8" />
+	<text y="290" x="60" class="label" >-16</text>
+	<use xlink:href="#g_point" y="30" x="300" height="8" width="8" />
+	<text y="35" x="320" class="label" >1</text>
+	<line x2="476" y2="45" y1="45" x1="441" class="std_normal" />
+	<text y="50" x="486" class="legend_text" >&#x03C3; = 1</text>
+	<line x2="476" y2="75" y1="75" x1="441" class="tall" />
+	<text y="80" x="486" class="legend_text" >&#x03C3; = 0.2</text>
+	<line x2="476" y2="105" y1="105" x1="441" class="short" />
+	<text y="110" x="486" class="legend_text" >&#x03C3; = 5</text>
+</svg>

Documents/Illumination/GenGaussianPlot.lua

+require "SvgWriter"
+require "vmath"
+require "Viewport"
+require "SubImage"
+require "GridAxis"
+require "_utils"
+
+local subImages = SubImage.SubImage(1, 1, 600, 300, 0, 0);
+
+local coordWidth = 20;
+
+local vp = Viewport.Viewport({600, 300}, {0, 4}, coordWidth)
+local trans2 = Viewport.Transform2D()
+vp:SetTransform(trans2);
+
+
+local vectorColor = "black";
+local vectorSumColor = "red";
+local pointSize = 15;
+
+local styleLib = SvgWriter.StyleLibrary();
+
+styleLib:AddStyle(nil, "std_normal",
+	SvgWriter.Style():stroke("red"):fill("none"));
+
+styleLib:AddStyle(nil, "tall",
+	SvgWriter.Style():stroke("blue"):fill("none"));
+
+styleLib:AddStyle(nil, "short",
+	SvgWriter.Style():stroke("orange"):fill("none"));
+
+styleLib:AddStyle(nil, "label",
+	SvgWriter.Style():stroke("none"):fill(vectorColor):font_size("14pt"):font_family("monospace"):font_weight("bold"):text_anchor("middle") );
+
+styleLib:AddStyle(nil, "legend_text",
+	SvgWriter.Style():stroke("none"):fill(vectorColor):font_size("14pt"):font_family("monospace"):font_weight("bold") );
+
+styleLib:AddStyle(nil, "vertex", SvgWriter.Style():stroke("none"):fill("black"));
+
+--Generate axis data.
+local axisData = GridAxis.GridAxis2D(vp, nil, styleLib, true, nil);
+
+
+local plotScale = vmath.vec2(0.5, 8);
+
+local function MakeGaussianPath(sigmaSqr)
+	local path = SvgWriter.Path();
+	
+	local variance = 2 * sigmaSqr;
+	local constant = 1 / math.sqrt(variance * math.pi);
+	
+	local maxValue = 0;
+	
+	local function ComputeGauss(x)
+		x = plotScale[1] * x;
+		local x2 = x*x;
+		local expTerm = math.exp(-x2 / variance);
+		
+		if(maxValue < plotScale[2] * (constant * expTerm)) then
+			maxValue = plotScale[2] * (constant * expTerm);
+		end
+		return plotScale[2] * (constant * expTerm);
+	end
+	
+	local bFirst = true;
+	
+	for i = -coordWidth, coordWidth, 0.25 do
+		if(bFirst) then
+			path:M(vp:Transform(vmath.vec2(i, ComputeGauss(i))))
+			bFirst = false;
+		else
+			path:L(vp:Transform(vmath.vec2(i, ComputeGauss(i))))
+		end
+	end
+	
+	return path;
+end
+
+local distributions =
+{
+	{1, "std_normal"},
+	{0.2, "tall"},
+	{5, "short"},
+}
+
+local paths = {};
+for i=1, #distributions do
+	paths[i] = MakeGaussianPath(distributions[i][1]);
+end
+
+--Labels
+local horizontalLabels =
+{
+	{8, vmath.vec2(0, 20)},
+	{-8, vmath.vec2(0, 20)},
+	{16, vmath.vec2(0, 20)},
+	{-16, vmath.vec2(0, 20)},
+}
+
+local verticalLabels =
+{
+	{1.0, vmath.vec2(20, 5);}
+}
+
+--Legend
+local legendStart = vp:Transform(vmath.vec2(4.7, 7.5));
+local legendLineWidth = 35;
+local legendItemHeight = 30;
+local legendTextSpace = 10;
+local legendTextVertOffset = 5;
+
+local pointRadius = 4;
+local radiusPt = vmath.vec2(pointRadius, pointRadius);
+
+local writer = SvgWriter.SvgWriter(ConstructSVGName(arg[0]), {subImages:Size().x .."px", subImages:Size().y .. "px"});
+	writer:StyleLibrary(styleLib);
+	axisData:AddDefinitions(writer, "g_axes");
+	writer:BeginDefinitions();
+		writer:BeginGroup(nil, "g_point");
+			writer:Circle(vmath.vec2(0, 0), pointRadius, {"vertex"});
+		writer:EndGroup();
+	writer:EndDefinitions();
+
+
+	writer:Use("g_axes", subImages:Offset(1, 1), subImages:SubSize());
+	
+	for i=1, #distributions do
+		writer:Path(paths[i], {distributions[i][2]});
+	end
+	
+	for i=1, #horizontalLabels do
+		local point = vmath.vec2(horizontalLabels[i][1], 0);
+		point = point * plotScale;
+		point = vp:Transform(point);
+		writer:Use("g_point", point, radiusPt * 2);
+		writer:Text(tostring(horizontalLabels[i][1]), point + horizontalLabels[i][2], {"label"});
+	end
+	
+	for i=1, #verticalLabels do
+		local point = vmath.vec2(0, verticalLabels[i][1] * plotScale[2]);
+		point = vp:Transform(point);
+		writer:Use("g_point", point, radiusPt * 2);
+		writer:Text(tostring(verticalLabels[i][1]), point + verticalLabels[i][2], {"label"});
+	end
+	
+	for i=1, #distributions do
+		local point = legendStart + vmath.vec2(0, (i-1) * legendItemHeight);
+		writer:Line(point, point + vmath.vec2(legendLineWidth, 0), distributions[i][2]);
+		point = point + vmath.vec2(legendLineWidth + legendTextSpace, legendTextVertOffset);
+		writer:Text("&#x03C3; = ".. tostring(distributions[i][1]), point, {"legend_text"});
+	end
+	
+writer:Close();
Add a comment to this file

Documents/Illumination/Phong Clipping.png

Added
New image
Add a comment to this file

Documents/Illumination/Phong Dark Diffuse.png

Added
New image
Add a comment to this file

Documents/Illumination/Phong Distortion.png

Added
New image
Add a comment to this file

Documents/Illumination/Phong Lighting.png

Added
New image

Documents/Illumination/Tutorial 10.xml

             <title>Drawing Phong</title>
             <para>The <phrase role="propername">Phong Lighting</phrase> tutorial demonstrates the
                 Phong specular model.</para>
-            <!--TODO: Show a picture of the tutorial.-->
+            <figure>
+                <title>Phong Lighting</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="Phong%20Lighting.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
             <para>The tutorial is controlled similarly to previous lighting tutorials. The
                     <keycap>W</keycap>, <keycap>A</keycap>, <keycap>S</keycap>, and
                     <keycap>D</keycap> keys control the orientation of the cylinder. Pressing the
                 reasonable.</para>
             <para>In particular, it is interesting to note what happens when you use a very dark
                 diffuse color. You can activate this by pressing the <keycap>G</keycap> key.</para>
-            <!--TODO: Show dark diffuse color from the tutorial.-->
-            <para>If there was no specular term at all, you would a virtually scene. The specular
+            <figure>
+                <title>Phong with Dark Diffuse</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="Phong%20Dark%20Diffuse.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
+            <para>If there was no specular term at all, you would see very little.. The specular
                 highlight, even with the fairly weak specular reflection of 0.25, is strong enough
                 to give some definition to the object when seen from various angles. This more
                 accurately shows what a black plastic object might look like.</para>
             <para>One thing you may notice is that, if you bring the light close to the surface, the
                 specular area tends to have very sharp edges.</para>
-            <!--TODO: Show a picture of the Phong clipping.-->
+            <figure>
+                <title>Phong Clipping</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="Phong%20Clipping.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
             <para>This is part of the nature of specular reflections. If the light is almost
                 perpendicular to the surface, the specular reflection will shine brightest when the
                 light is almost eclipsed by the surface. This creates a strong discontinuity at the
                 having small exponents.</para>
             <para>If you drop the exponent down to the minimum value the code will allow, you will
                 see something like this:</para>
-            <!--TODO: show a picture of the Phong distortion.-->
+            <figure>
+                <title>Phong Distortion</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="Phong%20Distortion.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
             <para>This ring area shows one of the main limitations of the Phong model. When trying
                 to depict a surface that is rough but still has specular highlights, the Phong model
                 starts to break down. It will not allow any specular contribution from areas outside
             So the Blinn specular model produces similar results to the Phong model, but without
             some of Phong's problems. This is demonstrated in the <phrase role="propername">Blinn vs
                 Phong Lighting</phrase> tutorial.</para>
-        <!--TODO: Show an image of Blinn from the tutorial.-->
+        <figure>
+            <title>Blinn Lighting</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="Blinn%20Lighting.png"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>The controls are similar to the last tutorial. Pressing the <keycap>H</keycap> key
             will switch between Blinn and Phong specular. Pressing <keycombo>
                 <keycap>Shift</keycap>
             view direction vectors. As before, we take the dot product between that and the surface
             normal, clamp, then raise the result to a power.</para>
         <para>Blinn specular solves the Phong problem with the reflection direction.</para>
-        <!--TODO: Picture comparing Phong and Blinn with same light positions and low shininess.-->
+        <figure>
+            <title>Blinn vs. Phong Lighting</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="Blinn%20vs%20Phong%20Compare.png"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
+        <para>The Blinn version is on the left, with the Phong version on the right.</para>
         <para>The Blinn specular exponent does not mean quite the same thing as the Phong exponent.
             In general, to produce a highlight the same size as a Phong one, you will need a larger
             Blinn exponent. Play around with the different exponents, to get a feel for what Blinn
                 </imageobject>
             </mediaobject>
         </equation>
-        <!--TODO: Picture of Gaussian curve.-->
+        <figure>
+            <title>Gaussian Probability Distribution Curves</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="GaussianPlot.svg" format="SVG"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>This represents the percentage of the items in the distribution that satisfy the
             property that the X in the distribution is trying to model. The <literal>e</literal> in
             this equation is a common mathematical constant, equivalent to ~2.718. The value of
             <para>If you play around with the controls, you can see how much the Gaussian
                 distribution offers over Phong and Blinn. For example, set the Gaussian smoothness
                 value to 0.05.</para>
-            <!--TODO: Show a picture of a Gaussian highlight with smoothness at 0.05-->
+            <figure>
+                <title>Gaussian with Sharp Highlight</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="Gaussian%20Small%20Highlight.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
             <para>It requires very large exponents, well in excess of 100, to match the small size
                 and focus of that specular highlight with Phong or Blinn. It takes even larger
                 exponents to match the Gaussian value of 0.02.</para>

Documents/Tools/GridAxis.lua

 	writer:EndDefinitions();
 end
 
-function GridAxis2D(vp, axisStyle, styleLib, bGrid, gridStyle)
+function GridAxis2D(vp, axisStyle, styleLib, bGrid, gridStyle, gridScale)
 	assert(styleLib);
 	assert(vp);
 	
 	axisStyle = axisStyle or SvgWriter.Style():stroke("black"):fill("none"):stroke_width("2px");
 	gridStyle = gridStyle or SvgWriter.Style():stroke("#CCC"):fill("none"):stroke_width("1px");
+	gridScale = gridScale or 1.0;
 	
 	local axisGridObj = {};
 	axisGridObj.axisIndex = axisIndex;
 	arrowheadPath:M{10, 4}:L{0, 0}:L{0, 8}:Z();
 	axisGridObj.arrowheadPath = arrowheadPath;
 	
+	local viewportScale = vmath.vec2(vp:Size());
+	
 	--Create grid path, if needed.
 	if(bGrid) then
 		styleLib:AddStyle(nil, gridStyleName .. axisGridObj.axisIndex, gridStyle);
 		local gridPath = SvgWriter.Path();
 
 		--Vertical lines.
-		for i = lowerBound[1], upperBound[1] do
+		for i = lowerBound[1], upperBound[1], gridScale do
 			local points =
 			{
 				vmath.vec2(i, lowerBound[2]);
 		end
 
 		--Horizontal lines.
-		for i = lowerBound[2], upperBound[2] do
+		for i = lowerBound[2], upperBound[2], gridScale do
 			local points =
 			{
 				vmath.vec2(lowerBound[1], i);

Documents/Tools/Viewport.lua

 	viewport.pixelSize = vmath.vec2(pixelSize);
 	viewport.vpOrigin = vmath.vec2(vpOrigin);
 	viewport.pxCenter = viewport.pixelSize / 2;
-	if(type(vpSize) == "number") then vpSize = vmath.vec2(vpSize, vpSize) end;
+	if(type(vpSize) == "number") then
+		vpSize = vmath.vec2(vpSize, vpSize * (pixelSize[2] / pixelSize[1]))
+	end;
 	viewport.vpSize = vmath.vec2(vpSize);
 	
 	local trans = Transform2D();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.