Skip to main content
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
  • 25.1k
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,437
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
  • 25.1k
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,605
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,801
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,283
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
  • 25.1k
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

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

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,842
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,402
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
  • 25.1k
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,605
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,566
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,840
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
  • 901
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,437
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,801
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,840
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
5 votes

Does CMYK values provide more colors than RGB?

You are focusing far too much on the number of color codes in common implementations. There is no reason that RGB must have 256 values per component, and no reason that CMYK must have 101 values per ...
Kevin Reid's user avatar
  • 1,206
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,636
4 votes
Accepted

Calculate a rotation around an arbitrary axis

Take a point $P$ and it's rotated point $P'$. Find the plan that runs through the middle between them $C = \frac{P+P'}{2}$ and is perpendicular to the line connecting them. Do this for all 3 of them ...
ratchet freak's user avatar
4 votes

Why is $pdf(\Psi) = \frac{1}{2\pi}$ when picking from hemisphere uniformly?

It's like this because the surface area of a unit sphere is $4\pi$. As ratchet freak points out, the integral of a probability distribution over its domain has to be 1. Put another way, the ...
Dan Hulme's user avatar
  • 6,840
4 votes
Accepted

Why is $pdf(\Psi) = \frac{1}{2\pi}$ when picking from hemisphere uniformly?

Actually, it would change if you changed units in the $\textit{pdf}$ definition. The fundamental reason is that the $\textit{pdf}$ is defined as the probability per steradian. That's what the density ...
Olivier's user avatar
  • 1,585
4 votes
Accepted

The variance for the Monte Carlo estimator

I don't have that book to check the context of this, but from the equations you posted, yes, it looks like you're right. The $1/N$ factor should be applied to both terms. That agrees with the formula ...
Nathan Reed's user avatar
  • 25.1k

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