3D programing question...
by MSW · in General Discussion · 12/01/2001 (9:19 pm) · 3 replies
I'm relitivly new to programing...actually I'm pretty decent at Pascal, Basic, and C (some assembler)...but have no experience in object oriented programing (I find C++ and Java intimidateing)...anyway this question is mainly about 3D graphics...
I've programmed some pretty basic 3D engines...and with the help of basic polygon drawing libraries...I can even program something resembleing a real time 3D engine :P
I'm interested in cell shadeing...not quite the way it is often done...but...er...I want to do completely "flat" shadeing...trying to emulate the older flat animated look...rather then the slightly "shaded" look now common...
Right now I have a simple model format in which each polygon is assigned a color...and each edge can be linked to another polygon...then when the engine draws the polygon it would check if the polygon along a given edge is visable (or NULL) and make the last few pixels of the polygon edge black rather then the normal color if the test fails...clean and simple...easy enough to implament in software..and it provides the exact look I'm after...
Question is can such a thing be done in Direct X? With a 3D card? How many polygons could such a engine handle in real time (I'm looking at 200-300 polygons just for a characters head)?
I've programmed some pretty basic 3D engines...and with the help of basic polygon drawing libraries...I can even program something resembleing a real time 3D engine :P
I'm interested in cell shadeing...not quite the way it is often done...but...er...I want to do completely "flat" shadeing...trying to emulate the older flat animated look...rather then the slightly "shaded" look now common...
Right now I have a simple model format in which each polygon is assigned a color...and each edge can be linked to another polygon...then when the engine draws the polygon it would check if the polygon along a given edge is visable (or NULL) and make the last few pixels of the polygon edge black rather then the normal color if the test fails...clean and simple...easy enough to implament in software..and it provides the exact look I'm after...
Question is can such a thing be done in Direct X? With a 3D card? How many polygons could such a engine handle in real time (I'm looking at 200-300 polygons just for a characters head)?
About the author
#2
I've read a number of ways to do cell shadeing with Direct X...but none of them produce the results I'm after...
So, is it possible to do a 3D Direct X software engine?...I mean create a 2D direct X surface in memory to draw the polygons onto (useing assembly routines) then blit it to video memory to display onscreen?...would this be fast enough to produce 20-40 frames per second on most PCs? These are, afterall flat shaded polygons, so could it do this with high polygon count models (1,000-2,000) and enviroments?...To do what I have in mind wouldn't really need more then 8-bit color (altho 16-bit would be nice)...
12/02/2001 (9:10 am)
Thanks for the reply :)I've read a number of ways to do cell shadeing with Direct X...but none of them produce the results I'm after...
So, is it possible to do a 3D Direct X software engine?...I mean create a 2D direct X surface in memory to draw the polygons onto (useing assembly routines) then blit it to video memory to display onscreen?...would this be fast enough to produce 20-40 frames per second on most PCs? These are, afterall flat shaded polygons, so could it do this with high polygon count models (1,000-2,000) and enviroments?...To do what I have in mind wouldn't really need more then 8-bit color (altho 16-bit would be nice)...
#3
12/02/2001 (9:28 am)
You can use DirectDraw to get direct access to the backbuffer, so you could do software rendering to it, and DirectDraw will use any 2D acceleration the card has to make it draw all nice and fast and in full-screen.
William Finlayson
The easyist I think would be to take the points at the edge of your polygon, and draw a black line connecting them. It would be nice and fast, but it would only make a 1 pixel border wound the polygon, maybe not what you're after.
Another way to do it would be to use a stencil buffer, and create a mask round the outside of the polygon. It would draw the center of the polygon, and you could fill in the border black. This way you could make the outline any size. I have never used a stencil buffer, as my card doesn't support them, so I've no idea how easy or fast this would be.
I suppose it could also be done by drawing two polygons for every polygon. Draw a flat shadedblack polygon to the actual size you want, and then draw the coloured polygon on top, but slightly scaled down, so that there is a border left round the outside. As the two polygons are on the same plane, you would have to use the Z-Bias to make sure that the black one is drawn under the coloured one.
I hope that helps, like I said I'v never tried it so I don't know if any of these methods would actually work, I might give it a go today though.