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


10

Shadow mapping with acceptable quality is quite a journey. So you implemented first step - basic shadow map that encompass whole scene statically. This means that shadow map texel size in light view space to texel size of rendered scene in camera view space ratio is quite big, resulting in aliasing. To reduce this ratio closer to 1:1 there are techniques you ...


7

SOLUTION After a couple of days I realized that I was computing my projection matrix using a FOV angle in degrees and It should be in radians. I made the conversion and now everything works great. The interpolation among faces of my depth framebuffer's cubemap is now perfect. For this reason, It is important to handle every single trigonometric function's ...


4

Instead of using a perspective projection you would use a orthographic projection. Then the trick is to position the bounding box to in front of the normal camera. An additional option is to add a skew/shear operation so it maps the light direction to the vertical and keeps the horizontal ground plane horizontal. This avoids leaving a large dead zone ...


3

I finally found the cause of the problem. There appears to be a problem with the shadow map of both the omni light and spotlight. While debugging, I noticed by accident that the light-view-to-light-projection (lview_to_lprojection) 00 and 11 matrix entries were not equal. Due to the aspect ratio of 1, both matrix entries must be equal. Furthermore, due to ...


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

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

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


2

Not rendering a shadow caster could work but your mileage can vary. When variance is "large" a VSM is not able to exactly localize the occluders, which causes light leaks. Not rendering a large receiver (let say the floor of a room, a road, etc..) can dramatically increase the variance of the depth samples within a region of the shadow map that include the ...


2

One of the downsides to shadowmapping is that you need to offset, or bias, the point used for shadowmap-lookups. This is done in a variety of ways - typically by a constant (shadowmap-depth) distance or based on the slope of the casting triangle. Both of these tend to be done during the shadowmap-rendering pass. I think what you need to solve your sphere-...


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

Deferred rendering does not have an asymptic complexity of O(lights+fragments). It has a complexity of O(fragments+visibleFragments*lights). What you are doing in deferred rendering is preventing having to calculate lighting for many fragments that cover the same screen pixel. Once you have found which ones are visible, all of those still have to calculate ...


1

I found out that simply removing minus sign in shader in converting coords to [0, 1] solved direction problem. But scale is still off - here is an example: void LightClass::GenerateViewMatrix() { XMVECTOR eyePos = { m_position.x, m_position.y, m_position.z }; XMVECTOR focusPos = { m_lookAt.x, m_lookAt.y, m_lookAt.z }; XMVECTOR upVec = { 0, 1, 0 }...


1

Because I was using the CheckFormatSupport wrong. The second parameter is supposed to be an input. Here is what it should be like. bool Renderer::InitRenderer(HWND hwnd) { if (!InitD3D11App(hwnd)) return false; InitViewport(); UINT formatSupport; HRESULT hr = d3d11Device->CheckFormatSupport(DXGI_FORMAT_R16_FLOAT, &formatSupport); ...


1

Texture mapping is the process of providing a mapping from the surface to a location on the texture. That is, given a particular point on a surface, you can find a specific point in a texture that corresponds to it. Giving positions a UV texture coordinate is a common means of defining a texture mapping, but you can use a function of arbitrary complexity. ...


1

It seems that sampler2D_float doesn't allow to interpolate shadow lookup linearly. So I had to do it by hand. Here's an example of interpolated shadowing. float texture2DCompare(sampler2D depths, vec2 uv, float compare){ float depth = texture2D(depths, uv).r; return step(compare, depth); } float texture2DShadowLerp(sampler2D depths, vec2 size, ...


1

It's not entirely clear what the scene in your picture is supposed to look like, so I'm not sure I'm interpreting it correctly. But if I am, it seems like the problem is that you're projecting the shadow properly, but onto the wrong face of the gray wall. If you want to research it, you might have luck looking up winding order (sometimes called winding ...


1

You've said that "... bilinear filtering on in the texture ...". It seems that you are interpolating the depth values of the shadow map. The correct way of using interpolation with the shadow map is to apply it over the outcomes of the shadow tests (as far as I remember, OpenGL supports that). You might even combine the interpolation of the outcomes of the ...


1

@ratchetfreak's answer describes shadow mapping, however, there's another not so difficult to implement way of drawing hard shadows. The shadow volume technique uses extruded geometry plus some stencil buffer tricks to simulate the area occluded by an object. The idea behind it is to generate a volume from the light source's perspective and then render it as ...


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