Jump to content
  • Advertisement

eyyyyyyyyy

Member
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

399 Neutral

About eyyyyyyyyy

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. eyyyyyyyyy

    Opengl World Position From Depth

    oh so that explains it then. Thank you!
  2. eyyyyyyyyy

    Opengl World Position From Depth

    I can't believe this - it was something so simple: my glDepthRangef was set to 0.1f and 1000.0f setting it to 0.0f and 1000.0f fixed the position reconstruction argh!   Thanks for the help anyway! :)
  3. eyyyyyyyyy

    Opengl World Position From Depth

    screenuvs are just 0-1 uvs for a screen space quad like the usual deferred setup When i use an explicit world space position buffer everything renders perfectly. So I am sure it is reading from the correct uvs I tried cpu inverse view proj and it didn't make any difference. It is so weird, because it looks almost okay until the camera is moved far away!
  4. Hi, I am having a lot of trouble trying to recover world space position from depth. I swear I have managed to get this to work before in another project, but I have been stuck on this for ages   I am using OpenGL and a deferred pipeline I am not modifying the depth in any special way, just whatever OpenGL does and I have been trying to recover world space position with this (I don't care about performance at this time, i just want it to work): vec4 getWorldSpacePositionFromDepth( sampler2D depthSampler, mat4 proj, mat4 view, vec2 screenUVs) { mat4 inverseProjectionView = inverse(proj * view); float pixelDepth = texture(depthSampler, screenUVs).r * 2.0f - 1.0f; vec4 clipSpacePosition = vec4( screenUVs * 2.0f - 1.0f, pixelDepth, 1.0); vec4 worldPosition = inverseProjectionView * clipSpacePosition; worldPosition = vec4((worldPosition.xyz / worldPosition.w ), 1.0f); return worldPosition; } Which I am sure is how many other sources do it... But the positions seem distorted and get worse as i move the camera away from origin it seems, which of course then breaks all of my lighting... Please see attached image to see the difference between depth reconstructed world space position and the actual world space position Any help would be much appreciated! K
  5. Hello!   I have been trying to implement a technique to mask areas of rain from occluders. The obvious choice for this is bog standard orthographic shadow mapping.   However, I hit a snag when it comes to the sides of buildings. Due to precision error and whatnot, some completely vertical sides of buildings get marked as in shadow! This isn't ideal. (see shadow_issues.jpg)   I had then thought, maybe I could offset the normals in the shader, but then duh, it doesn't work for flat planes as the normals point upwards.   In the STALKER GDC 2009 presentation they say:   Use shadowmap to mask pixels invisible to the rain - Draw only static geometry (so that means they are not using a seperate pre done mesh) - Snap shadowmap texels to world space <- what does this mean? I think this is important... - Use jittering to hide shadowmap aliasing and simulate wet/dry area border.   Any thoughts on how to solve this would be much appreciated!   Thanks
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!