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 ...
- 24.3k
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,...
- 8,287
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.
...
- 1,595
11
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 ...
- 24.3k
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-...
- 7,711
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 ...
- 210
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 ...
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. ...
- 306
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 ...
- 1,032
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 ...
- 5,830
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 ...
- 251
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 ...
- 2,700
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 ...
- 24.3k
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, ...
- 371
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 ...
- 9,211
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 ...
- 2,332
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, ...
- 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 ...
- 8,287
6
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 ...
- 24.3k
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 ...
- 1,477
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), ...
- 6,600
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 ...
- 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 ...
- 8,287
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 ...
- 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 ...
- 7,711
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 ...
- 51
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.
...
- 2,353
4
votes
Thorough, accessible material about Fourier basis functions and Spherical Harmonics?
wil, you largely have enough scholar background, you must have done Fourier and Laplace transforms in second year, and maybe in your engineering school again as part of signal processing classes.
If ...
- 623
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 ...
- 1,790
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 ...
- 3,586
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mathematics × 188computational-geometry × 37
geometry × 36
3d × 24
transformations × 21
raytracing × 16
algorithm × 16
opengl × 15
rendering × 13
matrix × 11
glsl × 10
image-processing × 10
shader × 9
c++ × 8
mesh × 8
linear-algebra × 8
physically-based × 7
vectors × 7
physics × 7
texture × 6
projections × 6
interpolation × 6
signed-distance-field × 6
gradient × 6
shading × 5