Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8962123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:03:49+00:00 2026-06-15T16:03:49+00:00

I’m having an issue with back faces (to the light) and shadow mapping that

  • 0

I’m having an issue with back faces (to the light) and shadow mapping that I can’t seem to get past. I’m still at the relatively early stages of optimizing my engine, however I can’t seem to get there as even with everything hand-tuned for this one piece of geometry it still looks like garbage.

What it is is a skinny wall that is “curved” via about 5 different chunks of wall. When I create my depth map I’m culling front faces (to the light). This definitely helps, but the front faces on the other side of the wall are what seem to be causing the z-fighting/projective shadowing.

Artifacts on bent wall

Some notes on the screenshot:

  • Front faces are culled when the depth texture (from the light) is being drawn
  • I have the near and far planes tuned just for this chunk of geometry (set at 20 and 25 respectively)
  • One directional light source, coming down on a slight angle toward the right side of the scene, enough to indicate that wall should be shadowed, but mostly straight down
  • Using a ludicrously large 4096×4096 shadow map texture
  • All lighting is disabled, but know that I am doing soft lighting (and hence vertex normals for the vertices) even on this wall

As mentioned here it concludes you should not shadow polygons that are back faced from the light. I’m struggling with this particular issue because I don’t want to pass the face normals all the way through to the fragment shader to rule out the true back faces to the light there – however if anyone feels this is the best/only solution for this geometry thats what I’ll have to do. Considering how the pipeline doesn’t make it easy/obvious to pass the face normals through it makes me feel like this isn’t the path of least resistance. And note that the normals I am passing are the vertex normals, to allow for softer lighting effects around the edges (will likely include both non-shadowed and shadowed surfaces).

Note that I am having some nasty Perspective Aliasing, but I’m hoping my next steps are to work on cascaded shadow maps, but without fixing this I feel like I’m just delaying the inevitable as I’ve hand-tightened the view as best I can (or so I think).

Anyways I feel like I’m missing something, so if you have any thoughts or help at all would be most appreciated!

EDIT

To be clear, the wall technically should NOT be in shadow, based on where the light is coming from.

Overhead view

Below is an image with shadowing turned off. This is just using the vertex normals to calculate diffuse lighting – its not pretty (too much geometry is visible) but it does show that some of the edges are somewhat visible.

Without shadowing turned on

So yes, the wall SHOULD be in shadow, but I’m hoping I can get the smoothing working better so the edges can have some diffuse lighting. If I need to have it completely in shadow, then if its the shadow map that puts it in shadow, or my code specifically putting it in shadow because the face normal is away, I’m fine with that – but passing the face normal through to my vertex/fragment shader does not seem like the path of least resistance.

Perhaps these will help illustrate my problem better, or perhaps bring to light some fundamental understanding I am missing.

EDIT #2

I’ve included the depth texture below. You can see the wall in question in the bottom left, and from the screenshot you can see how i’ve trimmed the depth values to ~0.4->1. This means the depth values of that wall start in the 0.4 range. So its not PERFECTLY clipped for it, but its close. Does that seem reasonable? I’m pretty sure its a full 24 or 32 bit depth buffer, a la DEPTH_COMPONENT extension on iOS. For @starmole, does this help to determine if its a scaling error in my projection? Do you think the size/area covered of my map is too large, hence if it focuses closer it might help?

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:03:51+00:00Added an answer on June 15, 2026 at 4:03 pm

    The problem seems to be that you are

    1. Culling the front faces
    2. Looking at the back face
    3. Not removing the light from the back face because it’s actually not lit by the normal – or there is some inaccuracy in the computation
    4. Probably not adding some epsilon

    (1) and (2) mean that there will be Z-fighting between the shadow map and the back faces.

    Also, the shadow map resolution is not going to help you – just look at the wall in the shadow map, it’s one pixel thick.

    Recommendations:

    1. Epsilons. Make sure that Z > lightZ + epsilon
    2. Epsilons. Make sure that the wall is facing the light (dot of normal > epsilon) to make sure the wall is shadowed if it’s very nearly orthogonal
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.