Jump to content
  • Advertisement

mr_hell

Member
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

126 Neutral

About mr_hell

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. mr_hell

    How to get Z-Buffer values?

    I've also tested [font=verdana, arial, sans-serif]D3DXCreateTexture(pDevice, w, h, 1, D3DUSAGE_RENDERTARGET, {Format}D3DFMT_R32F, D3DPOOL_DEFAULT, pRenderTexture);[/font] [font=verdana, arial, sans-serif]But I still have "zero" results[/font]
  2. mr_hell

    How to get Z-Buffer values?

    Ok, I've tried to use pixel shader for getting float values of depth. But unfortunately it doesnt work. hr:= pDevice.CreateDepthStencilSurface(w, h, D3DFMT_D32F_LOCKABLE, D3DMULTISAMPLE_NONE, 0, false, DepthSurface, nil); pDevice.GetRenderTarget(0, pBackBuffer); pDevice.SetRenderTarget(0, DepthSurface); pDevice.BeginScene; RenderScene; pDevice.EndScene; pDevice.SetRenderTarget(0, pBackBuffer); hr:= pDevice.Present(nil, nil, 0, nil); DepthSurface.LockRect(pLockedRect, nil, D3DLOCK_READONLY); SetLength(DepthBuffer, w*h); for i:= 0 to h-1 do begin bp:= Pointer(integer(pLockedRect.pBits) + i*pLockedRect.Pitch); Copymemory(@DepthBuffer[i*w], bp, sizeof(single)*w); end; DepthSurface:= nil; float4 GetDepth(VS_OUTPUT In): COLOR0 { float Depth = In.Pos.z/In.Pos.w; return Depth; } And I've got zero in DepthBuffer
  3. mr_hell

    How to get Z-Buffer values?

    [color=#1C2837][size=2]D3DFMT_D32F_LOCKABLE
  4. Hello. I've tried to read Z-Buffer values into float array after rendering scene into texture. pDevice.GetDepthStencilSurface(ZStencileSurface); ZStencileSurface.LockRect(pLockedRect, nil, 0); SetLength(DepthBuffer, w*h); for i:= 0 to h-1 do begin bp:= Pointer(integer(pLockedRect.pBits) + i*pLockedRect.Pitch); Copymemory(@DepthBuffer[i*w], bp, sizeof(single)*w); end; ZStencileSurface.UnlockRect; That works, but I've got "warped" image. It looks like depth image was shifted and scaled. What I have done wrong? Sorry for pascal code, but it was necessary in my work.
  5. UPD 1. This bug appears only with my special mesh. UPD 2. problem with lost mesh was in degenerate triangles, now i have changed mesh to a simple vertex buffer and become my silhouette. But i still have z-fighting. depthbias doesnt work. UPD 3. I've fixed z-fighting using changed znear, zfar values + vertexbuffer. But changing depthbias or viewport will not help. where is the problem? [Edited by - mr_hell on May 7, 2009 4:50:06 AM]
  6. I have a problem. I'm using depthbias to render silhoette (special mesh + vertex shader) of the target mesh and the target mesh without z-fighting. Fast silhouettes . i have tested depthbias from this article on some cards. It worked nice. but now i have tested it on my geforce 8800 gts and i lost my silhouette. If i set a nonzero depthbias value then i lost silhouette mesh. Can somebody help? P.S. I've already checked render caps. P.P.S. Another problem on geforce quadro - z-fighting fixes only using depthbias, another methods doesnt work. [Edited by - mr_hell on May 7, 2009 7:40:40 AM]
  7. How to rewrite this shader for SM 2.0? (does not support ddx ddy operations - i have to emulate gradiants by myself). its necessary for me! [Edited by - mr_hell on April 3, 2009 8:28:30 AM]
  8. Trurl yessss, it works, thank you.
  9. I have to draw x, y, z level lines on my relief surface. 2 soluttions: 1. Using of additional geometry (lines). Major disadvantage - i need time to calculate this lines. 2. Using pixel shader. float4 TestP1(PS_INPUT Input): COLOR0 { float4 Color; int z = ceil(Input.Position.y); int y = ceil(Input.Position.z); int x = ceil(Input.Position.x); Color = Input.Color; if(abs(fmod(z, 100))<1.0) { Color.b = 1.0f; Color.r = Color.g = 0.0f; } if(abs(fmod(x, 100))<1.0) { Color.b = 1.0f; Color.r = Color.g = 0.0f; } if(abs(fmod(y, 100))<1.0) { Color.r = 1.0f; Color.b = Color.g = 0.0f; } return Color; } But on this way i have troubles: first and second Any ideas, how to get "good" level lines in shader? [Edited by - mr_hell on April 2, 2009 6:31:04 AM]
  10. DX 9.0. I have to draw x, y, z level lines on my relief surface. 2 soluttions: 1. Using of additional geometry (lines). Major disadvantage - i need time to calculate this lines. 2. Using pixel shader. Its better, because i neednt time for calculations. float4 TestP1(PS_INPUT Input): COLOR0 { float4 Color; int z = ceil(Input.Position.y); int y = ceil(Input.Position.z); int x = ceil(Input.Position.x); Color = Input.Color; if(abs(fmod(z, 100))<1.0) { Color.b = 1.0f; Color.r = Color.g = 0.0f; } if(abs(fmod(x, 100))<1.0) { Color.b = 1.0f; Color.r = Color.g = 0.0f; } if(abs(fmod(y, 100))<1.0) { Color.r = 1.0f; Color.b = Color.g = 0.0f; } return Color; } But on this way i have troubles: first and second Any ideas, how to get "good" level lines in shader? P.S. I know about textures, but i dont want, since i have very large terrains.
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!