• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# 3d on an 8-bit cpu

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1symbiote  Members

Posted 16 April 2012 - 05:18 PM

hi guys,

i want to create some 3D on an 8-bit cpu (but with ~4kb memory). basicly i want to be able to specify some shapes, with polygons that have orientation and position (probably with matrices).

i thought about implementing 8-bit minifloats (bits: 1 sign, 4 exponent, 3 fraction/mantissa) for my computations, this would allow me to make small changes to smaller values. but not smaller changes to greater values. which would not be a problem with what is being viewed but it would be a problem in logic, such as calculating the distances between shapes. if i would try to store the positions of polygons relative to eachother within the same shape, then the values of the minifloats might not be so high. but the world would still have to have distances between shapes. also shapes that have linear speed would be hard to track the position of because miniflaots don't increment linearly. also designing a world with where shapes have these kinds of coordinates could be a problem.

- should i try to implement a 16-bit integer format to solve the incrementation of speed?
- should i drop the minifloat idea and do everything with 16-bit integers?
- what do you normally do when you're world doesn't fit into floating points? (are there any special techniques?)
- should i accept the 8-bit integers of the cpu and use that? (i doubt 127 values in each direction is big enough for all coordinates but it might be for what is on screen)

symbiote

### #2Ravyne  Members

Posted 16 April 2012 - 06:17 PM

You're probably going to want to do fixed-point math in 16 or even 24 bits, depending on the accuracy you require.

In general this sort of work requires you to know where the significant bits of your calculation is currently at, and to exploit that to maintain accuracy at all stages. The fewer bits you're working with, the more attention you will have to pay to these issues.

I worked on a small ray-caster (like Wolfenstien 3D) using 16bit math, and lost interest before taking it very far, but the limitations of fixed point in 16bit was apparent even in relatively straight-forward math.

Benryves was workiing on a raycaster for the TI-83+ awhile back, using 16bit fixed-point, IIRC.

Here are a few links to his stuff:
Journal: 8-bit Raycasting Quake Skies and Animated Textures
Journal: A primitive 3D engine for the TI-83+
Web: http://benryves.com/journal

throw table_exception("(ノ ゜Д゜)ノ ︵ ┻━┻");

### #3symbiote  Members

Posted 16 April 2012 - 08:17 PM

thanks. those links look pretty good. and useful information too

### #4Sik_the_hedgehog  Members

Posted 18 April 2012 - 11:49 PM

8-bit processor with 4KB of memory... that's going to be... interesting. First of all, is it 4KB for everything, or just for work RAM? (i.e. the code and model data is in separate ROM) Because in the case of the latter you could get a lot of speed up by using look-up tables. If everything has to fit in 4KB, tough luck getting many tables there.

Also: 8-bit integers may be enough to specify the shape of a given mesh. You won't be able to make very detailed meshes anyways if you pretend to have any sort of speed, not to mention memory usage =P If you can get away with 8-bit integers you're going to make your life a lot easier when it comes to performance.

Another thing is what kind of transformations you plan to do. Translation is easy. Scaling needs multiplications... Rotation is going to be madness the usual way. If you plan to do rotation you may want to use polar coordinates, because then to rotate you just need to add a value to the angle, and then you can convert it to X/Y/Z coordinates using a look-up table or something, reducing or even avoiding the multiplcations needed.

Clipping is going to be madness. I hope you have a plan for this one, especially for the near-Z plane (for the X/Y planes you could attempt to clip while rendering the triangles, for the far-Z plane just remove polygons after a certain distance, like pop-up for early 3D games used to work).

Also: cheat as much as you can. Seriously, if there's something that could be rendered with something that isn't standard polygons but rather a more restricted shape that could be done with a more specific algorithm, by all means try to do that. You can use this to reduce model complexity a lot and gain extra speed.

I'm pretty sure there's a lot more to be said, but that's what comes to my mind right now. It'd be useful to know how much memory do you actually have (if the code has to go in those 4KB or it's separate).
Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

### #5Ravyne  Members

Posted 19 April 2012 - 12:16 AM

Ugh, dammit. Phones are terrible for accidentally clicking things you don't mean to. Sorry for the -1 Sik, maybe someone will come along and fix it.

throw table_exception("(ノ ゜Д゜)ノ ︵ ┻━┻");

### #6RobTheBloke  Members

Posted 20 April 2012 - 10:43 AM

This might give you some inspiration:

http://z88dk.cvs.sourceforge.net/viewvc/z88dk/z88dk/libsrc/lib3d/

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.