Show us yer programming projects!

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
Post Reply
User avatar
GoatFoam
Baaaaa!
Baaaaa!
Posts: 1255
Joined: Tue Dec 12, 2006 11:05 am 0
Location: Brizzle
Contact:

Re: Show us yer programming projects!

Post by GoatFoam »

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.
User avatar
Orangy Tang
Baaaaa!
Baaaaa!
Posts: 1794
Joined: Sun Apr 25, 2004 5:25 pm 0
Location: My secret lab
Contact:

Re: Show us yer programming projects!

Post by Orangy Tang »

GoatFoam wrote:are you just blatting out triangles, or is it a scanline renderer?
I have no idea, what's the difference between the two?

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 ]
User avatar
GoatFoam
Baaaaa!
Baaaaa!
Posts: 1255
Joined: Tue Dec 12, 2006 11:05 am 0
Location: Brizzle
Contact:

Re: Show us yer programming projects!

Post by GoatFoam »

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 :)
User avatar
Orangy Tang
Baaaaa!
Baaaaa!
Posts: 1794
Joined: Sun Apr 25, 2004 5:25 pm 0
Location: My secret lab
Contact:

Re: Show us yer programming projects!

Post by Orangy Tang »

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. :?
[ Triangular Pixels.net - play Snowman Village, Rescue Squad, NiGHTS 4k and more ] [ Development Journal ]
User avatar
GoatFoam
Baaaaa!
Baaaaa!
Posts: 1255
Joined: Tue Dec 12, 2006 11:05 am 0
Location: Brizzle
Contact:

Re: Show us yer programming projects!

Post by GoatFoam »

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.
User avatar
4mat/atebit
Baa!
Baa!
Posts: 33
Joined: Fri Sep 25, 2009 1:45 pm 0
Contact:

Re: Show us yer programming projects!

Post by 4mat/atebit »

Using JS Script to make a demo running within a sequencer. (Reaper)

User avatar
nyarla
Baaaaaa!
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!

Post by nyarla »

haha 4mat, that's ace! <3 reaper
User avatar
failrate
Baaaaaa!
Baaaaaa!
Posts: 2354
Joined: Sun May 23, 2004 6:54 am 0
Location: Sandy Eggo
Contact:

Re: Show us yer programming projects!

Post by failrate »

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
User avatar
beerman
Baaaaa!
Baaaaa!
Posts: 1305
Joined: Wed Dec 24, 2003 11:22 pm 0
Location: The Beercave
Contact:

Re: Show us yer programming projects!

Post by beerman »

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
User avatar
oNyx
Baaaaa!
Baaaaa!
Posts: 1652
Joined: Mon Sep 08, 2003 1:24 am 0
Location: de/fd

Re: Show us yer programming projects!

Post by oNyx »

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.
User avatar
GoatFoam
Baaaaa!
Baaaaa!
Posts: 1255
Joined: Tue Dec 12, 2006 11:05 am 0
Location: Brizzle
Contact:

Re: Show us yer programming projects!

Post by GoatFoam »

That actually looks really useful :)

Any chance of an isometric mode?
User avatar
Barney
Baaaaaa!
Baaaaaa!
Posts: 2131
Joined: Tue Aug 23, 2005 7:59 pm 0
Location: UK, Broughton, Brigg

Re: Show us yer programming projects!

Post by Barney »

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!
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
User avatar
t0ne
Baaaaaa!
Baaaaaa!
Posts: 3134
Joined: Wed Sep 11, 2002 8:48 am 0
Location: Bristol

Re: Show us yer programming projects!

Post by t0ne »

Nice, that is very cool.
User avatar
nyarla
Baaaaaa!
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!

Post by nyarla »

Image

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. 8)

(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..)
User avatar
sack
Baaaaaaa!
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!

Post by sack »

looks good - like a procedurally generated space station
Post Reply