Showing posts with label 3d. Show all posts
Showing posts with label 3d. Show all posts

Saturday, September 1, 2012

VPython Revisited and the Problems with 3D Projection


I previously wrote about VPython close to a year ago as a bit of fun eye candy for my student, who at the time was 12 years old.  After a break due to soccer, track, and summer activities, I started to focus on a memory game first and then a racer game.  It took an entire summer of sporadic weekends to finish two games and I feel we bit off more than we could handle.

After the problems with the memory game data structures and the headaches of 3D projection, the videos on VPython were fun and immediately rewarding.   I highly recommend these videos for 11 to 13 year old children.

Unfortunately, I can't recommend 3D projection until they get a bit further along in math.

So, why was 3D projection so tough?

Well, for one thing, complexities of 3D projection were getting a bit too tedious.  I didn't realize this, but my student hadn't studied the z-axis in school yet.  He had covered cross multiplication, but wasn't an expert at it.    The key to figuring out a simple projection method was to  use Louis Gorenfeld's Pseudo 3D page.


The application revolves around this deceptively simple formula.

Y_screen = (Y_world / Z) + (y_resolution / 2)
There are numerous libraries that can handle the 3D calculations for the student.  VPython is super easy to use.  Perhaps we'll revisit 3D projection after my students gets further along in math.

Wednesday, October 19, 2011

Use Blender to Create 3D Objects

Since I gave my 7th grade student an introduction to 3D Python programming using Panda3D, I also reviewed the basics of Blender.  After the introduction, we moved back to focusing on 2D programming using Pygame.  I wasn't planning on going back to Blender for several months.  However, in the evening, my student mentioned that one of his friends from soccer was using Blender to model a 3D head for use in a 3D Java game he was developing.  My student's friend is a competitive 7th grader that loves talking about the virtues of Java compared to Python.  The friend quickly pointed out that although Panda3D wasn't a Java system, he was already working with 3D frameworks using the Java 3D classes.  Well, at least they have a common ground in Blender.

Tuesday, October 18, 2011

Panda3D - Framework for 3D Games


Panda3D is an open source framework with Python APIs.  Children can get a taste for 3D programming.

The framework was developed by the Carnegie Mellon Entertainment Technology Center and Disney.  However, the Carnegie Mellon group is doing most or all of the development and promotion now.

There's a nice tutorial in the manual.

This package is more oriented to game programming compared to vPython.

My middle school student went through the tutorial in about an hour.  The panda walks.

I like the mission of the Carnegie Mellon Entertainment Technology Center:

To foster leadership in education and research that combines technology and fine arts to create new processes, tools, and vision for storytelling and entertainment.

Tuesday, September 27, 2011

Visual Python


I've been working with my son to develop 3D objects with VPython.  It's super cool and really rewarding.

This is the entire program for the green cylinder above:

from visual import *
rod = cylinder(radius= 1)
rod.green = .9
rod.red = 0
rod.blue = 0
It will also work with just this:
from visual import *

cylinder()


Awesome set of videos on learning to use visual python.

The only tricky part was that the visual library only worked with 32 bit Python.  Since I'm on Mac OS X, Snow Leopard, I had a 64 bit version of Python 2.7 installed.  I'm using a 32 bit version of Python 3.1 on the Mac in order to run visual.

You can find out what the architecture is with this:

>>> import platform

>>> platform.architecture()

('32bit', '')

>>>