• Welcome to Dark Bit Factory & Gravity.
 

Triangles again!

Started by Stonemonkey, February 07, 2012

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Stonemonkey

Not having done much for a while I've been looking at triangles again. It's not really doing much atm, affine mapping with vertex colour modulation. Anyway, I remembered Jim suggesting ages ago about using types for the edges so using that I found I can get away with only calculating the gradients down the main edge no matter what side it's on and the clip/sub-pixel code can still take care of it without any changes and only the gradient for x is needed for the short edges.

Not very exciting but thought it was pretty cool as it tidies up some things I didn't like before.

Stonemonkey

Taken this a bit further now and got some cubes, to allow some flexibility, instead of shading the pixels in the rasterizer I am just writing the shade value into the alpha channel then shading in a pass over the buffer after rendering. I did this before for doing stencil shadows so only 1 pass was needed. I wasn't masking the alpha from the texture in the rasteriser and thought I should just make sure there's no alpha in the texture to interfere with the shading.
Anyway, I was just trying to come up with a way using the brushes to switch shading on/off for the triangles when I noticed I could just write &ff into the alpha of a texel and it won't be shaded.
Might be other stuff I can do with this too, not sure what yet but I could make the shading 7 bit instead and use the last bit in the texture for other things, any ideas anyone?

ttemper

#2
WOW, you've been busy, and a nice 3d engine to boot. I'd like to see this in action, got any binary examples to show? I can definitely learn from this, excellent stuff Stonemonkey.

*edit, nevermind about that binary, I should have read the whole code first, saw the loops at the end. nice once. looks fantastic.

Stonemonkey

It's mostly some old stuff I'm trying to cobble together  with some new bits n pieces since I've not done anything for ages.

Kirl

Can you post an exe?
www.kirl.nl
Challenge Trophies Won:

Stonemonkey

Sure but it's just another of my wierd cube tests. Been trying a bit of sse/mmx here but I need to look into other things too, been reading some of Abrash and Carmacks stuff so have some things to think about.

There's a slight bug in the sse version, the first pixel of the scanlines isn't always coloured properly.

Raizor

That's really quite trippy and hypnotic to watch Stonemonkey :)

How many cubes are there?
raizor

Challenge Trophies Won:

Stonemonkey

Only 10k cubes atm.

Kirl

Thanks for compiling Stonemonkey, I'll second Raizor! :)

I love tests, especially weird ones where most of the stuff doesn't make sense to the uninitiated! You did well!  ;D
www.kirl.nl
Challenge Trophies Won: