Hot answers tagged

11

Light that is blocked will mean that $L(p*, -w_i)$ under the integral is 0 plus how much light the blocking object itself reflects. In other words the shadowing is embedded in the incoming light function.


11

This issue looks like standard shadow map acne artifacts. Additionally your's lighting equation is incomplete or wrong. Light shouldn't influence faces with normals facing away from it. This also means that with a proper equation the "dark" side of the sphere shouldn't have any acne artifacts. There are three sources of acne artifacts: First acne source is ...


7

The shadow terminator problem (as it's also known) is still something of an open problem in ray-tracing. As you say, disabling self-shadowing is not a very good workaround, because non-convex meshes often need to self-shadow. There's a possible refinement to this method. Instead of throwing away all shadow ray intersections with the same object, you can only ...


6

Your if condition makes me suspicious. You should include the diffuse and specular shading if the intersection test didn't hit an object; that is, if intersections > ldist. So, your code should look as follows: if (intersections > ldist) { colour += diffuse(...); colour += specular(...); } Your comparison with 0.0000001f suggests that you've ...


6

It's a bit hard to tell from your image, but it does look a bit faint. When debugging these kinds of things, it's always useful to strip down your scene as much as possible to remove any unnecessary complexity from the picture. In your case, try only creating a single diffuse sphere that touches the ground in one point. Give the ground and the sphere an ...


6

The problem appears to be unintentionally transparent surfaces Although the image is grainy, it is sufficiently clear to estimate that all of the darker regions are due to surfaces facing away from the light, rather than due to shadows cast onto surfaces facing towards the light. So it does seem that there is a problem, and the lack of shadows is not just ...


6

PBR isn't just a feature you "add to a rendering engine" but an entire philosophy how to approach solving rendering problems. This seems to be a common prevailing misconception when people talk about PBR. Quite often people assume that when they have implemented physically based BRDF (e.g. GGX) into their engines, they are "done implementing PBR". They are ...


6

There’s an interesting technique that’s been used in demoscene and Shadertoy projects for a while, and an analogue of which recently made it into Unreal Engine 4: using signed-distance fields and raymarching to produce high-quality soft shadows with accurate penumbras. There’s a good writeup of the idea, with some visual examples, by Íñigo Quílez here—I’m ...


6

Having not worked on these games, I can only speculate... but from your description, it sounds like a crude shadow map with orthogonal projection and no depth information. It probably has (or had) a specific name but the way I suspect they did it is: Render the character from above to a binary texture (eg. white there there's nothing, black where 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

is it correct having such a big light? I don't see any problem with having a big area light. That said, it also depends on the scale of your scene. If the light is large compared to it, shadows will tend to be more diffuse, like under an overcast sky. shadows are missing.. [...] Can you help me understanding why? I haven't found any blatant mistake, but ...


5

It depends how you define easy and what kind of constraints you have. The general case of this is rendering caustics but that's probably not what you're looking for if real time is your target. If your mirrors are always flat as in your demo and you only want to support a single bounce, the easiest I can see would be to reflect your light sources on the ...


5

Most renderers allow you to set a flag on an object to make shadow rays ignore it (so it won't cast shadows). You could set this flag on your glazing. That said, it's not unusual to make it so that refraction is disabled on shadow rays: that is, if they would be transmitted by an object, a child ray is traced in the same direction, ignoring any refraction ...


4

Sun light can be represented as a distant light. Light sources are radial like a bulb, though in the case of the sun, it is so far away from the Earth, that a reasonable approximation is to consider that all rays coming out of the sun are parallel at the Earth's surface. Using a distant light is an approximation. Because it's far away it is also assumed that ...


3

You don't need to render to texture to achieve an effect like this. Use stencil buffer. The visibility polygon can be drawn using GL_TRIANGLE_FAN, if you start from the middle: At the beginning of each frame: Clear the stencil buffer (and enable stencil test) Set the stencil function to always pass, and to replace the current value in the buffer to a ...


3

PCF does N shadow tests, where each test returns 1 (in light) or 0 (in shadow), and returns the average of the results. sampler2DShadow is a special sampler where PCF is applied to the nearest texels to a sample, based on the depth coordinate provided. So you can't use it with ESM.


3

Sunlight is typically modeled as a directional light. All rays point the same direction off into infinity.


3

Ah, shadows. They still are bothering after so many people spent years trying to improve them. Whether your engine is deferred or forward, the shadow pass should be quite the same, and suffer the same issues. You are correct, this is a famous problem. Some methods can improve these artifacts in some cases, see the methods mentioned already, or for example "...


3

Percentage Closer Filtering with some amount of blur (ie. a minimum filter size in texture space) is the most basic method I know of. For example, see GPU Gems. My experience is that it is also quite robust.


3

If the goal is mouse interactivity, you can do with a simple "shadow buffer", i.e. an image that holds the identity of the occluding object (if any) on every rendered pixel. You will compute this map during the casting process as you shoot the rays to the source. In case there are several occluding objects, it is up to you to choose which one to consider (...


3

I'll add some guidelines to help readers understand Benedikt Bitterli's statement "Make sure to gamma correct your images". Gamma correcting images does not mean applying a power filter at the end. It means working in linear space during all calculations, and finally encoding the output into gamma space. Gamma space is the color space into which all ...


3

are you sure you are not re-intersecting the same surface when checking for light occluder ? this is a classical precision issue. There are many way to tackle it: First, have a good conditioning of the intersection point, by reintersecting a second time: consider your first hit distance d as approximate, create the point E' = Eye + (d-eps)*ray, recompute ...


3

Hard shadows are simple that only needs a point light. How it's done is by rendering the scene from the point of view of the light and only keep only the depth information. This is the shadow map. Then when doing the actual rendering you calculate the point on the triangle in world space and find where it would be on the shadow map. Then you sample the ...


3

A note first From the look of your screen capture, I suspect there might still be a bug in your code. Noise is to be expected with only 16 spp, but your picture still looks surprisingly dark to me. For comparison, here is what my implementation of SmallPT looks like with 16 spp, 15 bounces, and no next event prediction: (here it is on ShaderToy) Noisy, ...


3

I am no expert in offline renderers, but I'll give it a go until someone else comes with a better answer :) Shadow rays intersecting area light It is very common to assign an extent to your rays. How to do so? Think about the parametric formula of a ray: $$R(t) = O + t\vec{D}$$ it should immediately jumps out that how far $R(t)$ can be from the origin $...


2

Well nevermind. I made some research and actually gonna: sample ESM using Poisson sampling in PCF fashion (thanks Bart Wronski for great Poisson Sample generator app) and extend this to PCSS technique (variable penumbra). Render to texture. optionally depth aware blur to soften - EDIT not so fast this option doesnt work as expected, too bad. Instead ...


2

The distinction is not clear mainly because the term "shading" is an extremely broad term. One of the first uses for programmable "shaders" in real-time graphics pipeline was computing illumination on vertices or pixels - close analogs to what an artist does when shading an object in a drawing for example. Today it has come to encompass all calculations ...


2

One technique is adaptive shadow maps where you use a low resolution map for shadows that are rendered far away from the camera, a mid-resolution map for stuff that's in the mid range, and a high resolution map for stuff that's close.


2

For light sources with larger solid angle and where the shadow caster is relatively closer to the light than the receiver, you get notable soft shadowing effect. So if you render larger light sources closer to the shadow receiver it's important to handle soft shadows properly for realistic lighting. Even with the Sun which has quite small solid angle, you ...


2

Don't know the game but hard shadows are usually shadow volumes, often implemented with help of a stencil buffer. You can find a short description of the algorithm on Wikipedia.


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