# Questions tagged [transformations]

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

150 questions
Filter by
Sorted by
Tagged with
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$, ...
1answer
7k 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"?
7answers
23k 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?
4answers
3k 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 ...
2answers
317 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 ...
1answer
925 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 "...
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?
3answers
10k 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 ...
2answers
154 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 ...
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 ...
2answers
220 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 ...
1answer
314 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 ...
1answer
422 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 ...
1answer
572 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 ...
1answer
343 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 ...
1answer
187 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 ...
2answers
269 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 ...
2answers
570 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 ...
1answer
98 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 ...
2answers
347 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 ...
2answers
2k 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 ...
2answers
629 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 ...
2answers
915 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 ...
1answer
212 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 ...
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 ...
2answers
159 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 ...
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 ...
1answer
270 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 ...
1answer
325 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 ...
2answers
957 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 ...
2answers
275 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 ...
1answer
151 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 ...
1answer
379 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(...
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 ...
2answers
332 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 ...
1answer
3k 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 ...
2answers
261 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, ...
1answer
70 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 ...
2answers
77 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 &\...
1answer
520 views

### Angle between two points in Cartesian coordinate system C++

I'm trying to rotate a rectangle so that it faces another rectangle in a spiral. Im using the Bullet pyhics library and freeglut for the 3d application, for anyone interested https://github.com/...
1answer
101 views

### Camera Model View transformation in Ray Tracing

I am implementing my own simple ray tracing and I came across some sort of confusion. When defining the verticies in the world I multiply them by the modelView transformation system (the matrix ...
2answers
120 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 ...
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 ...
1answer
1k views

### Computing camera front direction from Euler angles

I am new to OpenGL and Computer Graphics in general. Lately I was learning how to model a camera, specifically how to model the rotation of camera. I was introduced to Euler angles for this purpose. ...
2answers
183 views

### How to get the transform amount from a screen vector and a direction vector?

I am working on the move tool in a 3D modeling software. I need to know how much to move when the user drags an axis of the gizmo (for example along the x axis). I have the 2D vector describing how ...
2answers
554 views

### Rotate a cylinder from XY plane to given points

I am given geometry of a cylinder which lies on the XY plane with 1 unit radius. And given coordinates of 2 points in 3D I need to move the cylinder so that it connects the two points. What I tried ...
2answers
153 views

### Software to compose separate models into an articulated model?

I've inherited a system which animates a humanoid avatar by loading various models and manually calculating transformations for each one. I'm in the process of porting part of this system to Three.js, ...
3answers
636 views

### Point of view and rotation

Two questions which cross over maths/3D imaging/computer science. I'm trying to describe a point of view of an item in a 3d space and subsequently its rotation in a paper I'm writing. Versions I've ...
1answer
101 views

### Store 3d coordinates in a 2d image?

How can i store the X,Y,Z vertex points of a mesh into a 2d image, such that reading the image pixel values will correspond to the 3d coordinates? is it possible to just store x, y, values on a grid ...
1answer
458 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 ...