<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>CS 184: Computer Graphics on</title><link>https://notes.bencuan.me/cs184/</link><description>Recent content in CS 184: Computer Graphics on</description><generator>Hugo</generator><language>en</language><atom:link href="https://notes.bencuan.me/cs184/index.xml" rel="self" type="application/rss+xml"/><item><title/><link>https://notes.bencuan.me/cs184/cameras-and-lenses/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/cameras-and-lenses/</guid><description>&lt;h2 id="taking-a-picture"&gt;
 Taking a Picture
 &lt;a class="anchor" href="#taking-a-picture"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Cameras have &lt;strong&gt;sensors&lt;/strong&gt; that capture light onto a plane.&lt;/p&gt;
&lt;p&gt;First, a &lt;strong&gt;lens&lt;/strong&gt; focuses incoming light onto the sensor. A &lt;strong&gt;shutter&lt;/strong&gt; exposes the sensor to this light for a specified duration. During exposure, the sensor accumulates [[radiometry and photometry#Irradiance|irradiance]]. Modern digital sensors then convert this captured irradiance into some digital file format.&lt;/p&gt;
&lt;h2 id="field-of-view"&gt;
 Field of View
 &lt;a class="anchor" href="#field-of-view"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;FOV refers to the angle which can be viewed by the sensor:
![[/cs184/img/Pasted-image-20230419174319.png]]
For a fixed sensor size $h$, &lt;em&gt;decreasing&lt;/em&gt; the focal length $f$ &lt;em&gt;increases&lt;/em&gt; the field of view:
&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/Drawing-Triangles/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/Drawing-Triangles/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="anchor" href="#introduction"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Digital drawing involves creating a 2D representation on a screen, paper, or other medium. It&amp;rsquo;s useful for a lot of applications like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CNC machines&lt;/li&gt;
&lt;li&gt;Laser cutters&lt;/li&gt;
&lt;li&gt;CRT monitors&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are several different methods to do this. For the time being, we will focus on the technique of &lt;strong&gt;rasterization&lt;/strong&gt;, which involves first representing the scene or object in a 3D, digital context, then converting that representation into a 2D image.&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/geometry/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/geometry/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="anchor" href="#introduction"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;So far, with a rasterizer, we&amp;rsquo;ve seen how to draw polygons to the screen. However, this assumes that we already know where the polygons are in space. How do we model more complex objects, curves, faces, and fluids?&lt;/p&gt;
&lt;h2 id="parametric-coordinates"&gt;
 Parametric Coordinates
 &lt;a class="anchor" href="#parametric-coordinates"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;We can represent a curve using a function $x(u)$, where $u$ is a real number.
Parametric curves may have multiple formulae for the same curve, but they are not all the same: for example, the function $x(u) = [u,u]$ plots a diagonal line with uniform spacing between points, whereas $x(u) = [u^3, u^3]$ also results in a diagonal line but can&amp;rsquo;t be differentiated at $u=0$.&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/Materials/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/Materials/</guid><description>&lt;p&gt;In terms of graphics rendering, a material is equivalent to a BRDF: it&amp;rsquo;s a 4-dimensional function that captures how light bounces off of objects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Microfacet theory:&lt;/strong&gt; Although all materials have microsurfaces (lots of bumps that make the normal vectors point in many directions), at a distance they all look smooth (macrosurface).&lt;/p&gt;
&lt;p&gt;There should be two BRDF&amp;rsquo;s: the macroscale is flat and rough, while the microscale is bumpy and specular. Each microfacet (microscale calculation) has its own normal vector that is drawn from some distribution.&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/Monte-Carlo-Integration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/Monte-Carlo-Integration/</guid><description>&lt;p&gt;Integration is used for lots of applications in graphics (radiometry, exposure/motion blur simulations, etc. etc.). These integrals are often multi-dimensional, over time, space, and/or polar coordinates. This is very expensive: the &lt;em&gt;curse of dimensionality&lt;/em&gt; outlines the fact that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The complete set of samples is exponential over the number of dimensions: $N^d$&lt;/li&gt;
&lt;li&gt;The error of numerical integration is inversely proportional to the number of samples: $\frac{1}{N^{1/d}}$&lt;/li&gt;
&lt;li&gt;The error for random sampling is proportional to $1/\sqrt N$.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The above suggests that for higher dimensions, random sampling integration methods (like Monte Carlo integration) become much better than numerical integration methods.&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/Path-Tracing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/Path-Tracing/</guid><description>&lt;h2 id="reflection"&gt;
 Reflection
 &lt;a class="anchor" href="#reflection"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Reflection is the process by which light incident on a surface interacts with the surface such that it leaves on the same side without change in frequency.&lt;/p&gt;
&lt;h3 id="cagetories-of-reflection"&gt;
 Cagetories of reflection
 &lt;a class="anchor" href="#cagetories-of-reflection"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Ideal specular:&lt;/strong&gt; perfect mirror reflection
&lt;strong&gt;Ideal diffuse:&lt;/strong&gt; equal reflection in all directions
&lt;strong&gt;Glossy specular:&lt;/strong&gt; majority of light reflected near mirror direction
&lt;strong&gt;Retro-reflective:&lt;/strong&gt; light bounces back towards the way it came&lt;/p&gt;
&lt;h3 id="reflection-at-a-point"&gt;
 Reflection at a point
 &lt;a class="anchor" href="#reflection-at-a-point"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;incoming differential irradiance:&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/radiometry-and-photometry/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/radiometry-and-photometry/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="anchor" href="#introduction"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Lights work by converting energy into photons, which each carry a small amount of energy away. Some of these photons reflect from objects and bounce into our eyes, which we perceive as light.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Radiometry&lt;/strong&gt; is a measurement system for illumination, used to quantify the spatial properties of light. It can be used to perform lighting calculations to represent reality.&lt;/p&gt;
&lt;h3 id="assumptions"&gt;
 Assumptions
 &lt;a class="anchor" href="#assumptions"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Assume a geometric optics model of light: photons travel in straight lines, and can be represented as rays.&lt;/li&gt;
&lt;li&gt;Assume a steady state flow: the rate of energy consumption of light sources is constant, so flux/power and energy can be interchangable.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="summary"&gt;
 Summary
 &lt;a class="anchor" href="#summary"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;![[/cs184/img/Pasted-image-20230304225750.png]]
![[/cs184/img/Pasted-image-20230304151739.png]]&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/ray-tracing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/ray-tracing/</guid><description>&lt;p&gt;Ray tracing is an alternative technique to rasterization that accomplishes the same thing (converting the world into a 2D screen).&lt;/p&gt;
&lt;h2 id="overview"&gt;
 Overview
 &lt;a class="anchor" href="#overview"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="ray-casting"&gt;
 Ray Casting
 &lt;a class="anchor" href="#ray-casting"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Early ray tracing (1968): To generate an image:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Cast a ray for every pixel from the camera to the world.&lt;/li&gt;
&lt;li&gt;Use a shading calculation (e.g. Blinn Phong) to calculate the color at the intersection of that ray to the object that it collides with.&lt;/li&gt;
&lt;li&gt;Check for shadows by casting a ray from the light source to the point. (If the ray is blocked, then a shadow should be drawn.)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It turns out that raycasting is actually very similar to the rasterization algorithm!&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/Sampling-and-Aliasing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/Sampling-and-Aliasing/</guid><description>&lt;h2 id="signal-reconstruction"&gt;
 Signal Reconstruction
 &lt;a class="anchor" href="#signal-reconstruction"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;How do we actually convert data from the rasterizer into signals that can be displayed on a monitor?&lt;/p&gt;
&lt;h3 id="jaggies"&gt;
 Jaggies
 &lt;a class="anchor" href="#jaggies"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Right now, if we just display what we rasterized in the function from the [[Drawing Triangles|previous section]], the triangle will look a bit off:
![[/cs184/img/Pasted-image-20230119163826.png|300]]
There&amp;rsquo;s some irregularities (like the isolated pixel on the bottom left) that make this look unnatural. This is an example of &lt;strong&gt;aliasing-&lt;/strong&gt; which are rendering errors and artifacts that are created as a result of sampling being unable to perfectly represent the original image.&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/texture-mapping/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/texture-mapping/</guid><description>&lt;p&gt;Texture can be used to store a lot of complex information about an object without needing to split it up into really tiny polygons.&lt;/p&gt;
&lt;p&gt;Color, roughness, and brightness are all examples of properties that can be modelled using texture mapping.&lt;/p&gt;
&lt;h2 id="coordinate-spaces"&gt;
 Coordinate spaces
 &lt;a class="anchor" href="#coordinate-spaces"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;There are three main coordinate spaces that we need to deal with:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Screen space&lt;/strong&gt; describes the location of the pixel on the screen we want to access. (2D, using $x$ and $y$ coordinates)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;World space&lt;/strong&gt; describes the location that pixel corresponds to on the object itself. (3D, using $x, y, z$ coordinates)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Texture space&lt;/strong&gt; describes the properties mapped to that location on the object. (2D, using $u$ and $v$ coordinates)
![[/cs184/img/Pasted-image-20230201180532.png]]&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="barycentric-coordinates"&gt;
 Barycentric Coordinates
 &lt;a class="anchor" href="#barycentric-coordinates"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The barycentric coordinate system describes locations inside of a triangle. Essentially, they represent the weighted average of points with the weights summing to one with convex hull properties.&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/transforms/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/transforms/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="anchor" href="#introduction"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Transforms are functions $F$ that operate on points. They can be used to alter the position, rotation, and scale of objects.&lt;/p&gt;
&lt;p&gt;Transforms are especially useful because coordinate systems are arbitrary- if needed, we can convert our objects into a convenient system, then convert it back when we&amp;rsquo;re done. For example, we may want to represent 3D objects in 2D space to model a scene.&lt;/p&gt;
&lt;h2 id="linear-transformations"&gt;
 Linear Transformations
 &lt;a class="anchor" href="#linear-transformations"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;![[/cs184/img/Pasted-image-20230126160430.png]]&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs184/visibility-and-shading/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs184/visibility-and-shading/</guid><description>&lt;h2 id="overview"&gt;
 Overview
 &lt;a class="anchor" href="#overview"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Here&amp;rsquo;s the main steps for rasterizing an image:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;position objects in the world using [[transforms]]&lt;/li&gt;
&lt;li&gt;compute the position of objects relative to the camera&lt;/li&gt;
&lt;li&gt;project objects onto the screen&lt;/li&gt;
&lt;li&gt;sample and interpolate triangles using barycentric coordinates&lt;/li&gt;
&lt;li&gt;add texture maps&lt;/li&gt;
&lt;li&gt;disable objects that are not visible to the camera&lt;/li&gt;
&lt;li&gt;add shading&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="visibility"&gt;
 Visibility
 &lt;a class="anchor" href="#visibility"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Objects can overlap others, such that some will not be visible to the viewer.&lt;/p&gt;</description></item></channel></rss>