View Single Post
Old 26 February 2015, 11:48   #25
Mrs Beanbag
Glastonbridge Software
Mrs Beanbag's Avatar
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,202
Originally Posted by mc6809e View Post
Ah, that final statement suggests to me that I maybe I haven't been clear enough.
maybe the both of us.

What I'm talking about is first drawing one filled single bitplane polygon of a larger object in a buffer. Then by using that single bitplane polygon, write zeros or ones as appropriate directly onto the bitplanes of next frame to be displayed (as in a double buffered scheme) by setting the correct LF for each plane to set the color.
What i'm talking about is first drawing multiple filled 2-bitplane polygons of a large object in a buffer. Then by using that 2 bitplane sub-object (it need not be entirely closed), write zeros or ones as appropriate directly onto the bitplanes of next frame to be displayed by setting the correct LF for each plane to set the color (use all three blitter sources to do the copy, so we can set minterms to map source values 1, 2, 3 into any colour combination on the destination).

So you can render three or more polygons with only two fills and one copy per bitplane of destination screen. This buffer need not be cleared afterwards, because we can use a separate buffer to render the lines and just clear that by going over the lines a second time. Each line will only need drawing exactly twice, with shared edges eliminated.

Consider a simple cube. When seen from some angle where any 3 sides are visible, the bounding boxes of these sides will significantly overlap. Doing 3 slightly smaller fills/copies won't be as fast as doing 2 fills and 1 copy.

If the polygons are simply drawn back to front, then there's no need for hidden surface removal and there's no need to restrict one's self to convex polyhedra or to objects that have no holes.
I don't know why you wouldn't do hidden surface removal in any case. The calculation is very simple (either by normal vectors or the clockwise/anticlockwise test) and is certainly faster than drawing the polygon. Plus it leaves you with the problem of sorting each individual polygon, which is not a trivial thing to do (simple Z sorting is not reliable enough and sorting can't be done in linear time in general). I have actually used a sort of manually-constructed BSP to build up more complex shapes.

Objects with holes don't cause a problem, neither do completely concave objects. For instance one could render a cube with a tunnel through by rendering the tunnel and then rendering the cube with holes in.

One can also set any of the sub-object colours to transparent and effectively use one of the source bitplanes as a mask, so you can render concave features onto things AFTER drawing them. You can also use non-convex/concave objects to do weird effects since overlapping polygons will XOR with each other, as well as 2-colour surface decals.

Here is an illustration showing the potential overlap of polygon bounding boxes on a rotated cube:

The overlap could be even more when we consider we have to snap to word boundaries.

Last edited by Mrs Beanbag; 26 February 2015 at 12:11. Reason: added illustration
Mrs Beanbag is offline  
Page generated in 0.04077 seconds with 10 queries