# Questions tagged [mathematics]

The knowledge of the numbers, formulas, shapes and quantities. In the computer graphics, almost exclusively linear algebra is being used.

191 questions
Filter by
Sorted by
Tagged with
76 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 ...
27 views

### Interpolate Gradients to Vertices of triangular mesh

A well known way of interpolating the gradient field of a scalar field onto faces of a triangular mesh uses the following formula (source: https://www.cs.cmu.edu/~kmcrane/Projects/HeatMethod/...
40 views

### Parametric equation for Catenary curve between two Points

I have two points in 3D space, A and B. I need to have a parametric equation of the catenary curve such that: Cat(0) = A, Cat(1) = B, Cat(t)= f(t, A, B) How can I derive the function f
80 views

### Whats the best way to render (2D) parametric curves with uniform stroke width?

I want to create a rendering engine that mostly renders parametric curves on a 2d screen. As far as it seems, todays graphics are all dependent on vertices and matrices, so not sure where to start or ... 1 vote
76 views

### How to compute discrete partial derivatives in 3D

I'm supposed to compute partial derivatives for 3D volume rendering (in ray tracing). I'm bad at math and so I can't understand what $f$ is in my case. In reviewing examples, I'm seeing the $f$ ...
19 views

### Meshing a set of boundaries?

Say I have a set of closed curves in 3D. I want to connect them together into a 2D manifold mesh. Something kinda like the drawing, where you are making a triangle mesh that is manifold an connects ...
34 views

### Robust convex hull in 3D?

I implemented gift wrapping in 3D, but I am finding it's just AWFUL at handling anything with coplanarity. I have spent the entire day trying to fix kinks. Naively I thought that if I detected ...
57 views

### Splitting Floats To Texture Channels

I know, this is a silly question, but since I need this so often, I just want to double check that I made no mistake. Working with most shader languages, a texture can store $8$ bits per channels, ...
155 views

### Can you explain to me the Bresenham's line algorithm in simple terms?

I've been trying to wrap my head around this algorithm, and I need it for my drawing function. But I can't seem to understand it. The Wikipedia page gives this piece of code right at the end: ...
39 views

### Approximate compass bearing of a normal

Let's say I have a 3D model that represents a small real-world space; it could be bounded by a 10" by 10" by 10" box. I know the real-world compass bearing for an observer in the center ...
59 views

### Trying to represent an image in isometric projection

I have a program where I receive coordinates (x, y, z) and then I should display these coordinates on the screen according to the isometric projection. On the wikipedia section about isometric ...
1 vote
97 views

### Can you encode a reflection in a quaternion?

Say we have the transformation: \begin{bmatrix} 1 & 0 & 0\\ 0 & 0 & 1\\ 0 & 1 & 0\\ \end{bmatrix} i.e. the matrix that encodes swapping the z and y axes. This is equivalent to ...
46 views

### importance sampling in AO

I have a fairly strong background in maths and I'm having troubles grasping why in every single paper about SSDO, the sin term for integrating over the hemsiphere is dropped. for instance in the below ...
23 views

### custom 8Bits RGBA textures YCoCg encoding decoding with 16 bits Y packing not working correctly

Context: I'm working on a way to get "ugly" GI for (very) low end platform (lowest target being Mali 400 mp GPU) through texture feedback (double buffering of indirect light) and texture PVS ...
91 views

### Point a normal vector towards a point in 3D-Space

Given a normal vector in 3D-Space, how can I rotate the vector, such it points to a point in 3D-Space. I tried couple of ways doing this, which ended up looking completely wrong.
81 views

### Plot inverse of emulated double-precision floats

I need to accurately plot a line chart using WebGL. The numbers have a precision of around 33 bits - that's too many to fit into a single-precision float's mantissa. WebGL does not support the double-...
18 views

### Automate Image resize, scale, position for best quality (size)

I have a process where a web user selects a photo for a profile image. User is then presented with a canvas to zoom, rotate and move their image within a square viewport. Once satisfied, the user ...
1 vote
44 views

### How do I convert pathtraced distance to value that is usable by OpenGL's depthbuffer?

I was hoping someone could check my understanding. I've got a pipeline that does some path tracing, and then draws some debugging rays using standard rasterization. I'm trying to get depth to work ...
97 views

### View rotation matrix

Im unsure about how I could describe what im trying to achieve in few words or a title so ill go on to describe it. So I have voxel, in 3D space, represented solely by its center. The voxel though, is ...
1 vote
218 views

### How to determine transformation matrix for an object given a graph?

I am given this image: and asked to determine the transformation matrix that took me from ΑΒΓΔΕ(let's call it ABCDE for convenience) to Α'Β'Γ'Δ'Ε' (A'B'C'D'E'). I am also given the solution, so as to ...
1 vote
148 views

### What projection matrix and world transformation do I need to have an isometric projection?

I'm doing my own engine in college to display a wireframe on screen with an isometric projection but I literally can't find any literature about maths behind doing it by hand just for game engines ...
1 vote
101 views

### 3D to view plane projection

I am trying to draw points of a 3D sphere onto my monitor as if I was looking out into space. Me, the viewer, is at (0, 0, 0). The plane of my monitor is at (x, y, 1) and I have a sphere out in ...
69 views

### Converting a Bezier Path with variable width stroke to an outline?

I started working on a "stylus annotation program", and as part of it I need an algorithm that convert a path with width indicators to an outline. This is similar to the Advanced Outline ...
40 views

### Getting something close to the convex full of SDFs using CSG operations

Inigo Quilez has an explanation of smooth operations to join sdfs. I am trying to get something close to the convex hull of multiple sdfs. For starters let;s consider a simple case of 3 cubes int eh ...
174 views

### Is it possible to make a projection matrix to not project in the center?

I have the following projection matrix: and I need to make a hole in the center of my matrix, something like that: (I don't want to project a custom W and H) Is that possible ? Thanks.
1 vote
101 views

### Defining the proper sdf for this structure

I am making a procedural sdf (just a bunch of cubes) based of an image. The idea is very simple. We have a stencil image: Each texel in the image corresponds to a 3D cube. So to ray trace what I am ...
91 views

### Error in equation 2.1. in Ray Tracing Volume Densities

I am reading through Kajiya - Ray Tracing Volume Densities paper. And I've already got stuck into section 2. I wonder if there's a mistake in that equation. I'll quote the relevant bit The quantity ...
130 views

### physics/math of lighting gradient of a 3D object

Consider a monochrome ball. The colours of the pixels is a function of the point height, the light intensity, the light angle, and the surface material (reflection). What is the simplest formula ...
1k views

### vulkan perspective matrix vs opengl perspective matrix

Hi I have a slight confusion in using the opengl perspective matrix in vulkan. glm's perspective matrix works directly in vulkan just by multiplying the "[1,1 term by -1 but when I compared the ...
259 views

### Having trouble implementing distance transform with jump flood

I'm attempting to use the jump flood algorithm to compute distance transforms of an arbitrary texture derived from a canvas2d context, roughly following the explanations detailed here/here. In the ...
1 vote
122 views

### Conflicting definitions for the distribution of normals $D$ in microfacet BSDFs

Please do not confuse this question with this one. In Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs, Eric Heitz defines the distribution of normals as. There, the footnote. ...
1 vote
279 views

### Half Edge criterion to check if an edge flip is illegal?

I am trying to determine if and when flipping an edge is topologically valid. The current criterion I have is that it is only valid if there is no edge connecting the opposite vertices of the edge. I....
160 views

### Deriving formula for perspective correct interpolation

I am trying to derive the formula for perspective correct texture interpolation on my own while implementing my own software rasterizer (projecting an arbitrarily rotated triangle in camera space on ...
173 views

### Cubic Splines - Do Parametric and Explicit representation give different curves?

I asked a similar question here before but since the previous post original question was different, I think it was confusing people. So I've voted to close that and asking the new question here. I'm ...
1 vote
73 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 ...
108 views

### How compute new camera parameters given a velocity vector?

My goal is to update camera parameters given a velocity vector so that the camera points in the direction of the velocity vector. How should one compute the update matrix for the camera parameters?
349 views

### Fake cubic Hermite spline interpolation with smoothstep

When scaling an image with Bicubic Interpolation, the Cubic Hermite spline interpolation is used. smoothstep is one of the four basis/blend functions of this kind ...
41 views

### Computing heat diffusion creates weird results

I am trying to model heat diffusion on the surface of a mesh. I annexed the most important bits of theory about this topic as screenshots on the question see the bottom. The crux of the issue is we ...
41 views

### Is this way of transforming QMC samples into barycentric tri coordinates agnostic to mesh-topology?

While I'll try my best to give all relevant info in all possible brevity below, please refer to the spoiler and link at the bottom of the post for the (more lengthy) original description if needed. ...
2k views

### understanding SDF[Signed Distance Functions] for a torus

This topic would contain a lot of sub questions because I have one for each shape but for today I just want to understand the function for a torus and a capped torus This is the article for all shapes ...
42 views

### Understanding inequality to equality in the Hartmann & Gribbs frustum planes extraction method

I've been reading this article on how to extract the plane equations from the view and projection matrices. And I can understand most of it. However, the only thing that is unclear to me (and that ...
682 views

### How to implement PCSS correctly?

I'm trying to implement PCSS in OpenGL/GLSL, but I have problems understanding the details especially the conversions between the coordinate spaces. The existing implementations are so different from ...
1 vote
30 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 ...
80 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 ...
63 views

### Moving a vertex through the cursor

There is a way to move a selected point in a mesh with a cursor(assuming a camera that doesn;t change between frames). The way I remember the algorithm (but seems to be wrong) is: Unproject the ...
72 views

### Calculating Material/Texture Placement from Bitmap to 3D Model

everyone! I am currently developing a program that converts a 3D model to 2D isometric pixel art. Part of my program extracts the texture from an FBX file (as FBX files can have textures built in), ...
110 views

Recently I have been trying to create a shader that imitates a shader within Affinity Photo. It is used in the radial gradient fill and essentially you set your endpoint colors and then set the ...
103 views

### Stylized math like rendering?

How can I render plots and graphics that mimic how mathematicians draw diagrams? For example Look at this shirt: The diagrams represent 2D and 3D shapes, however they have characteristics of human ...
1 vote