Hot answers tagged

40

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 ...


32

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 ...


14

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 ...


13

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 ...


7

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 ...


6

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 ...


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

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

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

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

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 ...


5

When you multiply colors together the surface color acts as a filter. Remember that colors are scaled from 0 to 1. That way with white incoming light a green object will remain looking green. This does bring a few issues because physical light isn't as orthogonal (where the 3 primary colors are actually overlapping frequency response functions) but for the ...


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

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

A sine wave remapped to [0, 1] and raised to a power will give you periodic ridges: (Desmos graph) That could be a good place to start. It will make perfectly straight, even ridges; but you could then perturb the X position where the sine is evaluated using low-frequency Perlin noise, which will make the ridges bend and waver while still going mostly along ...


4

The rendering equation aims to describe what the light distribution for a specific scene is, under several assumptions. The most important assumption is that we are working in a geometrical optics framework - so we do not consider the wave properties of light - meaning no diffraction for example, we also do not consider quantum effects, such as ...


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

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

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

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

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 Diffuse, specular and Reflection terms have lead to a lot of confusion because they have been commonly used to describe different lighting processes along the CG history and sometimes diverge from their scientific usage. to clarify this I is use my own vocabulary made up of different terms i picked up here and there: 1- Surface Reflectance: could ...


3

Briefly: Low albedo --> darker object High albedo --> brighter object Low diffuse reflection --> mirror-like reflection (aka Specular) high diffuse reflection --> cotton-like reflection


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