User Supernormal - Computer Graphics Stack Exchange most recent 30 from computergraphics.stackexchange.com 2022-01-27T02:31:16Z https://computergraphics.stackexchange.com/feeds/user/4650 https://creativecommons.org/licenses/by-sa/4.0/rdf https://computergraphics.stackexchange.com/q/8219 0 How to compute A and B in projection matrix Supernormal https://computergraphics.stackexchange.com/users/4650 2018-11-04T20:18:11Z 2018-11-04T21:40:54Z <p>I'm trying to compute a projection matrix to transform from view space to NDC with a near clip plane at -1 and far plane at +1. The general form of this matrix (disregarding aspect ratio and focal length) should be</p> <p><span class="math-container">$\begin{bmatrix}1&amp;0&amp;0&amp;0\\0&amp;1&amp;0&amp;0\\0&amp;0&amp;A&amp;B\\0&amp;0&amp;-1&amp;0\end{bmatrix}$</span></p> <p>I followed SongHo's guide at <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html" rel="nofollow noreferrer">http://www.songho.ca/opengl/gl_projectionmatrix.html</a> which sets <span class="math-container">$A=-(f+n)/(f-n)$</span> and <span class="math-container">$B=-2fn/(f-n)$</span>. </p> <p>However, setting the near clip plane at <span class="math-container">$n=-1$</span> and <span class="math-container">$f=-10$</span> (in view space) and using these <span class="math-container">$A$</span> and <span class="math-container">$B$</span>, I get points with <span class="math-container">$z$</span> values on the interval <span class="math-container">$[-1, -10]$</span> transformed to <span class="math-container">$[3.04, 1.04]$</span> (after homogenisation). </p> <p>When I do the derivations myself, I'd like to set <span class="math-container">$A=(n+f)/(n-f)$</span> and <span class="math-container">$B=(-2fn)/(n-f)$</span> instead, which indeed transforms to <span class="math-container">$[-1,1]$</span> instead.</p> <p>Am I doing something wrong?</p> https://computergraphics.stackexchange.com/q/5861 3 What happens with the framebuffer after the fragment shader is done? Supernormal https://computergraphics.stackexchange.com/users/4650 2017-11-13T07:51:43Z 2017-11-13T09:42:58Z <p>I'm wondering what happens with the framebuffer between the time that the fragment shader is done, and the time when it appears on my screen. </p> <p>Is my understanding correct if I assume that the framebuffer is in memory on the GPU, which is then copied back to the CPU side after glDrawX is completed, and then fit to a window somewhere on the screen, and then sent through my HDMI cable (via the GPU again!) to my monitor?</p> https://computergraphics.stackexchange.com/questions/4272/mapping-of-cylinder-to-2d-plane/4353#4353 3 Answer by Supernormal for Mapping of cylinder to 2D plane Supernormal https://computergraphics.stackexchange.com/users/4650 2016-12-05T15:35:43Z 2016-12-05T15:35:43Z <p>You already have a 2D parametrisation, don't you? One of the dimensions is the longitudal axis (in mm?) and the other is the circumferential axis (in degrees). The only problem I see is when you have rectangles wrapping around the 0/360-degree boundary. One workaround for that would be to duplicate each rectangle (or just the ones on the boundary) so that you get one copy on each side of the boundary. Does that help? And if you need to have a distance, and not an angle, for the circular dimension, that is readily available as $l = r a \pi/180$, where $r$ is the radius and $a$ is the angle in degrees.</p> https://computergraphics.stackexchange.com/q/4322 10 Why normalise Lambertian BRDF by 1/pi? Supernormal https://computergraphics.stackexchange.com/users/4650 2016-11-28T04:43:33Z 2016-11-28T06:13:52Z <p>Why is a Lambertian BRDF normalised by dividing by $\pi$? Since the area of a unit sphere is $4 \pi$, and the area of the half sphere above the surface is $2 \pi$, shouldn't it rather be $1/(2\pi)$?</p> https://computergraphics.stackexchange.com/questions/4322/why-normalise-lambertian-brdf-by-1-pi/4323#4323 9 Answer by Supernormal for Why normalise Lambertian BRDF by 1/pi? Supernormal https://computergraphics.stackexchange.com/users/4650 2016-11-28T06:13:26Z 2016-11-28T06:13:26Z <p>I think I got it! </p> <p>Because $cos(\theta)$ integrates to $\pi$ over the hemisphere (and not $2\pi$). And the incoming light is multiplied by $cos(\theta)$ (and the BRDF).</p> https://computergraphics.stackexchange.com/q/3684 4 How to correctly implement Lambertian BRDF with point light Supernormal https://computergraphics.stackexchange.com/users/4650 2016-06-27T12:43:05Z 2016-06-27T21:20:34Z <p>I'm implementing a simple Lamberitan BRDF in GLSL, using a point light source. My fragment shader simply returns <code>light_colour * 1.0/PI * cosine</code>, which should model a fully diffuse white material. </p> <p>However, it looks rather dark... If I have a point light with colour (1,1,1), and no attenuation with distance, the maximum brightness of the material (at normal incidence) will be 1/3 (dark grey). </p> <p>Is this just because I am using a physically incorrect point light with zero size? Is there any "correct" value for the light colour in this case, if I want the surface to be white at its brightest parts?</p> https://computergraphics.stackexchange.com/questions/8219/how-to-compute-a-and-b-in-projection-matrix?cid=11098 Comment by Supernormal on How to compute A and B in projection matrix Supernormal https://computergraphics.stackexchange.com/users/4650 2018-11-04T22:07:08Z 2018-11-04T22:07:08Z Are they really equivalent, though? I mean, the first $B$ is $-2fn/(f-n) \neq -2fn/(n-f)$ (i.e., my $B$). https://computergraphics.stackexchange.com/questions/8219/how-to-compute-a-and-b-in-projection-matrix/8220?cid=11094#8220 Comment by Supernormal on How to compute A and B in projection matrix Supernormal https://computergraphics.stackexchange.com/users/4650 2018-11-04T21:26:56Z 2018-11-04T21:26:56Z Thanks! But what does my matrix do, then? Doesn&#39;t it transform from a view space (with a perspective camera at the origin looking into -z) to a &quot;clip space&quot; (rectangular view volume) where far points have larger z values? https://computergraphics.stackexchange.com/questions/4272/mapping-of-cylinder-to-2d-plane?cid=5923 Comment by Supernormal on Mapping of cylinder to 2D plane Supernormal https://computergraphics.stackexchange.com/users/4650 2016-12-05T07:08:12Z 2016-12-05T07:08:12Z You already have a 2D parametrisation, don&#39;t you? One of the dimensions is the longitudal axis (in mm?) and the other is the circumferential axis (in degrees). The only problem I see is when you have rectangles wrapping around the 0/360-degree boundary. One workaround for that would be to duplicate each rectangle (or just the ones on the boundary) so that you get one copy on each side of the boundary. Does that help? And if you need to have a distance, and not an angle, for the circular dimension, that is readily available as l = r<i>a</i>pi/180, where r is the radius and a is the angle in degrees. https://computergraphics.stackexchange.com/questions/4349/what-is-the-most-physically-accurate-model-of-surface-materials-possible-in-comp?cid=5922 Comment by Supernormal on What is the most physically accurate model of surface materials possible in computer graphics? Supernormal https://computergraphics.stackexchange.com/users/4650 2016-12-04T21:31:22Z 2016-12-04T21:31:22Z A BSDF (a complete scattering function, including BRDF (reflection part), BTDF (transmission part), and BSSRDF (subsurface part)) as part of the rendering equation, should be &quot;the best&quot; model, just with a couple of caveats. First, there is not one BSDF model but many, each with different tradeoffs. So it really comes down to which BSDF/BRDF you use. Second, they often assume &quot;particle optics&quot; and skip the wave properties of light. That&#39;s a drawback that means that you can&#39;t model some phenomena. (Polarization, and &quot;CD diffraction&quot;, e.g.)