Jason McKesson avatar Jason McKesson committed 6e4d335

Tut17: Images mostly done.

Comments (0)

Files changed (16)

Add a comment to this file

Documents/Texturing/BorderClampLight.png

Added
New image
Add a comment to this file

Documents/Texturing/ColoredProjectLights.png

Added
New image
Add a comment to this file

Documents/Texturing/Cube Point Light.png

Added
New image
Add a comment to this file

Documents/Texturing/DoubleProjection.png

Added
New image
Add a comment to this file

Documents/Texturing/EdgeClampLight.png

Added
New image
Add a comment to this file

Documents/Texturing/LightBackProjection.png

Added
New image

Documents/Texturing/PostProjectTransform.mathml

+<?xml version="1.0" encoding="utf-8"?>
+
+<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" overflow="scroll">
+    <mi mathvariant="bold">T</mi>
+    <mo>*</mo>
+    <mfrac>
+      <mover>
+        <mi>v</mi>
+        <mo>&#x21C0;</mo>
+      </mover>
+      <mi>w</mi>
+    </mfrac>
+    <mo>=</mo>
+    <mo>=</mo>
+    <mfrac>
+      <mrow>
+        <mi mathvariant="bold">T</mi>
+        <mo>*</mo>
+        <mover>
+          <mi>v</mi>
+          <mo>&#x21C0;</mo>
+        </mover>
+      </mrow>
+      <mrow>
+        <mi>w</mi>
+        <mi>'</mi>
+      </mrow>
+    </mfrac>
+    <mspace linebreak="newline"/>
+</math>
+
Add a comment to this file

Documents/Texturing/PostProjectTransform.svg

Added
New image
+<?xml version="1.0" encoding="utf-8"?>
+<svg:svg xmlns="http://www.w3.org/1998/Math/MathML" xmlns:svg="http://www.w3.org/2000/svg" height="19.939453pt" width="83.572110pt" xmlns:svgmath="http://www.grigoriev.ru/svgmath" viewBox="0 -14.056641 83.572110 19.939453"><svg:metadata><svgmath:metrics top="19.939453125" axis="9.8671875" baseline="5.8828125" bottom="0.0"/></svg:metadata><svg:text font-size="12.000000" font-weight="bold" text-anchor="middle" y="0.000000" x="4.001953" font-family="Times New Roman" fill="black">T</svg:text><svg:g transform="translate(10.003910, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.000000" font-family="Times New Roman" fill="black">*</svg:text></svg:g><svg:g transform="translate(18.589852, -3.984375)"><svg:g transform="translate(0.585938, -1.740234)"><svg:g transform="translate(1.338984, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="2.663086" font-family="Times New Roman" font-style="italic" fill="black">v</svg:text></svg:g><svg:g transform="translate(0.000000, -6.813223)"><svg:text font-size="8.520000" text-anchor="middle" y="2.462813" x="4.002070" font-family="Lucida Sans Unicode" fill="black">⇀</svg:text></svg:g></svg:g><svg:g transform="translate(0.586055, 6.902344)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="4.001953" font-family="Times New Roman" font-style="italic" fill="black">w</svg:text></svg:g><svg:line stroke-width="0.585938" x1="0.000000" x2="9.176016" stroke="black" stroke-linecap="butt" stroke-dasharray="none" y1="0.000000" y2="0.000000" fill="none"/></svg:g><svg:g transform="translate(31.685141, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.383789" font-family="Times New Roman" fill="black">=</svg:text></svg:g><svg:g transform="translate(45.119391, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.383789" font-family="Times New Roman" fill="black">=</svg:text></svg:g><svg:g transform="translate(55.806243, -3.984375)"><svg:g transform="translate(0.585938, -1.740234)"><svg:text font-size="12.000000" font-weight="bold" text-anchor="middle" y="0.000000" x="4.001953" font-family="Times New Roman" fill="black">T</svg:text><svg:g transform="translate(10.003910, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.000000" font-family="Times New Roman" fill="black">*</svg:text></svg:g><svg:g transform="translate(18.003914, 0.000000)"><svg:g transform="translate(1.338984, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="2.663086" font-family="Times New Roman" font-style="italic" fill="black">v</svg:text></svg:g><svg:g transform="translate(0.000000, -6.813223)"><svg:text font-size="8.520000" text-anchor="middle" y="2.462813" x="4.002070" font-family="Lucida Sans Unicode" fill="black">⇀</svg:text></svg:g></svg:g></svg:g><svg:g transform="translate(8.020629, 9.726563)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="4.001953" font-family="Times New Roman" font-style="italic" fill="black">w</svg:text><svg:g transform="translate(8.003906, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="1.283203" font-family="Times New Roman" font-style="italic" fill="black">'</svg:text></svg:g></svg:g><svg:line stroke-width="0.585938" x1="0.000000" x2="27.179930" stroke="black" stroke-linecap="butt" stroke-dasharray="none" y1="0.000000" y2="0.000000" fill="none"/></svg:g><svg:g transform="translate(83.572110, 0.000000)"/></svg:svg>

Documents/Texturing/PostProjectTransform.tex

+\mathbf{T} * \frac{\vec{v}}{w} == \frac{\mathbf{T} * \vec{v}}{w'}

Documents/Texturing/PostProjectTransform_2.mathml

+<?xml version="1.0" encoding="utf-8"?>
+
+  <math xmlns="http://www.w3.org/1998/Math/MathML" display="block" overflow="scroll">
+    <mi>w</mi>
+    <mi>'</mi>
+    <mo>=</mo>
+    <msub>
+      <mi>T</mi>
+      <mn>03</mn>
+    </msub>
+    <mo>*</mo>
+    <mi>v.x</mi>
+    <mo>+</mo>
+    <msub>
+      <mi>T</mi>
+      <mn>13</mn>
+    </msub>
+    <mo>*</mo>
+    <mi>v.y</mi>
+    <mo>+</mo>
+    <msub>
+      <mi>T</mi>
+      <mn>23</mn>
+    </msub>
+    <mo>*</mo>
+    <mi>v.z</mi>
+    <mo>+</mo>
+    <msub>
+      <mi>T</mi>
+      <mn>33</mn>
+    </msub>
+    <mo>*</mo>
+    <mi>v.w</mi>
+    <mspace linebreak="newline"/>
+  </math>
+
Add a comment to this file

Documents/Texturing/PostProjectTransform_2.svg

Added
New image
+<?xml version="1.0" encoding="utf-8"?>
+<svg:svg xmlns="http://www.w3.org/1998/Math/MathML" xmlns:svg="http://www.w3.org/2000/svg" height="12.871816pt" width="228.119735pt" xmlns:svgmath="http://www.grigoriev.ru/svgmath" viewBox="0 -8.332031 228.119735 12.871816"><svg:metadata><svgmath:metrics top="12.8718164063" axis="8.52416015625" baseline="4.53978515625" bottom="1.7389453125"/></svg:metadata><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="4.001953" font-family="Times New Roman" font-style="italic" fill="black">w</svg:text><svg:g transform="translate(8.003906, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="1.283203" font-family="Times New Roman" font-style="italic" fill="black">'</svg:text></svg:g><svg:g transform="translate(14.472008, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.383789" font-family="Times New Roman" fill="black">=</svg:text></svg:g><svg:g transform="translate(24.572922, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="3.336914" font-family="Times New Roman" font-style="italic" fill="black">T</svg:text><svg:g transform="translate(7.792969, 2.700996)"><svg:text font-size="8.520000" text-anchor="middle" y="0.000000" x="4.260000" font-family="Times New Roman" fill="black">03</svg:text></svg:g></svg:g><svg:g transform="translate(42.885895, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.000000" font-family="Times New Roman" fill="black">*</svg:text></svg:g><svg:g transform="translate(50.885899, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="7.500000" font-family="Times New Roman" fill="black">v.x</svg:text></svg:g><svg:g transform="translate(68.552563, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.383789" font-family="Times New Roman" fill="black">+</svg:text></svg:g><svg:g transform="translate(77.986805, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="3.336914" font-family="Times New Roman" font-style="italic" fill="black">T</svg:text><svg:g transform="translate(7.792969, 2.700996)"><svg:text font-size="8.520000" text-anchor="middle" y="0.000000" x="4.260000" font-family="Times New Roman" fill="black">13</svg:text></svg:g></svg:g><svg:g transform="translate(96.299778, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.000000" font-family="Times New Roman" fill="black">*</svg:text></svg:g><svg:g transform="translate(104.299782, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="7.500000" font-family="Times New Roman" fill="black">v.y</svg:text></svg:g><svg:g transform="translate(121.966446, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.383789" font-family="Times New Roman" fill="black">+</svg:text></svg:g><svg:g transform="translate(131.400688, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="3.336914" font-family="Times New Roman" font-style="italic" fill="black">T</svg:text><svg:g transform="translate(7.792969, 2.700996)"><svg:text font-size="8.520000" text-anchor="middle" y="0.000000" x="4.260000" font-family="Times New Roman" fill="black">23</svg:text></svg:g></svg:g><svg:g transform="translate(149.713661, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.000000" font-family="Times New Roman" fill="black">*</svg:text></svg:g><svg:g transform="translate(157.713664, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="7.163086" font-family="Times New Roman" fill="black">v.z</svg:text></svg:g><svg:g transform="translate(174.706500, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.383789" font-family="Times New Roman" fill="black">+</svg:text></svg:g><svg:g transform="translate(184.140742, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="3.336914" font-family="Times New Roman" font-style="italic" fill="black">T</svg:text><svg:g transform="translate(7.792969, 2.700996)"><svg:text font-size="8.520000" text-anchor="middle" y="0.000000" x="4.260000" font-family="Times New Roman" fill="black">33</svg:text></svg:g></svg:g><svg:g transform="translate(202.453715, -3.984375)"><svg:text font-size="12.000000" text-anchor="middle" y="3.984375" x="3.000000" font-family="Times New Roman" fill="black">*</svg:text></svg:g><svg:g transform="translate(210.453719, 0.000000)"><svg:text font-size="12.000000" text-anchor="middle" y="0.000000" x="8.833008" font-family="Times New Roman" fill="black">v.w</svg:text></svg:g><svg:g transform="translate(228.119735, 0.000000)"/></svg:svg>

Documents/Texturing/PostProjectTransform_2.tex

+w' = T_{03}*v.x + T_{13}*v.y + T_{23}*v.z + T_{33}*v.w
Add a comment to this file

Documents/Texturing/ProjectCloseObject.png

Added
New image
Add a comment to this file

Documents/Texturing/ProjectTopView.png

Added
New image
Add a comment to this file

Documents/Texturing/Projected Light.png

Added
New image

Documents/Texturing/Tutorial 17.xml

         <para>Open up the project called <phrase role="propername">Double Projection</phrase>. It
             renders four objects, using various textures, in a scene with a single directional light
             and a green point light.</para>
-        <!--TODO: Add image of Double Projection tutorial.-->
+        <figure>
+            <title>Double Projection</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="DoubleProjection.png"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>This tutorial displays two images of the same scene. The image on the left is the view
             of the scene from one camera, while the image on the right is the view of the scene from
             another camera. The difference between the two cameras is mainly in where the camera
         <para>For example, if we rotate the right camera to an above view, relative to whatever the
             left camera is, we see that all of the objects seems to shrink down into a very small
             width.</para>
-        <!--TODO: Add image of Double Projection, with right camera from the top, relatively far from the scene.-->
+        <figure>
+            <title>Top View Projection</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="ProjectTopView.png"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>This is due to the particulars of the perspective projection's work on the Z
             coordinate. The Z coordinate in NDC space is the result of the clip-space Z divided by
             the negative of the camera-space Z. This forces it into the [-1, 1] range, but the
             away.</para>
         <para>This can be seen by moving the left camera close to an object. The right camera, from
             a top-down view, has a much thicker view of that object in the Z direction.</para>
-        <!--TODO: Add image of Double Projection, with the right camera from the top, really close to an object.
-This will let us see that the object takes up a large part of the [-1, 1] Z range.-->
+        <figure>
+            <title>Near View Projection</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="ProjectCloseObject.png"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>Pressing the <keycap>Y</keycap> key will toggle depth clamping in the right camera.
             This can explain some of the unusual things that will be seen there. Sometimes the wrong
             objects will appear on top of each other; when this happens, it is almost always due to
                 shader to divide the clip-space values by W, then do the rotation?</para>
             <para>Obviously not, since this code works. But just because code happens to work
                 doesn't mean that it should. So let's see if we can prove that it does. To do this,
-                we must prove that:</para>
-            <!--TODO: Equation of: T * (v/w) == (T * v)/w'-->
+                we must prove this:</para>
+            <informalequation>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="PostProjectTransform.svg"/>
+                    </imageobject>
+                </mediaobject>
+            </informalequation>
             <para>This might look like a simple proof by inspection due to the associative nature of
-                these, but it is not. The reason is quite simple: W and W' may not be the same. W is
-                the fourth component of v; W' is the fourth component of what results from T*v. If T
-                changes W, then the equation is not true. But at the same time, if T doesn't change
-                W, if W == W', then the equation is true.</para>
+                these, but it is not. The reason is quite simple: w and w' may not be the same. The
+                value of w is the fourth component of v; w' is the fourth component of what results
+                from T*v. If T changes w, then the equation is not true. But at the same time, if T
+                doesn't change w, if w == w', then the equation is true.</para>
             <para>Well, that makes things quite simple. We simply need to ensure that our T does not
-                alter W. Matrix multiplication tells us that W' is the dot product of V and the
+                alter w. Matrix multiplication tells us that w' is the dot product of V and the
                 bottom row of T.</para>
-            <!--TODO: Equation of: (m03*x + m13*y + m23*z + m33*w)-->
-            <para>Therefore, if the bottom row of T is (0, 0, 0, 1), then W == W'. And therefore, we
+            <informalequation>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="PostProjectTransform_2.svg"/>
+                    </imageobject>
+                </mediaobject>
+            </informalequation>
+            <para>Therefore, if the bottom row of T is (0, 0, 0, 1), then w == w'. And therefore, we
                 can use T before the division. Fortunately, the only matrix we have that has a
                 different bottom row is the projection matrix, and T is the rotation matrix we apply
                 after projection.</para>
             <para>So this works, as long as we use the right matrices. We can rotate, translate, and
                 scale post-projective clip-space exactly as we would post-projective NDC space.
-                Which is good, because we get to preserve the W component for perspective-correct
+                Which is good, because we get to preserve the w component for perspective-correct
                 interpolation.</para>
             <para>The take-home lesson here is very simple: projections are not that special as far
                 as transforms are concerned. Post-projective space is mostly just another space. It
                 >Projected Light</phrase> project. This tutorial uses a similar scene to the one
             before, though with slightly different numbers for lighting. The main difference, scene
             wise, is the addition of a textured background box.</para>
-        <!--TODO: Add image of the Projected Light tutorial.-->
+        <figure>
+            <title>Projected Light</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="Projected%20Light.png"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>The camera controls work the same way as before. The projected flashlight, represented
             by the red, green, and blue axes, is moved with the IJKL keyboard keys, with O and U
             moving up and down, respectively. The right mouse button rotates the flashlight around;
                 position against zero, and sets the light intensity to zero if the W component is
                 less than or equal to 0. What is the purpose of this?</para>
             <para>It stops this from happening:</para>
-            <!--TODO: Add image of Projected Light without the back-projection prevention code.-->
+            <figure>
+                <title>Back Projected Light</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="LightBackProjection.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
             <para>The projection math doesn't care what side of the center of projection an object
                 is on; it will work either way. And since we do not actually do clipping on our
                 texture projection, we need some way to prevent this from happening. We effectively
             <para>Another interesting trick we can play is to have multi-colored lights. Press the
                     <keycap>2</keycap>; this will change to a texture that contains spots of various
                 different colors.</para>
-            <!--TODO: Add image of Projected Light with image 2.-->
+            <figure>
+                <title>Colored Spotlight</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="ColoredProjectLights.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
             <para>This kind of complex light emitter would not be possible without using a texture.
                 Well it could be possible without textures, but it would require a lot more
                 processing power than a few matrix multiplies, a division in the fragment shader,
                 clamping to the texture's edge. That worked fine because our edge texels have all
                 been zero. To see what happens when they are not, press the <keycap>3</keycap>
                 key.</para>
-            <!--TODO: Add image of Projected Light with image 3, in the dark, using edge clamping.-->
+            <figure>
+                <title>Edge Clamped Light</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="EdgeClampLight.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
             <para>That rather ruins the effect. Fortunately, OpenGL does provide a way to resolve
                 this. It gives us a way to say that texels fetched outside of the [0, 1] range
                 should return a particular color. As before, this is set up with the sampler
             <para>The S and T wrap modes are set to <literal>GL_CLAMP_TO_BORDER</literal>. Then the
                 border's color is set to zero. To toggle between the edge clamping sampler and the
                 border clamping one, press the <keycap>H</keycap> key.</para>
-            <!--TODO: Add image of Projected Light with image 3, in the dark, but with border clamping.-->
+            <figure>
+                <title>Border Clamped Light</title>
+                <mediaobject>
+                    <imageobject>
+                        <imagedata fileref="BorderClampLight.png"/>
+                    </imageobject>
+                </mediaobject>
+            </figure>
             <para>That's much better now.</para>
         </section>
     </section>
                 Light</phrase> project. This puts a fixed point light using a cube map in the middle
             of the scene. The orientation of the light can be changed with the right mouse
             button.</para>
-        <!--TODO: Image of Cube Point Light.-->
+        <figure>
+            <title>Cube Point Light</title>
+            <mediaobject>
+                <imageobject>
+                    <imagedata fileref="Cube%20Point%20Light.png"/>
+                </imageobject>
+            </mediaobject>
+        </figure>
         <para>This cube texture has various different light arrangements on the different sides. One
             side even has green text on it. As before, you can use the <keycap>G</keycap> key to
             toggle the non-cube map lights off.</para>
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.