Hot answers tagged

39

Real-time graphics deploys a variety of approximations to deal with the computational expense of simulating indirect lighting, trading off between runtime performance and lighting fidelity. This is an area of active research, with new techniques appearing every year. Ambient lighting At the very simplest end of the range, you can use ambient lighting: a ...


28

The short answer: They are not interchangeable, but their meaning can sometimes appear to overlap in computer graphics literature, giving the potential for confusion. Albedo is the proportion of incident light that is reflected away from a surface. Diffuse reflection is the reflection of light in many directions, rather than in just one direction like a ...


11

Computing the normal from vertex positions is quite simple using the vector cross product. The cross product of two vectors $u$ and $v$ (noted $u \times v$, or sometimes $u \wedge v$) is a vector perpendicular to $u$ and $v$, of length $||u \times v|| = ||u|| \cdot ||v|| sin(\theta)$, with $\theta$ the angle between $u$ and $v$. The direction of the vector ...


11

Flat shading is the simplest shading model. Each rendered polygon has a single normal vector; shading for the entire polygon is constant across the surface of the polygon. With a small polygon count, this gives curved surfaces a faceted look. Phong shading is the most sophisticated of the three methods you list. Each rendered polygon has one normal ...


7

Sorry for the bad quality of my answer. I do not have access to a computer currently and editing from my phone is not a straightforward task. In particular I would love to be able to paste images. I would say that the main challenges of simulating hair are: replicating their very specific reaction to lighting (as a material) replicating their ...


6

Your point is correct when applied to ambient lighting as an approximation technique. This crude approach does indeed give the same lighting level to all surfaces regardless of their surroundings. However, ambient occlusion is a different (less crude) approach, that models how the light levels in a real scene vary depending on how much reflected light can ...


5

This is the main 'hard' problem remaining in real-time CG, and there is a lot of research ongoing into solving it. The biggest hurdle is that in raster graphics, each component of the scene is rendered 'in a vacuum' - each triangle is rendered without reference to any other triangles in the scene, and the same goes for pixels, as opposed to ray-tracing ...


5

The motivation behind ambient occlusion (AO) in general is to approximate the way crevices and corners are often shadowed, because less indirect light bounces into them. An example from a photo of my office—note the darkening along the edges where walls and ceiling meet. The room is lit only by the light coming in through the window and bouncing around....


5

As Alan and trichoplax mention in the comments, the effect that ambient occlusion simulates is not the occlusion of a surface from the camera but the surface’s occlusion from its surroundings. Think of it this way: say you have even illumination coming from every direction, so that the total incoming light at any point sums up to a value of 1. If you place ...


5

I see some problems in the quote you posted. In effect, a point rotated around its normal vector will not change the way it reflects light. This is true, because a Lambertian reflector will never change the way it reflects light. The underlying principle stays the same. Also, Lambertian surfaces are isotropic, so the amount of reflected light won't ...


5

That completely depends on how you are computing the shading. If you are then just linearly interpolating the shaded colours across the triangle, i.e. Gouraud shading then, clearly, the answer is "no". However, if you are doing per-pixel shading by, say, interpolating normals and light directions, then you can easily get a brighter area away from the ...


5

Ambient light does not really exist, if we do not talk about cosmology. What we call ambient is just light form many secondary reflections. Image 1: No ambient light (left) and ambient light (right). Both look artificial. We can approximate ambient light by a constant factor. But this looks slightly washed out as ambient light is not constant over the ...


5

In simplified terms, shading controls how object's surface's brightness changes when the angle between its normal and light vector changes. Shadows are areas where the light cannot reach because it's occluded by other objects. So no, they both are not responsible for creating shadows.


5

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$ Your Oren-Nayar is the diffuse part $f_d(l_i, l_o)$ and your GGX is your specular part $f_s(l_i, l_o)$. If both are energy conserving, then both are at most ...


5

With an old-style Phong shader (as in your example), they really are just added together. Each of those things is a contribution to the overall amount of light, so they're just added together, the same way you add together the contribution from each light source. Your intuition is right that you often end up with overexposed specular highlights with this ...


4

The line you quoted says it: $E_L$ is the incoming irradiance at the surface due to the light source under consideration. Less technically, it's a vector representing the intensity and color of the incoming light at that point. The equation you mention is for a punctual light source (directional, point, or spot light), so in this case $E_L$ would simply be ...


4

You have several techniques. Use acceleration structures. The idea is that you store your geometry (triangles) into generally some kind of volumes. The general idea behind acceleration structure is to discard quickly large parts of the scene, which we know (using these structure) don't have any object that your ray will intersect. An introduction to the ...


4

I have managed to fix the error. It turns out the error was never situated in the normal calulation it was the shading algorith. The floating point precision error caused the new ray to be slightly below the surface, which meant it would intersect itself and become darker. This is a problem common in biased raytracers, the phenomenon known as "Shadow acne". ...


4

I wasn't really expecting that, no. The formula in the paper is not the most elegant - there's quite a few parentheses in there. In this case I think it's just a matter of shuffling the parentheses around a little in the get_k implementation - both terms should be divided by (1-r): float get_k(float r, float n) { return std::sqrt( 1.0/(1.0-r) * (...


4

Flat shading uses the same normal for each vertex of the triangle. In this case the normal is constant, and one color is evaluated for the triangle. For Gouraud and Phong shading normals are different per vertex and can represent a curved surface (even though the face is flat). However, for Gouraud shading is evaluated per vertex, and the resulting color ...


3

Your existing opinion is correct, though there's one extra detail. The geometric normal is the normal of the actual triangle, based on the vertices' positions (the cross-product of edge vectors, as you said). The shading normal is altered from this, and is used when shading a fragment or ray hit. In the simple case, it's the interpolation of the three ...


3

That is, to my knowledge, a problem without a proper solution. You're seeing the discrepancy between shading normal and geometry normal and it becomes obvious, that the shading normal is just a trick. PBRT has a paragraph on this, their solution is to look at the geometric normal to determine whether to call the BRDF (reflection) or the BTDF (transmission), ...


3

Diffuse colours on materials typically come from within the material, while the specular colour is from the very surface. Coloured plastic materials are made by embedding particles of dye inside a colourless medium, so the diffuse colour is the colour of the dye, while the specular colour is white from the colourless surface. With metals, all of the ...


3

Comment: if you make references to book, then it would be good if you could provide references. To answer your questions: First, it is quite unusual these days to see people representing colors using a computer byte that is integer values within the range [0:255]. Most people these days use floats, and you will understand why in a moment. When you look at ...


3

Assuming you have almost any lighting model at all: You cannot bound the view irradiance (light reflected from a surface location towards the eye/camera) by computing the irradiance at the vertices and bounding those, even if the surface is completely diffuse Lambertian and has no view-angle term. Imagine a large floor triangle, and a point lighting near ...


3

Problem fixed by RichieSams, trichoplax and xpicox. Thanks all of you for the answers. I lower the roughness, change the color of material and reversed the ViewDirection then finally I start to see proper specular :). Fixed Code: #version 330 core in vec3 Position; in vec2 TexCoord0; in vec3 Normal; in vec3 Tangent; out vec4 FinalColor; uniform vec3 ...


3

You are correct, it's badly worded. Illumination falls off with the cosine of the angle between the surface normal and the inverse light direction, so the wording implies the light is shining down the original surface normal, and so any tilting away would be tilting away from the lighting direction.


3

The problem is in the diffuse term, which can be seen by making the specular portion of IBL not be added into the result. The diffuse only render will not have the darkening, and of course, the specular can't make the diffuse darker. (Note, fresnel vs no fresnel is not the issue here). The core problem is that lambertian diffuse is being used, which is ...


3

To answer your question we just need to write it as linear algebra equations and solve them. Although your question doesn't state it, I assume that $v$ and $d$ are unit vectors. Let's call the projected point $x$. First, because the projected point is in the direction $d$, we can write: $$\vec{vx} = \lVert\vec{vx}\rVert d $$ Second, because $p$ and $x$ are ...


3

Sphere's don't have edges like the ones in that picture. The "silhouette" should be a circle. This is because the sphere was rendered as triangles and rasterized. Triangles can only approximate a sphere. Compare this to ray casting for instance. Where we can directly test the intersection between a sphere and ray thus no need to approximate a sphere with ...


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