20 votes
Accepted

Cause of shadow acne

Image 1: A bad case of shadow acne. (Synthetic and a bit exaggerated) Shadow acne is caused by the discrete nature of the shadow map. A shadow map is composed of samples, a surface is continuous. ...
joojaa's user avatar
  • 8,437
17 votes
Accepted

What is the correct order of transformations scale, rotate and translate and why?

Usually you scale first, then rotate and finally translate. The reason is because usually you want the scaling to happen along the axis of the object and rotation about the center of the object. In ...
JarkkoL's user avatar
  • 3,636
11 votes
Accepted

Computing a rotation: complex numbers vs rotation matrix

Both methods end up doing the same calculations when you break it down. Rotating a vector $u$ with a matrix: $$\begin{bmatrix}\cos\theta & -\sin\theta \\ \sin\theta & \cos\theta\end{bmatrix} \...
Nathan Reed's user avatar
11 votes
Accepted

Is it possible to turn a 3d rotation matrix (4x4) into its component parts (rotation, scale, etc.)?

You can decompose the matrix $\mathbf{M} = \mathbf{TRS}$ into basic transformations: translation, scaling, and rotation. Given this matrix: $$\mathbf{M} = \begin{bmatrix} a_{00} & a_{01} & a_{...
user5488's user avatar
  • 156
10 votes

Cause of shadow acne

As an addition to the answer of joojaa: Using a bias to offset the shadow function does indeed solve the problem with shadow acne, but it can introduce an additional problem: Peter Panning As you see ...
Dragonseel's user avatar
  • 1,810
7 votes

Is there a objective reason for matrix naming conventions?

I think the naming order is intuitive because it is in reading order (left to right), e.g., worldViewProjection means that your point/direction is first multiplied by the world matrix, then the view ...
vgs's user avatar
  • 311
7 votes

Why are Homogeneous Coordinates used in Computer Graphics?

Imagine you want to represent transformations using matrices. Points could be stored as $$\begin{bmatrix}x\\y\end{bmatrix}$$ and you could represent a rotation as $$\begin{bmatrix}u\\v\end{bmatrix}=\...
Chuck's user avatar
  • 296
7 votes
Accepted

Moving each point of a surface in direction of corresponding normal

No this cannot be modelled by (non-uniform) scaling. It's fairly easy to construct a counterexample: The issue is that the amount a section of the curve/surface grows depends on its curvature, not ...
Martin Ender's user avatar
  • 2,730
7 votes
Accepted

How to invert an affine matrix with small values?

I found a solution to my specific problem. Instead of computing the determinant and hitting the precision wall, I use the Gauss-Jordan method step by step. In my specific case of affine ...
solendil's user avatar
  • 251
7 votes
Accepted

Zoom in orthographic vs perspective projection

Perspective projection changes the size of an object as it's distance changes, while orthographic projection does not. That is part of the definition of those projection types. To simplify things a ...
Alan Wolfe's user avatar
  • 7,801
7 votes

Can a scene graph be stored in the GPU?

Short answer: Yes, It can be done. But no one does so. Long answer: Scene graphs can be stored and processed on a GPU using OpenCL/WebCL. But it is not practical to do so. Updating scene graphs (a ...
Mary Chang's user avatar
7 votes
Accepted

Why do I need to inverse the orientation matrix of a camera to be able to translate it in the direction it is facing?

People always forget that there is no "camera" in OpenGL. In order to simulate a camera you have to move the whole world inversely. So if you want ur camera looking 30 degrees downward, you move the ...
gallickgunner's user avatar
6 votes

Rotate line around center

Trick is, to move the entire object so that the point about which you want to rotate is at the center. Then rotate and after that counter move it so that the point is were it was. In fact this is not ...
joojaa's user avatar
  • 8,437
6 votes
Accepted

Graphics Pipeline: Viewspace & Back face culling incorrectly

I (believe) I've solved this (even if it has taken 2 days). My problem was essentially I wanted to take the dot product of the face normal, and line-of-sight vector like below And determine the angle ...
davidhood2's user avatar
6 votes
Accepted

Animating a smooth linear transformation

As a general rule, you cannot interpolate transformation matrices. In stead, you decompose them into their individual values, then interpolate those and recompose. The Möbius transformation as ...
Paul-Jan's user avatar
  • 266
6 votes
Accepted

Minimum requirements to uniquely represent a 3D object in space

A rigid body has 6 degrees of freedom, in 3D- space. So that means you need 6 values to represent the object. The common way to do this is to store a position vector for position and 3 rotations. But ...
joojaa's user avatar
  • 8,437
6 votes

Gimbal lock confusion

Gimbal lock is your item 1. It is the situation where we have rotated our 2nd axis (in the order of application of the three axes) by ±90 degrees, which aligns the 1st axis and the 3rd axis together, ...
Nathan Reed's user avatar
5 votes
Accepted

Apply distortion to Bézier surface

Edit: changed the answer according to new images and clarification. for every control point p(k, n) p'(k, n) = ( p(k, n) - p(k) ) * d * l(k) + p(k, n) where <...
Cem Kalyoncu's user avatar
5 votes

Unwinding an image on a spiral to make it long and flat

A quickly formulated method, read first one that popped in my brain (not best), could be. Find the closest points on a parametric spiral for each sample (read A Pixel Is Not A Little Square3). Then ...
joojaa's user avatar
  • 8,437
5 votes
Accepted

3D rotation matrix around vector

There is a direct formula for the rotation matrix for an arbitrary axis and angle. Given a unit vector $a = (a_x, a_y, a_z)$ and angle $\theta$, the matrix can be constructed as follows (derivation ...
Nathan Reed's user avatar
5 votes

Is there a objective reason for matrix naming conventions?

The order is arbitrary, but if you want to be compatible with physics textbooks then your notation is mostly set. The difference is that you seem to think that its more natural to observe the systen ...
joojaa's user avatar
  • 8,437
5 votes

How is that possible that matrices can be thought as coordinate systems?

If you have a 3x3 matrix representing some transformation, you will actually have the X,Y,Z vectors of that transformation in the rows or columns (depending on if it's a row major or column major ...
Alan Wolfe's user avatar
  • 7,801
5 votes

why is translating in 3D space the same as shearing in 4D space?

In a linear transformation system, your origin is always a fixed point, since 0*anything = 0. So imagine you have a cinema screen, and the origin is at the centre of the screen. Using linear ...
russ's user avatar
  • 2,392
5 votes
Accepted

Why does this gl_FragDepth calculation work?

What you are missing is, that in OpenGL's NDC space (i.e. clip space after division by w) all 3 coordinates are in the range $[-1,1]$. So ...
Christian Rau's user avatar
5 votes

How to keep an object constant in screen space?

Scale the object proportional to its depth (z in camera space) and it will retain the same size on screen regardless of its position in world space. Additionally, you might also wish to scale the ...
Nathan Reed's user avatar
5 votes
Accepted

What is this graphical effect called?

I don’t think there’s a formally established name for it, but it’s generally known as distortion, warping, or refraction. It works by taking an already rendered version of the current frame, sampling ...
Noah Witherspoon's user avatar
4 votes

Image rotation algorithm

It speed does not matter, I suggest to use a truncated sinc or a Lanczos isotropic kernel: to compute a target pixel, you back-rotate the filter and convolve it with the image. Since it is isotropic, ...
Fabrice NEYRET's user avatar
4 votes
Accepted

Transformation Matrices

The answer in the screenshot is wrong on two counts. First, you're correct that in the middle matrix the −1 should be on the third row, not the second. The other error is that the $u, v$ basis vectors ...
Nathan Reed's user avatar
4 votes
Accepted

Affine Transformation

It is not necessarily affine. An affine matrix in homogeneous coordinates has a form like: $$\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ 0 & 0 & 1 \...
Nathan Reed's user avatar
4 votes

Computing camera front direction from Euler angles

This kind of navigation works well for situations that are centered about objects. It keeps the up vector always pointing upward which makes it less possible for confusion. Bringing quaternions into ...
joojaa's user avatar
  • 8,437

Only top scored, non community-wiki answers of a minimum length are eligible