Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [transformations]

Transformations are mathematical operations that can be applied to an object to change its scale, position and orientation.

22
votes
2answers
6k views

Why is the transposed inverse of the model view matrix used to transform the normal vectors?

When rendering 3D scenes with transformations applied to the objects, normals have to be transformed with the transposed inverse of the model view matrix. So, with a normal $n$, modelViewMatrix $M$, ...
21
votes
1answer
6k views

What are Affine Transformations?

What are Affine Tranformations? Do they apply just to points or to other shapes as well? What does it mean that they can be "composed"?
13
votes
7answers
21k views

Why are Homogeneous Coordinates used in Computer Graphics?

Why are Homogeneous Coordinates used in Computer Graphics? What would be the problem if Homogeneous Coordinates were not used in matrix transformations?
12
votes
4answers
2k views

When should quaternions be used to represent rotation and scaling in 3D?

Quaternions (a four-dimensional extension of complex numbers) can used to represent rotation and scaling of a 3D vector, and the application of a quaternion onto a 3D vector involves two quaternion ...
12
votes
1answer
888 views

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

To be more concrete, I'm working on an iOS app, and have a CATransform3D struct (basically a 4x4 transform array). Is it possible to deduce all the different "...
12
votes
2answers
304 views

Ray Transformation to Object Space for Motion Blur

My raytracer supports a wide variety of objects. To intersect them, I use the standard technique of transforming rays into object-space. This works fantastically until I add motion blur. I model ...
10
votes
2answers
4k views

Cause of shadow acne

I know how shadow mapping works but I am not getting the cause of shadow acne! Can anyone tell me cause of shadow acne in a simple way and how is it related to depth map resolution?
9
votes
1answer
262 views

Moving each point of a surface in direction of corresponding normal

So let assume that I have some convex smooth and unclosed surface. I'm moving each point of it in a normal direction by some constant factor (This factor is same for all points on surface). Can I ...
9
votes
1answer
290 views

Apply distortion to Bézier surface

I am trying to simulate the image warp effect, that is used in Adobe Photoshop. The rectangular image is warped according to a cubic Bézier surface (in 2D, all Z components are 0). Having any Bézier ...
8
votes
2answers
135 views

When is it better to upload partial model matrices to the vertex shader?

As of now, when rendering my scene and while iterating through the scene graph, for each node its model matrix is calculated from the parent's model matrix and the scene node's pose. This is quite ...
8
votes
1answer
273 views

How to invert an affine matrix with small values?

I'm using an affine transformation matrix to transform 2D coordinates from screen (magnitude 10e3) to small parts of fractal sets (magnitude as little as 10e-15). I also need to map the other way ...
8
votes
2answers
215 views

What transformations should I apply to a model to produce this 3D effect?

I saw a video on YouTube where a person uses a transparant, knotted pyramid to display "holograms" using their smartphone. (I have not been able to reproduce this yet, so I can't tell for sure if it ...
8
votes
1answer
387 views

Calculate aspect ratio from 2D shape in 3D space

Given the 4 coordinates of a 2D shape in a 3D space I want to calculate its aspect ratio. The 3D space is created with 2 vanishing points. The 4 coordinates - marked blue - are the 2D coordinates on ...
7
votes
3answers
9k views

How to combine rotation in 2 axis into one matrix

I already know about the matrices I have to use in order to perform rotations. If I have to rotate in z-axis and then in x-axis, I would do it in 2 steps. My question is, is it possible to combine ...
7
votes
2answers
253 views

Is there a objective reason for matrix naming conventions?

I'm probably going to screw this up but.... In all the graphics libraries I've seen various matrices are often called something along the lines of ...
7
votes
2answers
533 views

Rotate line around center

I have to use a propriertary graphics-engine for drawing a line. I can rotate the whole drawing by its origin point (P1). What I want, is to rotate it around its center point(M). So basically that it ...
7
votes
1answer
534 views

Animating a smooth linear transformation

After watching this video on matrices, I tried to make a simple animation of 2D linear transformations. Starting with a set of 2D points in a grid, I applied a 2x2 matrix to each point and obtained a ...
7
votes
1answer
97 views

implementing right handed coord system APIs on top of a left-handed rendering engine

I am trying to plug in a 3D game engine as the rendering engine for an existing graphic API system that uses a right-handed coordinate system. Game engines often uses a left handed coordinate system ...
7
votes
2answers
259 views

Color transform algorithm (that also works on saturation and value/lightness)?

To change particular colors in an image, generally you multiply the RGB by a transformation matrix. Image manipulation programs such as gimp & photoshop have a selective color change function that ...
7
votes
1answer
177 views

After a deformation operation on polygons, how can I check for and fix inverted polys?

I'm doing a quick and dirty automated deformation routine on a polygon body. If it was a tree, and my axis was in the center of the tree, I would like to bend the body by bending the axis. I would ...
6
votes
1answer
194 views

Graphics Pipeline: Viewspace & Back face culling incorrectly

I'm attempting to model a simple graphics pipeline - using Matlab at the moment as a modelling tool to get the transformations correct. I appreciate there are software tools that would make this ...
6
votes
2answers
158 views

Finding the angle of any side of a polygon

I'm trying to find the angle it would take for me to rotate a polygon so that a specific side is completely horizontal and on the bottom. For example, a shape like this: Needs to be rotated so the ...
6
votes
1answer
2k views

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

I've been going over some OpenGL learning resources and one of them is this article: Modern OpenGL 04 - Cameras, Vectors & Input in which the author presents an approach to building a ...
6
votes
2answers
843 views

Rotating object around its own center

I am trying to implement Blades of Waving Grass and I am still stuck at the point where I need to achieve texture arrangements like in the figure below (the first one). So my plan is to draw the ...
6
votes
2answers
238 views

Why if we rotate an object by R and then translate it with T, from the object perspective, we're actually applying $-T$ and then $-R$

I've been introduced to local coordinates in contrast to the global ones which I was used to work on, where we have basically the camera at the origin. For example, I've the following picture of a ...
6
votes
1answer
348 views

How to convert decomposed transformations between different coordinate systems?

I am converting some Unity3D scenes to a proprietary json format to be used by my OpenGL renderer that uses a different coordinate system from Unity's. I have multiple sets of {translation, rotation(...
5
votes
2answers
1k views

Image rotation using FFT

I'm not sure how practical this might be but is it possible to use Fast Fourier Transform to rotate a raster image? To be honest, I never really understood FFT, but I saw it being used for JPEG, for ...
5
votes
2answers
305 views

Can a scene graph be stored in the GPU?

I am starting to learn WebGL. Can a scene graph be stored in the GPU? Or is that type of thing more for the main thread (or webworker)? For example, I want to calculate some layout, and apply it as a ...
5
votes
1answer
2k views

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

This is a rather primitive question coming from an electronic engineer. When applying rotate (about origin), scale (in which we shall translate towards origin and then back) and translate, does it ...
5
votes
2answers
428 views

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

I've been reading around that matrices (for example, rotation matrices, but not only) can be thought somehow as coordinate systems. My question is: how is that possible? I've seen for example that ...
5
votes
2answers
793 views

Screenspace Normals - Creation, Normal Maps, and Unpacking

I'm trying to condense my Deferred Rendering G-Buffer. So I have some questions about getting 2-component Screenspace Normals. I know Frostbite and Killzone (the only two AAA company's G-Buffers I ...
5
votes
1answer
2k views

Zoom in orthographic vs perspective projection

I have read through this article about perspective and orthographic projection matrices. I started playing with the perspective matrix and as expected if I either increase/decrease the field of view ...
5
votes
1answer
1k views

Image rotation algorithm

I would like to rotate a raster image by an arbitrary angle. I don't really care for speed: the rotation should be of highest quality possible. Could someone please suggest a suitable algorithm? I'm ...
5
votes
2answers
117 views

Correctness of logical steps for create the matrix of viewing transformation

In general, I understand the creation of viewing transformation matrix, but I have my doubts. For example, let's say that a world coordinate (called $A$) has a center at $(1,1,1)$, and the view ...
5
votes
1answer
247 views

Transformation Matrices

Consider the following problem and its answer: Given 3 points in 3D: $A=(A_x,A_y,A_z); B=(B_x,B_y,B_z) ; C=(C_x,C_y,C_z)$ Find the transformation matrix (in homogeneous coordinates) that ...
5
votes
1answer
278 views

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

I was reading "3D Math Primer for Computer Graphics and Game Development" and there was something the author had said that I thought was particularly interesting, he stated It is important to ...
5
votes
1answer
143 views

How to get polygon coordinates in screen space

I need to be able to click on this polygon in 2d. This polygons set of vertices aren't in the same space as the screen. (Ie: the edge of the screen may be a value of 20 in one space but 1920 in the ...
5
votes
1answer
364 views

Rotation matrix for a 3D object in space

This is the follow-up question from here: Minimum requirements to uniquely represent a 3D object in space Assume I have 3 original points in a 3D object (in 3D space) as ...
5
votes
1answer
142 views

Calculate Transformation between two point sets - but with constrained Degrees of Freedom

How can I calculate the rigid transformation [R|t] between two 3d triangles, but restricted to a given N degrees of freedom (for N = 1..6) ? I know for N=6 I can get a least-squares solution via SVD ...
5
votes
1answer
537 views

Normal 2D photo to VR-compatible spherical photo

How to turn a normal photo like this one : into a photo that I can use in my game development platform (Unity3D). I just wrap a 3d sphere model with the photo and then it can be all around me when I ...
5
votes
1answer
329 views

Understanding view matrix

I've been reading several sources in the web about transforming world-space points into camera-space ones. I am building my view-matrix from the following parameters ...
4
votes
3answers
3k views

Computing a rotation: complex numbers vs rotation matrix

A 2D vector can be rotated by an angle $\theta$ using the rotation matrix: \begin{bmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{bmatrix} Or, it can be rotated by ...
4
votes
1answer
81 views

Is there a way to script image creation?

I am facing a though challange - I need to perform repetitive Image formating. Firstly, I need resize picture A so that it has some fixed width in pixels. Then, I need to place picture A in the middle ...
4
votes
2answers
226 views

Minimum requirements to uniquely represent a 3D object in space

Let's assume we have a 3D object (in 3D space). We get a single representation vertex from this whole 3D object. Given the fact that the object can be moved and rotated in the space in any direction, ...
4
votes
2answers
279 views

What's a parent vector space or coordinate system?

After asking this question, a few new terms that I had never heard of came up. Note, I'm quite familiar with linear algebra, but I've never heard these terms in the context of linear algebra. ...
4
votes
2answers
877 views

How to determine the object-to-world matrix

I want to ray trace a triangular mesh that I load from a file. The vertices' coordinates are expressed in the reference frame associated with the object (i.e the mesh) and I don't know the object-to-...
4
votes
1answer
68 views

Why is the color in the cube being weirdly swapped?

I am implementing a trackball, i.e. a camera orbiting about a fixed point, in my case the origin. When I do left click with the mouse and start moving it, I compute delta values for the angles of a ...
4
votes
2answers
75 views

Supporting multiple camera types in a deferred renderer without specializing the shaders or in the shaders

Perspective Camera A (row-major) perspective transformation matrix has the following format: $$\begin{align} \mathrm{T} &= \begin{bmatrix} \mathrm{T}_{00} &0 &0 &0 \\ 0 &\...
4
votes
1answer
180 views

Calculate a rotation around an arbitrary axis

Suppose I have two 3D triangles before & after a single rotation around an unknown axis. How would I go about finding this axis?
4
votes
1answer
188 views

Affine Transformation

We have a matrix $$\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix}$$ This matrix represents a ...