Software render library

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
ReKleSS
Posts: 73
Joined: Sat Jun 18, 2005 12:57 pm
Location: Melbourne, Australia

Software render library

Post by ReKleSS »

Hi all,
Since nobody has figured out how to use the psp's 3d hardware to draw polygons to the screen, I thought I'd do the next best thing and write a software renderer. It's available from http://www.innerworldadventures.com/renderer.tar.bz2. (Pay no attention to innerworldadventures.com, I just admin it and make use of extra space and bandwidth.) Anyway, what works:
  • Raster lines
    Raster polygons
    Filled raster polygons
    3d lines
    3d wireframe polygons
    3d filled polygons
What's still to be done:
  • Backface culling
    Z-Buffering
    Text rendering
    User input library
The render library was designed to resemble OpenGL, but seriously stripped down. It does what it should, draw (flat) polygons. The raster library may also be of interest. Anyway, this is still very early and probably has a few bugs... Post them here and I'll try to fix them up for the next release. The only problem that comes to mind at the moment is that the axis passed to rend_rotate must be normalized, since I haven't got an implementation of sqrt() yet and can't do it there.

trig.rb is a Ruby script that generates my precalculated sin, cos and tan tables.

All the library code (render.*, matrix.*, raster.*, test.c, trig.*) is under the BSD license. The rest (startup.S, param.sfo, icon0.png, etc) were taken from nemnem's helloworld.

The demo program (eboot.pbp, test.c) is a sample of how to draw stuff. left, right, up, down, triangle, X, R and L to move the triangle around. Go crazy.

-ReK
71M
Posts: 122
Joined: Tue Jun 21, 2005 5:28 am
Location: London

Post by 71M »

Hi ReKleSS,
Nice work on the demo! :)
If you want to a SQRT function, you can download the source to my demo over at http://www.psphacker.com/forum/showthread.php?t=635
The SQRT function is only a rough estimate and not that precise, so don't go calculate any flight paths with it :)
I found it very hard developing a PSP demo without the basic functions of a PC!

Hope you find something useful.

Cheers,
71M
User avatar
neofar
Posts: 47
Joined: Wed Jan 21, 2004 2:40 am
Location: Spain
Contact:

Post by neofar »

71M
Posts: 122
Joined: Tue Jun 21, 2005 5:28 am
Location: London

Post by 71M »

I could never get those to work. what're the parameters?
Have you had any luck using them?

Cheers,
71M
Vampire
Posts: 138
Joined: Tue Apr 12, 2005 8:16 am

Post by Vampire »

71M wrote:what're the parameters?
takes a float value and returns a float value...
User avatar
neofar
Posts: 47
Joined: Wed Jan 21, 2004 2:40 am
Location: Spain
Contact:

Post by neofar »

nop .... but it's very very probably to be a

Code: Select all

float function(float);
You should read this
http://forums.ps2dev.org/viewtopic.php?t=2197
I don't know how psp works with floats, or if this is important here..
71M
Posts: 122
Joined: Tue Jun 21, 2005 5:28 am
Location: London

Post by 71M »

Very useful indeed!
I'll take a closer look at that now...

Thanks,
71M
User avatar
ReKleSS
Posts: 73
Joined: Sat Jun 18, 2005 12:57 pm
Location: Melbourne, Australia

Doesn't work

Post by ReKleSS »

I've already tried this (for the trig functions). If you as much as add them to startup.s, the psp will freeze. This is probably because the prx with the functions isn't loaded. If you can find the prx and load it, that might work...

-ReK
User avatar
ReKleSS
Posts: 73
Joined: Sat Jun 18, 2005 12:57 pm
Location: Melbourne, Australia

Post by ReKleSS »

Finished version 2. This is basically the full featureset, the only thing left is optimization, which will probably never be done because it's pretty boring and chp has almost finished with the 3d hardware. Anyway, texturing, z buffering and backface culling are all included in this release, as well as my own text rendering code (no more pg.c!). It's available from http://www.innerworldadventures.com/psp ... v2.tar.bz2. If you want to compile it, you'll need at least the 20050625 toolchain.

I've also written up a bmp to c file converter (it was in the last release) and a program to build my font.c file. Both are at http://www.innerworldadventures.com/utils.tar.bz2.

No sample code included this time, I'm working on a little proof-of-concept game that will demonstrate most of the features. In the meantime just read the header files.

EDIT: The sample code is up at http://www.innerworldadventuse.com/core.tar.bz2. I've also noticed that the texture mapping isn't as effective as I thought - I'm looking into that now.

-ReK
Post Reply