Show us yer programming projects!
Re: Show us yer programming projects!
are you just blatting out triangles, or is it a scanline renderer?
if the latter then adding AA should be reasonably cheap, as you should be able to make an A buffer run v fast on a modern box.
if the latter then adding AA should be reasonably cheap, as you should be able to make an A buffer run v fast on a modern box.
- Orangy Tang
- Baaaaa!

- Posts: 1794
- Joined: Sun Apr 25, 2004 5:25 pm 0
- Location: My secret lab
- Contact:
Re: Show us yer programming projects!
I have no idea, what's the difference between the two?GoatFoam wrote:are you just blatting out triangles, or is it a scanline renderer?
Currently rasterisation is done by looping over the triangle's bounding box and calculating the barycentric coords at each pixel, then using that to either reject the pixel or interpolate the vertex attributes. That's hideously slow though, and I'm trying to figure out how to generate perspective correct barycentric coords at the moment.
I have vague ideas to do something similar to larrabee and first find which screen tiles a triangle intersects ( http://www.gamasutra.com/view/feature/4 ... ation_.php ) and then do my current approach on the screen tiles. That'll skip a bunch of dead space and make things easier to multi-thread. That's my current thinking at least - I'm open to other suggestions.
What's an A buffer? Google only shows up a paper behind a paywall (screw you acm!).
[ Triangular Pixels.net - play Snowman Village, Rescue Squad, NiGHTS 4k and more ] [ Development Journal ]
Re: Show us yer programming projects!
I used to write software renderers for a living, but it's been a while so I will try and remember...
Simple scanline renderer:
1. cull backfacing triangles, either by normal or winding direction.
2. sort all your triangles in screen y, and mark their min and max y values.
3. Then for each scan line you work out the beginning and end of the span covered by each active triangle. Because all the lines are straight you can do this incrementally as you work down the screen.
4. If triangles overlap work out which is in front and split the scan line into visible spans. Sorted left to right.
5. work along these spans and fill stuff in.
As you work across you can interpolate things like colour, depth, position etc. and use that as input for shaders if you wish.
If you track depth across the triangle then you can use a single scanline high depth buffer and ignore the "split scanline into visible spans" step, but that costs you the ability to add AA later.
Texturing tip: 1/z can be interpolated linearly, and that's all i'm saying
Simple scanline renderer:
1. cull backfacing triangles, either by normal or winding direction.
2. sort all your triangles in screen y, and mark their min and max y values.
3. Then for each scan line you work out the beginning and end of the span covered by each active triangle. Because all the lines are straight you can do this incrementally as you work down the screen.
4. If triangles overlap work out which is in front and split the scan line into visible spans. Sorted left to right.
5. work along these spans and fill stuff in.
As you work across you can interpolate things like colour, depth, position etc. and use that as input for shaders if you wish.
If you track depth across the triangle then you can use a single scanline high depth buffer and ignore the "split scanline into visible spans" step, but that costs you the ability to add AA later.
Texturing tip: 1/z can be interpolated linearly, and that's all i'm saying
- Orangy Tang
- Baaaaa!

- Posts: 1794
- Joined: Sun Apr 25, 2004 5:25 pm 0
- Location: My secret lab
- Contact:
Re: Show us yer programming projects!
Ah, that makes sense. In that case I'm just blatting out triangles with the aid of a zbuffer. The idea is to have a software renderer that functions like a software OpenGL, with very similar API and rendering methodology, so I'm just drawing triangles as they come in rather than any kind of deferred approach.
RE: texturing - I gather I can just use the same barycentric coords and interpolate 1/z, but this doc ( http://fileadmin.cs.lth.se/cs/Education ... zation.pdf ) has a modified barycentric formula that directly calculates perspective correct weights, which should be more efficient. Unfortunately I can't wrap my brain around the formulas at the bottom.
RE: texturing - I gather I can just use the same barycentric coords and interpolate 1/z, but this doc ( http://fileadmin.cs.lth.se/cs/Education ... zation.pdf ) has a modified barycentric formula that directly calculates perspective correct weights, which should be more efficient. Unfortunately I can't wrap my brain around the formulas at the bottom.
[ Triangular Pixels.net - play Snowman Village, Rescue Squad, NiGHTS 4k and more ] [ Development Journal ]
Re: Show us yer programming projects!
The maths looks quite vicious, but deep down it is just reversing your perspective transformation to give you real texture coords. Use of homogeneous coordinates makes things cleaner mathematically, but harder to learn IMHO.
If you have got this far you will crack it though.
If you have got this far you will crack it though.
- 4mat/atebit
- Baa!

- Posts: 33
- Joined: Fri Sep 25, 2009 1:45 pm 0
- Contact:
Re: Show us yer programming projects!
Using JS Script to make a demo running within a sequencer. (Reaper)
- nyarla
- Baaaaaa!

- Posts: 2820
- Joined: Tue Jan 14, 2003 1:53 pm 0
- Location: i said kiss me you're beautiful these are truly the last days
- Contact:
Re: Show us yer programming projects!
haha 4mat, that's ace! <3 reaper
Re: Show us yer programming projects!
I just finished porting my game Piconesia from Flash/AS3 to JavaScript. The server is a node.js server hosted on Joyent. Right now, it's not doing anything more sophisticated than serving up simple templates, but all the usual user/login, highscore, savegame rigamarole will be on there, and it will be a 100% JavaScript stack.
http://picoverse.no.de/games/piconesia
http://picoverse.no.de/games/piconesia
Re: Show us yer programming projects!
Been having a muck around with some Android coding lately, managed to come up with this:
"even had I suspected then the truly horrifying suffering and amazing loss of life that would be caused by our well-meaning enterprise... I'd have done it anyway. Only more so."
Lagertron for Android It's Robotron at the pub!
My stuff
Lagertron for Android It's Robotron at the pub!
My stuff
Re: Show us yer programming projects!
http://dotgrid.kaioa.com/
Allows you to print different dot grids onto paper. Wrote it yesterday. Works best with Opera and ok-ish with Firefox. (IE6-9 is broken and Chrome doesn't offer an option for printing backgrounds.)
Since it uses very little ink/toner, it's a lot cheaper than buying dot grid paper (around 5 bucks for 80 pages and kinda hard to get). Even with a super cheap laser you pay less than 0.2 cents for the toner per page.
If you do some wireframing, give it a shot. Dots are a lot nicer than grids, because drawing lines on top of other lines doesn't give you the nice edges you're looking for.
Allows you to print different dot grids onto paper. Wrote it yesterday. Works best with Opera and ok-ish with Firefox. (IE6-9 is broken and Chrome doesn't offer an option for printing backgrounds.)
Since it uses very little ink/toner, it's a lot cheaper than buying dot grid paper (around 5 bucks for 80 pages and kinda hard to get). Even with a super cheap laser you pay less than 0.2 cents for the toner per page.
If you do some wireframing, give it a shot. Dots are a lot nicer than grids, because drawing lines on top of other lines doesn't give you the nice edges you're looking for.
弾幕 ☆ eee games ☆ smart ass no jutsu!
Re: Show us yer programming projects!
That actually looks really useful 
Any chance of an isometric mode?
Any chance of an isometric mode?
Re: Show us yer programming projects!
For the last two years (or so) some of you may have been aware that I've been writing a little BASIC interpreter based on SpecBAS. Well, one of the guys who's been testing has done this:
Which even considering it's an interpreted BASIC isn't terribly impressive for today's hardware. However, my jaw dropped when I saw the code snippet at the start... And it really does appear that this is a BASIC interpreter interpreting the Space Invaders ROM image! That is very, very impressive to me.
I am really looking forward to getting this ported to the rPI, I really am!
Which even considering it's an interpreted BASIC isn't terribly impressive for today's hardware. However, my jaw dropped when I saw the code snippet at the start... And it really does appear that this is a BASIC interpreter interpreting the Space Invaders ROM image! That is very, very impressive to me.
I am really looking forward to getting this ported to the rPI, I really am!
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
- nyarla
- Baaaaaa!

- Posts: 2820
- Joined: Tue Jan 14, 2003 1:53 pm 0
- Location: i said kiss me you're beautiful these are truly the last days
- Contact:
Re: Show us yer programming projects!

forget-me-not maze generator making 3d mazes (external view).
it's not fmn 3d or anything, i want to make a grid based first person rpg like etrian odyssey in space.
(can't believe i actually got this working. not that it's anything fancy. but simple 3d like this was well beyond my reach last time i tried..)
- sack
- Baaaaaaa!

- Posts: 7077
- Joined: Fri May 10, 2002 4:13 pm 0
- XBL Gamertag: evilgopher
- PSN: sixFiveOhTwo
- Location: Rijswijk, The Netherlands
- Contact:
Re: Show us yer programming projects!
looks good - like a procedurally generated space station


