Pi3D

Liz: Some news from Tim Skillman – which is going to be particularly interesting for those of you who wanted to use the accelerated 3D potential of the Raspberry Pi, but who didn’t fancy getting down and dirty with OpenGL ES. Pi3D is still a work in progress, but there’s already plenty you can already it do with it if you’re interesting in playing with 3D models on your Raspberry Pi. Tim includes download links for the module and for some examples. Over to Tim!

Pi3D is a Python module designed to open up the 3D abilities of the Raspberry Pi BUT with a difference: it will provide simple yet powerful functions for kids (and adults) to create 3D with very little knowledge of programming. The main aim of Pi3D is to instil some fun and excitement and get kids (and adults) coding!

Eventually, Pi3D will import and render several 3D & 2D file formats, create 3D objects, fractal landscapes, compile scenes into vertex arrays and render shaders. Pi3D is in its early stages although you can already experiment with both 3D models and 2D sprites (similar to pygame – but much faster and more capable!) Pi3D also uses the Python Imaging Library, so this will need to be installed first (instructions with the code).

The pi3d module is accompanied with four examples, ‘boxtest.py’, ‘raspberry_rain.py’, ‘bouncing balls.py’ and ‘clouds3d.py’ that demonstrate both 3D and 2D rendering. The code is available at www.github.com/tipam/pi3d or download it now at https://github.com/tipam/pi3d/tarball/master

Pi3D was initially based on Peter de Rivaz’s pyopenegl ‘Mandelbrot’ example and both of us have since been developing the code. Have fun!

26 comments

tzj avatar

this is fantastic!

Whoop John avatar

Not to mention oh so groovy

Jim Manley avatar

Virtual lava lamps can’t be far away, now! :D

This is very interesting. On the Pi-finity! educational game system I’m working on with other Pi developers, we’ve been looking at porting all, or some part, of a game engine such as Panda3D. However, given the limitations of the Pi RAM, especially being split between the CPU and GPU, that’s a real challenge.

I’ll be checking out Pi3D to see how it works and, since the goal of Pi-finity! is to help teach science, technology, engineering, and math using software development techniques, with Python being the most likely programming tool based on the Foundation’s intents, Pi3D may be useful in our efforts.

Tim Skillman avatar

Hi Jim – I’d like to test Pi3D with you if you like. It’s been advancing in the past few days and I would appreciate your comments. I’m nearly ready for an update on the github and I’ve added lots of goodies. There’s some more info about Pi3D on the github wiki.

paddy gaunt avatar

Tim, this seems to work pretty well. I too had been playing around with panda3d and hoping that someone (Jim!) would get it running on the pi. I might jump ships!
in boxtext.py I put in a:
for cubeList in range(80):
and scattered them around the screen and it seemed to cope without grinding to a halt. I will have a go at testing it to destruction later!

Do you have a schedule for writing the methods you mention? Do you want a hand with any? I would like to have the equivalent of panda3d loadModel() but I won’t start trying to code that if you plan to use a different 3d object format.

Thanks for the excellent work.

Tim Skillman avatar

Hi Paddy, I will have a schedule soon which will be uploaded to my github. Right now I’m debugging bit’s n pieces (just fixed the transparency problem with the clouds) You’re Panda3D loadModel() code sounds awesome! … if it could return an array of buffers for vertex, normal, tex_coord etc … (ie. ready to render) – that would be great!! (hmm …. that’s probably sounds quite a tall order!)
Tim

paddywooff avatar

Tim, I quite like the desktop showing through but obviously it shouldn’t if the background alpha is set to 1. Not looked for the bug but a work round could be to put a plane in the background. I have tidied up the code for rendering the clouds in the right order

paddywooff avatar

don’t seem to be able to post code here so will put it in a post in the forum under pi3d

Tim Skillman avatar

… thanks again – I’ll fix the clouds with your code. I’ve also updated pi3d to fix the alpha problem.

Frankie Robertson avatar

This is relevant to my interests.
Tim: Have you seen VPython? While the site is crufty and it hasn’t been updated for a while, I quite like the API and had actually been vaguely wondering about the viability of porting it to OpenGL ES at some point, but that looks like it won’t be neccesary now. Either way, may be worth a look for ideas…

Tim Skillman avatar

… there are some great features on VPython – and some good ideas – I’ll keep an eye on it. If there’s any particular features you’d like to see in Pi3D, then I could consider them for development. Thanks – Tim.

juanRIOT avatar

is there anything Raspi “can not” do? apparently none. Raspi can do what a normal desktop can.
Keep it up guys with your work on Pi3D! its awesome. youre awesome. Raspi is awesome.

Matt avatar

Is it possible (or will it be possible in the near future) to render text with Pi3D? Keep up the awesome work!

Tim Skillman avatar

Hi Matt – yes, I’m working on something at the moment although it wont be vector based (at least for now). Tim

Matthew Timmons- Brown avatar

I think that this is great and something I am going to really look forward to doing on my pi when it arrives. I am just wondering what kind of piece of software will be up for download? how big will it be? what kind of programming will be required? pre set commands or python based? thanks and keep up the amazing work!!!

Tim Skillman avatar

I should have a load of basic shapes programmed into Pi3D by early next week; sphere, torus, spring, lathe (i.e. a path spun around the Y axis to create a vase for example). All of them can be scaled in any axis. It’s looking quite promising so far – even hi-poly shapes don’t seem to slow the RPi down!

paddy gaunt avatar

Tim, the loadModel stuff seems to work so you can pretty much design and load any shape. I haven’t sorted the different material and texture groups but, now that it’s generally working, it should be easy enough to do. I think that getting all the articulated movement and animation is too ambitious at this stage. (Read as: easier to get panad3D compiled for the PI) Also see my video of thousands of polygons whizzing around.

Tim Skillman avatar

Wow – that’s great! Can your loadModel source be incorporated in Pi3D? If so, do you have a download link? Can’t wait to see it.
Tim

paddywooff avatar

It’s here
http://www.eldwick.org.uk/files/loadmodel.zip
and the latest (crappy) video is
http://youtu.be/8FVvahS8btE
various thoughts and suggestions on the pi3d forum thread

paddywooff avatar

quite easy to break with random other egg files (as opposed to ones I have made with blender). working on making it a little more sophisticated so it copes better

Tim Skillman avatar

This is a really good start – please let me know when you’ve updated it.

paddywooff avatar

Tim, added a further update on forum/programming/python/pi3d

Grabell avatar

This is great! I’ve done a few things, and it looks fantastic. Is there set of docs or API for this?

Tim Skillman avatar

There will be quite soon. I need to get the core functions defined properly so that I haven’t got to keep re-writing the manual!! Already I’ve added in name properties and defined a seperate 2D & 3D context. I’ll start a wiki soon and get some info out. Tim

Bogdan avatar

Having a board with a high performance graphical accelerator for only 25$ is almost unbelievable. It’s amazing what it can do !

Tim Skillman avatar

Just to let you know that the next Pi3D update is ready with lots more demos including Panda3D model loading by Paddy Gaunt on http://www.github.com/tipam/pi3d. There’s some info on the github Wiki as well (still writing it). I would value your comments, suggestions so give it a try and have fun!!
Tim Skillman

Comments are closed