GlitchEnzo

I am currently drawing my 3D mesh in wireframe mode, however I would like the lines to be thicker. Does anybody know of a method of doing this In OpenGL, there is the glLineWidth() function that allows you to set the thickness. I found the RenderState.PointSize variable, however that only affects the size of single points that are drawn, not lines. I thought this would be a fairly simple thing to do, but I have failed to find an answer myself after several hours. Here's hoping that somebody else has solved this already.


Re: XNA Game Studio Express How to adjust line width?

Jim.Welch

I was just reading over this article (Blog post via Ziggyware.com blog). This article might help a little.

(http://blogs.msdn.com/manders/archive/2007/01/07/lines-2d-thick-rounded-line-segments-for-xna-programs.aspx)

On second thought, it appears the article is just about 2D.







Re: XNA Game Studio Express How to adjust line width?

GlitchEnzo

Hmm. While those are rather nice lines, I don't think they would really help with what I am trying to accomplish. Basically I am trying to do a "lazy-man's" cel-shading. I hope to accomplish this through the following:

1) Draw the front facing triangles in a mesh like normal
2) Flip the culling mode
3) Switch to wireframe mode
4) Increase the line width to about 3 times larger than normal
5) Change the color to pure black
6) Draw the rear-facing triangles in the mesh

This method should produce a thick black border around the mesh.




Re: XNA Game Studio Express How to adjust line width?

Leaf.

You could achieve a similar effect by expanding the object along its normals, so the object is inflated, when rendering the black back facing triangles. You could do this in a vertex shader very easily. This would work ok for relatively high resolution meshes.

Cheers,
Leaf.






Re: XNA Game Studio Express How to adjust line width?

GlitchEnzo

Thanks for your answer Leaf. It sounds like that would produce the effect I want. Now, I just need to figure out how to write a vertex shader to do that. I am new to using shaders, obviously.

It still kinda irks me that there is no way to change the width of a line though...




Re: XNA Game Studio Express How to adjust line width?

gmcbay

ATI's RenderMonkey has some pretty cool outline shaders as part of the NPR project it ships with. Converting them over for XNA use is pretty straightforward.