Skip to main content

soft3d - 0

A 3d software rendering experiment - texture mapped, "lit" polygons, with translation, rotation, and texture scrolling


patrick mullen
(saluk)
Eventually I need to incorporate some 3d effects into one of my projects, but the 3d I need is fairly low poly and only used sparingly. It doesn't seem worth the effort to convert the entire huge system to opengl, as I will lose compatibility. So I thought, why not just render 3d in software.

So far this is just an experiment, but it almost has everything I need. I have optimized for speed as much as I think I can.

Controls:

* arrow keys - move 4-sided box around the screen
* a/z - zoom in and out - don't zoom in too far it may crash
* r,t,y - rotate the box on it's axis

Features:
* surfarray rendering for fast pixels
* 3d math only done on triangle corners
* texture mapped triangles, triangulated quads
* depth buffer for hidden surface removal
* pixel clipping

Changes

First release

Shows a 3d texture mapped 4-sided box with one of it's faces scrolling the texture coordinates

I'm curious what kind of speeds you guys get, as well as if anyone has any ideas for further optimization. Short of a c module of course, which it might become eventually.

Links

Home Page
https://github.com/saluk/pygame_soft3d
Source
http://pygame-soft3d.googlecode.com/files/soft3d-v0.zip
Github repo
https://github.com/saluk/pygame_soft3d

Releases

soft3d 0 — 20 Oct, 2010

Pygame.org account Comments

  • pixdigit 2015-03-11 21:42

    I got from 30 to 100 fps
    (without psyco....)

    Saluk64007 2017-03-31 19:05

    I would love to see how you improved it!