Author Topic: Triangles again!  (Read 5308 times)

0 Members and 1 Guest are viewing this topic.

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Triangles again!
« on: February 07, 2012 »
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.

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Accidental function!
« Reply #1 on: February 18, 2012 »
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?

Offline ttemper

  • Amiga 1200
  • ****
  • Posts: 267
  • Karma: 7
    • View Profile
Re: Triangles again!
« Reply #2 on: February 18, 2012 »
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.
« Last Edit: February 18, 2012 by ttemper »

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: Triangles again!
« Reply #3 on: February 20, 2012 »
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.

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: Triangles again!
« Reply #4 on: February 20, 2012 »
Can you post an exe?
www.kirl.nl
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: Triangles again!
« Reply #5 on: February 20, 2012 »
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.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Triangles again!
« Reply #6 on: February 20, 2012 »
That's really quite trippy and hypnotic to watch Stonemonkey :)

How many cubes are there?
raizor

Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: Triangles again!
« Reply #7 on: February 20, 2012 »
Only 10k cubes atm.

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: Triangles again!
« Reply #8 on: February 20, 2012 »
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: