Skip to main content

Questions tagged [vectors]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
34 views

Projecting Vectors (3D to 2D) Using Homogeneous Coordinates, With Known Camera Calibration

Suppose I have vectors in a 3D space (their starting points, dx, dy, and dz), and I would like to project them onto a camera, which I already have as a 3x4 projection matrix. I can of course project ...
0 votes
2 answers
84 views

How are surface normals dealt with in the graphics pipeline?

I know the process for regular vertices is something like: model coordinates to clip space via the "MVP" matrix transformation, then perspective division, screen-space mapping, and finally ...
3 votes
1 answer
80 views

What to do with the homogeneous $w$ during vector operations

As I understand it: In graphics, 3D vectors are usually represented as homogeneous coordinates by storing an additional $w$ component known as the weight. The vector is divided by $w$ to obtain the ...
0 votes
0 answers
38 views

Environment map: inverting (phi, theta) to (x,y,z) mapping

I'm currently working on a ray tracer in C++ as an assignment. This ray tracer needs to take into account environment maps, which I also need to implement a part of. From my understanding of an ...
0 votes
0 answers
69 views

GLSL reflect function math correct?

In the documentation of GLSL - reflect given a surface normal $N$ and an incident vector $I$ the calculation being performed is reported as $$ \text{reflect}(I,N) = I - 2\text{dot}(I,N)N $$ I wonder ...
0 votes
1 answer
105 views

With a light source at (0,2,0) and unit cube (from [-1,1]) using a given shading formula, how is the r,g,b for each surface calculated?

The above problem is from a past Computer Graphics exam. I am particularly confused about the explanation given, firstly for the top and bottom planes (since the direction of normal for top plane ...
2 votes
1 answer
126 views

Trouble transforming vectors from view space to screen space using a perspective projection matrix

I can't for the life of me figure out how to use a perspective projection matrix. My understanding is that, once objects are in view space, the the perspective transform uses the z-coordinate to ...
0 votes
1 answer
272 views

Split a string of line segments into several other line segments

I have written a code to extend "n" points, constituting "n-1" lines ,to constitute more lines so you can map "m" data to "m" lines with m > n-1. This is the ...
1 vote
0 answers
86 views

Mathematical foundations of Signed Distance Fields in computer graphics

I have come across Signed Distance Field usage in Computer Graphics in construction of vector shapes, glyphs and 3D surfaces. However I can not find much of the background mathematical theory as to ...
1 vote
1 answer
84 views

Help understanding tangent from dot product and max distance from component wise vector multiplication

I am looking through this code and seeing two things which confuse me (well, the whole functions does) in the top functions. First, dir * p where ...
1 vote
1 answer
54 views

Plotting points along a 3D line segment

I'm trying to plot some points along a 3D line segment and could really use some help. In 2D, I've found success getting the angle of the line, the sine & cosine of the angle, and then adding the ...
0 votes
0 answers
96 views

How do I figure rotation from the difference between two vectors?

I've been playing around with an idea, but I'm struggling with some of the math involved. Now, each face of a mesh has a normal vector, and that the normal map fragment shader modifies that face ...
3 votes
1 answer
826 views

Video-games; Rendering textures on scope zoom-in. Texture compression problem?

This is general question. In the multitude of video-games that are not specialized in scoped warfare (like Sniper Elite), I've noticed that when you zoom in with a scope, the textures and normal maps ...
0 votes
0 answers
211 views

Crystal ball rotation - I don't get why the code works

For context: I'm absolutely new to graphics programming and I've always had trouble getting the math. I had the task to write code for a crystal ball interface using OpenGL. There's an object in the ...
0 votes
1 answer
75 views

Extending an orthogonal set of vectors (graphics application?)

Sorry if this is OT, but I'm wondering if there's a specific graphics technique in which it is required to extend a preexisting orthogonal set of vectors (not necessarily to a full basis, but perhaps ...
0 votes
0 answers
64 views

Mathematics in Computer Graphics

Can you please recommend some topic for research work related to mathematics in CG? (Maybe something like "Affine transformations in CG")
2 votes
0 answers
126 views

When should operations on 4D (homogeneous/projective) vectors use the w-coordinate?

Various operations on 2D vectors naturally generalise to 3D vectors simply by including the $z$-coordinate. The ones that come to mind are: Vector sum and difference Dot product Magnitude (Euclidean ...
0 votes
2 answers
131 views

3d Math Primer book equation derivation - Projecting One vector onto another

I'm reading the book 3d Math Primer for Graphics and Game Development 1st edition by Fletcher Dunn and Ian Parberry. On page 61 there's this: How does it derive $ v_{||} $ there? It doesn't follow ...
2 votes
1 answer
679 views

Calculating the angle between two polygons

For my application, I want to render models as polygonal surfaces in 3D space and have edges that are bent "outwards" to have a solid line and those who are bent "inwards" to have a dotted line. So if ...
1 vote
0 answers
159 views

Application of parallel transport in computer graphics and mesh processing

Does anyone know what applications has the computation of a parallel transport on a mesh? I'm talking about methods such as this one
2 votes
1 answer
94 views

Finding the normals of a tileable 2D surface extracted from 4D space

If I use a 4D noise function which returns a noise value and a four-part analytically derived gradient vector, I can create a 2D tile which is seamless (i.e. the opposite edges match) through ...
0 votes
1 answer
135 views

How do I derive this transformation

If I had two right handed frames where one has vectors [i, j, k] and another with corresponding vectors [u v w], how would I derive the transform M[i j k] <-- [u v w] when applied to any point P in ...
2 votes
1 answer
215 views

Morph Targets Normal adding math

I am trying to verify that if I have my inNormal and some N amount of morph normals that I would want to do something such as <...
0 votes
3 answers
801 views

Rotation of a random unit vector at a point in 3D space by an angle

I have a scenario where I need rotate a vector ( unit vector) at a point in space by an angle along Z-axis. Is it possible to help me to understand a procedure to achieve this. I'm using vb.net ...
5 votes
2 answers
169 views

Refraction: given an incoming and transmitted direction, can I deduce the normal?

It's easy to find guides to calculating the transmitted direction of light given an incoming direction, the normal, and indexes of refraction. However, I can't find anything about determining the ...
2 votes
1 answer
635 views

Vector Math for Raytracer

So i am working through the book "Raytracing in one weekend". At the point where i am at we want to check if a ray hits a sphere. For that we have the equation: ...
1 vote
0 answers
164 views

Basis vectors and plane equation

I'm trying to understand basis vectors and the plane equation and I am confused. From what I saw, if we take a basis vector i, j, k, each variable point to the axe (x, y, z). Are i,j,k scalars or ...
1 vote
1 answer
1k views

Perlin Noise with Smooth function vs Lerp

I tried implementing Perlin Noise using the Wikipedia as my main resource. From what I can tell my implementation of the ...
2 votes
1 answer
3k views

Creating vector shapes using only C++ [closed]

I've been researching for quite a while and I couldn't find any explanation or at least a how to create a vector graphic application (specifically in windows) where I can create a 3D vector shape, say ...
2 votes
2 answers
815 views

Can somebody explain this Ray Tracing Function?

I am currently reading through Peter Shirley's Ray Tracing in One Weekend. In the beginning chapters where the author introduces diffuse surfaces we a presented with this function: ...
11 votes
3 answers
7k views

What is the difference between a point transformation and a vector transformation?

This is what my lecturer told me in the coursework: We only consider 4*4 matrices. These are used to rotate, scale or translate objects (or any combination of these operations). Matrices are also ...
4 votes
1 answer
741 views

Normal vector in Phong Illumination Model should be normalized?

I'm studying Illumination subject these days and I was given a problem which asks to calculate the intensity using phong illumination model. I'm little bit confused whether I should calculate normal ...
5 votes
1 answer
170 views

Where should I project a polygon corner when it is behind me?

I am creating a simple 3D engine as a learning project to get the hang on spherical trigonometry. I am using the following approach. 1. A model consists of a lot of triangular faces. 2. Each triangle ...
2 votes
1 answer
90 views

How can I draw a tube on basis of position and angle between two 3d points?

I'm struggling with this idea of creating two particles in 3d and draw a tube between them. I can't figure out how to properly set the angle of the tube. I've used two approaches: calculating the ...
4 votes
0 answers
1k views

Represent vector with arrow

Another code review question. I am trying to draw an arrow to represent a vector. I have started with an unit arrow with vertices defined as follows: ...
4 votes
2 answers
193 views

intersection between line segments - narrowed precondition

I believe that the issue may already have been discussed here. I want to find if two line segments does intersect and if they do then find and store and intesection points. Now it is already confirmed ...
24 votes
1 answer
26k views

Get vector length with GLM

I am quite confused over how GLM library is behaving or I am using it improperly. glm::vec2 testVec(6,-4); float len = testVec.length(); I get the value ...
5 votes
1 answer
1k views

Test if a point is on a line segment

I have a line segment defined by two end points. And I have another randomly chosen third point and I want to find out if the third point is on the line segment or not. By "On the line segment", I ...
5 votes
1 answer
2k views

Interpolating vectors on a grid

If you have values on a grid and you want to find the value of a point within one of the cells, you can use techniques like bilinear or bicubic interpolation to get the data at that point. What ...
4 votes
2 answers
2k views

Correct view-space transform

I am attempting to model a simple graphics pipeline (i.e. Local->Word->View->Screen->2D spaces). I've been looking at the algorithm required to transform from world to view-space and using the ...
8 votes
2 answers
2k views

Ray tracing with thin lens camera

I'm reading Cook's paper "Stochastic Sampling and Distributed Ray Tracing", I don't understand how the rays are generated. He says: Determine the focal point by constructing a ray from the eye ...
6 votes
1 answer
399 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 ...