Line Rendering Problem

sgt_pinky

Regular
Joined
Jan 5, 2005
Messages
80
Location
Melbourne, Australia
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:

Visual Basic:
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:

Visual Basic:
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
 

Attachments

Last edited:
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
 
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:

Visual Basic:
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
 
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.)
 
Last edited:
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.
 
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.
 
Last edited:
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
 
Back
Top