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 7757281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:03:07+00:00 2026-06-01T13:03:07+00:00

I haven’t realized this for a while, but my depth map is messing up.

  • 0

I haven’t realized this for a while, but my depth map is messing up. For: black pixels = near clipping plane, and white pixels = far clipping plane – Basically, if I walk towards a 100x1x100 square on the ground, and walk INTO it (reaching coordinates of 99, 0, and 99), the entire depthmap turns white. That’s indicating that each pixel is at the far clipping plane, which I do not want!
example

This is the code that handles rendering the depth map:

GraphicsDevice.Clear(Color.White);
effect.MainEffect.CurrentTechnique = effect.MainEffect.Techniques["DepthProcess"];
GraphicsDevice.SetVertexBuffer(line);
effect.MainEffect.CurrentTechnique.Passes[0].Apply();
GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);

And the HLSL code (vertex shader, pixel shader):

DVOut DVShader(VIn _in)
{
    DVOut o;
    o.position = mul(_in.position, WorldViewProjection);
    float a = o.position.z/o.position.w;
    o.color = float4(a,a,a,1);
    return o;
}

float4 DPShader(DVOut _in) : COLOR
{
    return _in.color;
}

technique DepthProcess
{
    pass Pass0
    {
        ZEnable = TRUE;
        ZWriteEnable = TRUE;
        AlphaBlendEnable = FALSE;
        VertexShader = compile vs_2_0 DVShader();
        PixelShader = compile ps_2_0 DPShader();
    }
}

Is this because of a 1/0 error? Or something wrong with the multiplication with matrices? Or w/e?

  • 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-01T13:03:09+00:00Added an answer on June 1, 2026 at 1:03 pm

    Solved. Somehow, the multiplication was setting the W component to a very small value.

    Instead of homogeneous division, I divided by 10, which gave an acceptable result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I haven't found any documentation on this or seen this done before, but is
Haven't fired up reflector to look at the difference but would one expect to
Haven't seen many Geneva related questions yet, I have posted this question in the
Haven't seen anything about it here but it seems to solve one of the
I haven't seen this question anywhere else, I hope someone can help. I have
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Haven't been programming in JS for a while. Now, I have following thing: <html>
Haven't seen anything, but I have seen that you can create albums in the
Haven't been coding in a bit, but took on a project for a friend.
I haven't this issue in the other popular browsers. In a JSP page (let's

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.