Skip to main content
4 votes
Accepted

Is linear filtering possible on depth textures in OpenGL?

Shadow maps, the way you're using them, don't filter well. The linear filtering does what it's supposed to, it's just not the thing you actually want for this context. Take a sample point halfway ...
DMGregory's user avatar
  • 136k
4 votes

OpenGL ES 2.0 Shadow Mapping - depth only FBO not working due to GL_FRAMEBUFFER_INCOMPLETE_ATTACHMEN

You will need to implement multiple alternative solutions depending on the GPU. Not only are there many choices (GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT32, ...
Stephane Hockenhull's user avatar
3 votes

How do modern game engines handle many shadow casting lights?

I don't really see the intent of the question, but I will give a stab at it anyway. For a start, there is no silver bullet, if you want shadows, you need to some form of shadow test. Commonly in ...
rioki's user avatar
  • 2,866
3 votes

Projection Texture Mapping

When you're projecting a texture, the goal is to take some texture and 'paste' it onto the scene. This is essentially mapping points on the texture to points in the scene, so if we can find a mapping ...
Ryan's user avatar
  • 965
3 votes
Accepted

Making Unity shadows work at a small scale

@DMGregory's suggestion was enough to point me in the right direction... Changing the camera clipping plane didn't help, however, changing the max shadow distance worked.
Basic's user avatar
  • 1,228
2 votes
Accepted

Shadow mapping too slow and ugly!

Any other forms of shadow mapping are probably going to be slower. I would not necessarily say it is too slow if you are getting 90 frames per second, though. When you have nothing going on in a ...
Yudrist's user avatar
  • 963
2 votes
Accepted

Deferred shadow mapping

Normally the 0.5 bias should have been included in the matrix (so I don't think it should be after the division by w) so this shouldn't appear: ...
unknown's user avatar
  • 192
2 votes

How do I write to a 16-bit depth buffer using Monogame and HLSL?

First of all, I am not very familiar with monogame specifically, but what I say apply to DirectX 11, which I expect Monogame is using under the hood. Now, for most cases, you don't need to expicitly ...
János Turánszki's user avatar
2 votes
Accepted

OpenGL Shadowmaps Limit

Do you hit this limit when you do the light-pass or main render-pass? With so many lightsources, I assume that your shadowmap resolution is very low? The thing I would try first is to put all the ...
Bram's user avatar
  • 3,744
2 votes

How do modern game engines handle many shadow casting lights?

I can't answer to the question "how do they do it" but i can tell you how did I. In fact, I wrote a 3D Rasterizer / Renderer with dynamic interpolated directional lighting and had some performance ...
PRDeving's user avatar
  • 755
2 votes

Problems implementing shadow maps in directx

When rendering a shadow map, you are rendering the scene geometry from the perspective of the light and the only thing you are trying to get from it is the depth of the scene. Your pixel shader is ...
GaleRazorwind's user avatar
2 votes

opengl shadow map peter panning effect

To fully answer this question, let's start with an explanation of relevant shadow mapping issues and solutions: Issue: Stippling Cause: limited resolution of shadow maps, leading to reduced depth ...
Ian Young's user avatar
  • 2,669
2 votes

Cube map faster than 6 2D textures? - shadow mapping

There is no need to use 6 individual textures as you can just use one big 2D strip with the dimensions x=shadowmap_width y= 6*shadowmap_height and then do 6 renderpasses adjusting the viewport to draw ...
ZimmerA's user avatar
  • 21
2 votes

How can you pass a large amount of textures or equivalent to the fragment shader in OpenGL?

I would use a Cube Map Texture Array for this. You can query the maximum array texture layers with: ...
Robinson's user avatar
  • 311
2 votes

How to create a depth-recording shader for shadow mapping?

One of the things you need to understand that the red component is actually visually correct. The Z Depth is being embedded in values close to 1. If you want to just see a colour change to see ...
ErnieDingo's user avatar
  • 1,160
2 votes
Accepted

Calculating Directional Shadow Map using Camera Frustum

Not sure why you are doing this "by hand", but it should be pretty straight forward if you use matrices for that. Assume your models are all already transformed to world space, then you usually do ...
wychmaster's user avatar
2 votes
Accepted

Custom directional shadow map from sun

Ok, I got it. i.shadowMapUV.z is < 0.f because it's mapped to -1;1 between near;far. Forward is also at -Z, so correct way to calculate ...
user81986's user avatar
  • 173
2 votes
Accepted

How does planar shadow projection interact with perspective projection?

As mentioned in the question, the author makes a rather misleading statement: Observe that this equation modifies the w-component so that sw=n\$\cdot\$L. Thus, when the perspective divide takes place,...
Daniel's user avatar
  • 131
1 vote

How to move the shadow map with the camera?

Calculate the view frustum boundary points, calculate the center of each of the near and far planes, and use vector add/subtract to define topleft, topright, bottomleft and bottomright. Then, ...
jackw11111's user avatar
1 vote

Peter Panning Depth Bias Problem

That is a very large depth bias value. Good values for depth bias are most likely around -2 to 2 range. However this might be different for floating point vs fixed point (UNORM) depth buffer formats. ...
János Turánszki's user avatar
1 vote

Forward Shading with multiple shadow-casting lights

The answer is primarily depends on target hardware. For modern GPU I would like to suggest tiled or clustered forward rendering. The core idea behind the clustered forward rendering is to split ...
demiurghg's user avatar
1 vote

Trouble generating a depth map (black screen)

Sorry I cant comment yet. I havent done shadow mapping in openGL yet, however, I cannot see that you are setting your uniform sampler2D depthMap. It should be set ...
BunnyDhaliwal's user avatar
1 vote

samplerCube for point light shadow map has dark corners relative to screen aspect ratio / size?

For anyone with this problem in future: I never thought to check the mipmaps which were generated as fully black originally. Fix was to regenerate them after the light was updated.
user136756's user avatar
1 vote
Accepted

Excluding geometry from a shadow casting light in deferred rendering

At a conceptual level, yes, the decision of what gets rendered into a shadow map is entirely yours. You can choose to include or exclude whatever geometry you want from the shadow map generation ...
Nicol Bolas's user avatar
  • 26.1k
1 vote
Accepted

Using Fragment Color to store individual bits (GLSL) may introduce issues if OpenGL does any evaluation of the floats before writing them to memory

3) Is there a better way of outputting as many bits as possible from a fragment shader, that wouldn't have any weirdnesses? (E.g. changing the rendering mode to doubles or ints or something) If you'...
Trevor Powell's user avatar
1 vote
Accepted

Shadow artifacts/acne on block intersections

Ok, there is a simple fix to shadow acne that I found here https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content/chapter18/chapter18.html ...
Souchy's user avatar
  • 21
1 vote
Accepted

Omnidirectional Faded Soft Shadows

A mathematically perfect point light that shines in exactly straight rays doesn't cast soft shadows. Imagine you're a tiny bug crawling along the shadow-receiving surface. From each spot you crawl to,...
DMGregory's user avatar
  • 136k
1 vote
Accepted

How can i solve this artifact in CSM

Looks like your near clip could be set wrong. Alos the thing with shadows is that sometimes you cant see the object but it casts shadows so u need to handle the culling different. So for normal ...
Justin William Stanley Bryant's user avatar
1 vote

Shadow Shimmering When Moving Objects

The easiest way to overcome this would be blurring your shadows. This is obviously not a perfect solution, but might be worth trying it out, it might just solve your problem. Now, there are multiple ...
János Turánszki's user avatar

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