13 votes

Correct Specular Term of the Cook-Torrance / Torrance-Sparrow Model

I would trust Pharr and Humphreys on this. Equation 2 also agrees with the SIGGRAPH Physically Based Rendering course notes, as well as with equation 20 in the Walter et al paper that introduced the ...
Nathan Reed's user avatar
13 votes

How to achieve gimbal lock with Euler angles?

A gimbal is a pivoted support that allows you to rotate around one axis. Now it so happens that Euler rotations* work like a set of 3 gimbals attached to each other,...
joojaa's user avatar
  • 8,407
12 votes
Accepted

How am I able to perform perspective projection without a near plane?

The near and far planes of a viewing frustum aren't needed for simple 3Dā†’2D projection. What the near and far planes actually do, in a typical rasterizer setup, is define the range of values for the ...
Nathan Reed's user avatar
11 votes
Accepted

How to achieve gimbal lock with Euler angles?

Rotations in 3D are normally done with matrices. The xyz Euler angles can be converted to matrices so that it can be used in the rotation. That is where something called rotation order comes in. ...
bram0101's user avatar
  • 1,595
9 votes
Accepted

Does premultiplied alpha give order independent transparency?

Premultiplied alpha itself does not give you order independent transparency, no. This page talks about how it can be used as part of an order independent transparency solution however: http://casual-...
Alan Wolfe's user avatar
  • 7,791
9 votes
Accepted

Logarithmic spiral with equal vertex spacing, what equations?

Since a logarithmic spiral is defined by $r=e^{a\cdot\theta}$, the inverse of the equation is this: $\theta=\frac{\ln{r}}{a}$. If we want to be able to control our step value, we can multiply it ...
Scott Milner's user avatar
8 votes
Accepted

Sine-based Tiled Procedural Bump

As you are taking the mean of a number of sine waves, your colour values will range from -1 to 1. From your example image, it looks like only the top half of this range of values (from 0 to 1) is ...
trichoplax is on Codidact now's user avatar
8 votes
Accepted

Understanding Jump Flooding Algorithm (JFA) for Voronoi Diagrams

I think that there is a bit of confusion in terminology. My understanding is that only the initially colored points, before step 1, are called seeds. Maybe this helps clarify the algorithm as well. ...
StinkySkunk's user avatar
8 votes
Accepted

How do people come up with subdivision schemes?

The subdivision schemes are not arbitrary. Catmull-Clark, arguably the most used subdivision scheme, generalizes bicubic B-splines to meshes of arbitrary topology. Most, other subdivision schemes ...
Reynolds's user avatar
  • 1,223
7 votes
Accepted

Is my perspective math correct?

Identifying your axes in both figures and adding the camera position to your first figure would help you understand what's going on. You could also have a single variables for all your points, ...
Soravux's user avatar
  • 371
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,720
7 votes
Accepted

Generate this kind of 2d burst or pulse algorithm?

Rather than using an image, I would suggest doing this kind of effect using a shader. I'm not familiar with Cocos2d-x, but some quick googling suggests that it can work with shaders. You'd use a pixel ...
Nathan Reed's user avatar
7 votes
Accepted

Why does substracting -1 in shader fail for a float data type?

Without seeing the error message I can't be sure but I think it's failing on the 1 being int instead of a float. float inv_coord = v_coord - 1.0; There is a ...
ratchet freak's user avatar
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

How am I able to perform perspective projection without a near plane?

In this case, the geometry of similar triangles ABC and ADE is used to determine the height of D via the solution of DE. It is obvious that if the near plane is at 0 (AE=0), then a division by 0 ...
Nicol Bolas's user avatar
  • 9,752
7 votes
Accepted

What does it *mean* to scale in an arbitrary direction?

When you scale along the X-axis, the X-coordinate (parallel to the axis) gets stretched, while the Y-coordinate (perpendicular to the axis) remains the same. You can think of scaling along an ...
russ's user avatar
  • 2,382
7 votes
Accepted

Where does the cosine factor comes from in the GGX PDF?

Normal distribution functions are defined a bit differently than you might expect. They're not strictly a probability distribution over solid angle; they have to do with the density of microfacets ...
Nathan Reed's user avatar
7 votes
Accepted

AABB bounding boxes

In short; The constructor is correct. As far as I understand, if p1.x is less than p2.x then pMin = p1. So we should only be checking against p1.x and p2.x. I get where the confusion comes from, ...
bram0101's user avatar
  • 1,595
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,407
6 votes
Accepted

Microfacet shading for diffuse materials

You can combine Oren-Nayar with GGX, if your normalize the result. A BRDF is defined by two properties: Helmholtz reciprocity and energy conservation. $f(l_i, l,_o) = f(l_o, l_i)$ $f(l_i, l_o) \leq ...
Tare's user avatar
  • 1,541
6 votes
Accepted

GLSL shapes signed distance field implementation explanation?

Torus A torus is defined by two parameters: the major radius, and the minor radius. The major radius (t.x) is the radius of the big ring (in red in the diagram), ...
Dan Hulme's user avatar
  • 6,770
6 votes
Accepted

Determining Rational Quadratic Bezier Curve Weights for Circle

Check out the section on Circular Arcs and Circles, from Ching-Kuang Shene's excellent computational geometry course notes: [G]iven three control points P0, P1 and P2 such that P0P1 = P1P2 holds, if ...
gilgamec's user avatar
  • 881
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,407
5 votes

What makes a good permutation table?

First of all - a number must not occur twice, that is implied since we're talking about permutations. So filling the table with a simple random(255) function won't work. Secondly, you need to ensure ...
mhbuur's user avatar
  • 151
5 votes
Accepted

How does a rigged model work?

The magic is that the mesh is attached to the skeleton. In it's simplest form, this is done by assigning each vertex to a bone. When a vertex is assigned to a bone, that means that it will always ...
Alan Wolfe's user avatar
  • 7,791
5 votes
Accepted

2D sampling with multidimensional transformations

I'm not sure I've correctly understood the question, but here goes. You're trying to sample directions uniformly, so you've got $p(\omega)$, which is the probability of getting a particular direction....
Dan Hulme's user avatar
  • 6,770
5 votes

Does premultiplied alpha give order independent transparency?

From the proof of premultiplied alpha blending, there is an assumption that "the operator must respect the associative rule." So, it may lead to confusion of the order of process. Since this is not ...
Woohyun Kim's user avatar
5 votes
Accepted

How to calculate ray

Read up on the basics for ray-tracing here, Usually we don't mess up with viewports and stuff in raytracing, So I'm just telling you for the case where viewport equals the Image Width and Height. ...
gallickgunner's user avatar
4 votes
Accepted

Ray tracing - tangent space for a point on a sphere

The tangent space is spanned by the tangent to the point and the bitangent (which is orthogonal to both tangent and normal). So you need to calculate the tangent which is achieved by calculating the ...
Dragonseel's user avatar
  • 1,810
4 votes
Accepted

Enter/Exit of unit cube representable as 4 numbers?

3D object surface is 2D domain and can thus be parametrized with a 2D function. In case of a unit cube you could parametrize the surface for example by mapping each 6 faces to a 2D image strip. So if ...
JarkkoL's user avatar
  • 3,626

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