sgt_pinky Posted January 10, 2005 Posted January 10, 2005 (edited) Ok, I have had this problem since I started. I am rendering poly's, and then lines over the top. On lower quality gfx cards, which don't support SlopeScaleDepthBias, I have really really crappy lines (see attached image). Interestingly, I initially had the following line in my code: dRender.RenderState.SlopeScaleDepthBias = 0 'render lines dRender.RenderState.SlopeScaleDepthBias = 1 'render poly's But on cards that don't support SlopeScaleDepthBias, this was producing horrible effects! (Shouldn't it have no effect?). I changed the lines to: If dRender.DeviceCaps.RasterCaps.SupportsSlopeScaleDepthBias = True Then dRender.RenderState.SlopeScaleDepthBias = 0 Solved that problem. Although it puzzles me still. On cheap gfx cards though, I still cannot get nice lines. Has anyone managed this? RenderState.DepthBias seems to have absolutely no effect that I have noticed on Radeon 9600 Pro, or GeFORCE4 MX. Cheers, Pinky Edited January 10, 2005 by sgt_pinky Quote
ThePentiumGuy Posted January 10, 2005 Posted January 10, 2005 How about trying to raise the lines a little higher than the polys? Then maybe it won't interfere. Or, if you have zbuffer (and depth buffer) turned off, then simply render the lines after you render the poly and you won't get a problem :). I know I know, cheap solution but I guess it works. -TPG Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
sgt_pinky Posted January 11, 2005 Author Posted January 11, 2005 Yeah, I am rendering the lines AFTER poly's to get it that good! If I do the lines before the poly's, they are practically invisible. I can't raise the lines a bit, because then when you rotate the model, they are hidden behind the poly's. When I initialise the device, I use: Device.RenderState.ZBufferEnable = True I haven't set anything for Depth Buffer, so maybe it's off by default or something. Will check that as soon as I finish installing .NET IDE again. I hate getting new computers now, hehe, cos I am so sick of having to install Visual Studio and all the MSDN stuff. Takes like 10 hours :X Quote
sgt_pinky Posted January 12, 2005 Author Posted January 12, 2005 (edited) Couldn't find anything. There must be some way to get RenderState.DepthBias to work, else why is it there. SlopeScaleDepthBias works beautifully on decent cards. The D3D caps show that the worst card supports DepthBias: SupportsDepthBias: True SupportsSlopeScaleDepthBias: False Has me stumped. **EDIT** Found the problem. In the DX help file: The bias is not applied to any line and point primitive. :( (Not withstanding that poor english: The bias is not applied to any line OR point primitive.) Edited January 12, 2005 by sgt_pinky Quote
ThePentiumGuy Posted January 12, 2005 Posted January 12, 2005 So I'm assuming it works now? Edit: I read too quickly. Scratch that. -TPG Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
sgt_pinky Posted January 12, 2005 Author Posted January 12, 2005 Is there some way that I can blend the lines and the poly's together? Since the lines are black, and the poly's are always a lighter colour, this would have a pretty good effect. Quote
IngisKahn Posted January 13, 2005 Posted January 13, 2005 Sure, use a pixel shader. Quote "Who is John Galt?"
sgt_pinky Posted January 13, 2005 Author Posted January 13, 2005 (edited) Ok. I read the C++ documentation on Pixel Shaders. Sounds like there might be something there. Only examples I could find on the 'net though work on textures. Can you give me a tip on how to get it to work on line/triangle primitives? **EDIT** Are pixel shaders even supported in managed code? I can't find half of the functions I am reading about in the C++ doc. eg: where is m_pd3dDevice->CreatePixelShader() ? There is no Device.CreatePixelShader function in managed code. Also, there is no Direct3D.AssembleShaderFromFile() either as far as I can see. Edited January 13, 2005 by sgt_pinky Quote
ThePentiumGuy Posted January 13, 2005 Posted January 13, 2005 Some of the advanced features in unmanaged DirectX didn't make it to Managed DirectX (I heard). Search through MSDN and look for CreatePixelShaderFile() and see if it exists somewhere else Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
IngisKahn Posted January 14, 2005 Posted January 14, 2005 I wouldn't use MDX if it didn't support shaders. Use Shader.CompileFromFile or better yet go HLSL with the Effect object. Quote "Who is John Galt?"
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.