Xah's Edu Corner: Introduction to 3D Graphics Programing

X

Xah Lee

Of Interest:

Introduction to 3D Graphics Programing
http://xahlee.org/3d/index.html

Currently, this introduction introduces you to the graphics format of
Mathematica, and two Java Applet utilities that allows you to view them
with live rotation in a web browser. Also, it includes a introductory
tutorial to POV-Ray.

Once you understand any one of these pages, you can use your favorite
programing language to start doing 3D Graphics Programing.

In the coming months, i will also introduce the .obj format that are
used by many geometric modeling programs. And, a tutorial on how to use
Python (or Perl, lisp) to do 3D Graphics programing, by setting up
functions that spits out any of 3D-Geometry Formats (such as
Mathematica Graphics or POV-Ray or .inc).

These are the imminent plans for the coming weeks. Other potential
subjects are introduction or tutorials on various utilities or
programing lang libraries that does conversion between different 3D
graphics formats, dedicated tutorial on how to generate mathematical
surfaces, more elaborate study on POV-Ray's abilities and sample cases,
etc.

The focus of these pages, will be 3D-Graphics programing with the goal
of Algorithmic Mathematical Art.
(see
http://xahlee.org/Periodic_dosage_dir/t1/20040113_cmaci_larcu.html )

In particular, we focus on creating geometric objects and their
arrangement that are esthetic in a mathematical way. (for example,
regular tilings in 3D, nested structures in 3D, symmetric structures in
3D, elaborate 3D maze tunnels, beehive sculpting, regular polyhedrons
and their decorations, projection and slices of higher dimensional
symmetries, 3D-manifolds ... etc.) This mathematical esthetic is
opposed to, for example, rendering techniques or technologies (e.g.
fogs, sceneries, fast algorithms...etc) that are quite common in
computer graphics literatures.

Xah
(e-mail address removed)
∑ http://xahlee.org/
 
J

Jon Harrop

Xah said:
Introduction to 3D Graphics Programing
http://xahlee.org/3d/index.html

You will probably find it more rewarding to use a more modern graphics
system, such as OpenGL or DirectX, with a suitable programming language
rather than Mathematica's. I would recommend any of OCaml, F#, Haskell,
Lisp, Scheme, Python or Ruby for graphics, you can do much more
sophisticated, animated, real time visualisations than you can with
Mathematica's primitives.

There are lots of great web pages out there. I've written some 2D and 3D
graphics examples in OCaml:

http://www.ffconsultancy.com/products/ocaml_for_scientists/visualisation
http://www.ffconsultancy.com/free/ray_tracer
http://www.ffconsultancy.com/free/fractal
http://www.ffconsultancy.com/free/maze

and more recently F#:

http://www.ffconsultancy.com/dotnet/fsharp

I was very impressed with the tutorial videos on VPython at ShowMeDo:

http://showmedo.com/videos/series?name=pythonThompsonVPythonSeries

For an introduction to OpenGL, look no further than the NeHe tutorials at
GameDev:

http://nehe.gamedev.net

One of our future products at FF Consultancy is a suite of extensions for
the F# interactive mode that allows you to visualise 2D and 3D graphics in
real time with simplicity rivalling Mathematica but the sophistication and
performance of DirectX, whilst also having the power of the F# programming
language and .NET to analyse your data.
 
J

Jürgen Exner

Boris said:
to which of comp.lang.perl.misc, comp.lang.python, comp.lang.lisp,
comp.lang.java.programmer, comp.lang.functional ?

You must be new. Otherwise you would be familiar with this troll already.

jue
 
X

Xah Lee

Dear Jon Harrop,

Thanks for the informative reply.

I don't know OpenGL, but i think it is a low-level crap, and have done
the industry huge irreparable damage the same way unix has.

This wikipedia excerpt from
http://en.wikipedia.org/wiki/QuickDraw_3D
summarize my sentiment:

«Most 3D toolkits concentrate on the lowest levels of the 3D rendering
pipeline...

For instance, the OpenGL system consists primarily of a system for
describing geometry in various ways...

Higher-level concepts of the 3D world are generally not included in
low-level libraries...

To add to the problems, OpenGL was not truly low-level..
»

Note this:

«
TODAY THERE REMAINS NO STANDARD HIGH-LEVEL API FOR 3D GRAPHICS. Several
attempts have been made, including OpenGL++ and the SGI/Microsoft
Fahrenheit graphics API, but none of these have made it to production.
»

----------

As a practical example of its low-level problem, i looked at your basic
OpenGL tutorial, the minimal program
(http://www.ffconsultancy.com/products/ocaml_for_scientists/visualisation/):

let () =
let argv' = Glut.init Sys.argv in
ignore (Glut.createWindow ~title:"OpenGL Demo");
GlClear.color (0.1, 0.3, 0.1);
Glut.displayFunc ~cb:(fun () -> GlClear.clear [ `color ]; Gl.flush
());
Glut.mainLoop ()

Immediately, a extremely intelligent alien who understand advanced
programing and geometry in 3D and higher dimensions, but who is not
familiar with OpenGL per se, would be facing 6 lines, almost all of it
are irrelevant to geometry or the mathematics of programing,
but are extraneous concepts created by the system itself . (the
exceptions are the “colorâ€, and “clearâ€)

This is in contrast to the Mathematica system or its graphics. For
example:
http://xahlee.org/3d/mma.html e.g.

Graphics3D[{
Cuboid[{0, 0, 0}],
Point[{1.5, 1.5,0}],
Polygon[{{2, 2, 1}, {2, 1, 1}, {1, 2, 1}}]
}]

Even if you don't know nothing about Mathematica or never coded a
single line of 3d graphics application, the lines above are all very
meaningful, as they are inalienable concepts of geometry, not something
extraneous as most imperative languages or systems or unix forces upon
its users.

------------

Note that the above sentiment about OpenGL, is just my sentiment on the
overall situation of graphics programing. (and in general the low-level
garbage situation applies to almost all imperative languages and vast
majority of protocols in the industry.) I don't particular know OpenGL
as a low-level graphic system is a good one or not. (but it is probably
correct to assume that Microsoft's Direct3D is far more better designed
system at the same level)

------------

Regarding VisualPython... i saw a demo in 2002 by a professor
friend. I think it is good. Though, why is its licensing not GPL or
otherwise Open Source? That's kinda odd since Pyhton is.

Thanks for your links and tutorials. I find them useful.

----

What i'm looking for, is a system that allows one to easily to graphics
programing. By graphics programing, i mean 3d geometric shapes
manipulation, as opposed to rendering or implementing CAD systems or
how to write photoshop filters or the science of realistic rendering
etc as most people are thinking of when hearing the term computer
graphics programing.

So far as i know, Mathematica is the platform that allows one to do
graphics programing. But, i think Flash probably is another platform
that does it. And i think VisualPython is also.

I'm interested in other platforms that allows one to do this.

Xah
(e-mail address removed)
∑ http://xahlee.org/
 
R

Raff

Xah said:
Dear Jon Harrop,

Thanks for the informative reply.

I don't know OpenGL, but i think it is a low-level crap, and have done
the industry huge irreparable damage the same way unix has.

OpenGL is low level, that's right, but it is not crap. OpenGL is
hardware independent, and is a true multiplatform standard. The
difference between OpenGL and higher level libraries, like OpenInventor,
it is similar to the difference between a low-level programming language
like C and a higher level object-oriented language, IMHO.
I don't particular know OpenGL
as a low-level graphic system is a good one or not. (but it is probably
correct to assume that Microsoft's Direct3D is far more better designed
system at the same level)

Direct3D it is lower level than OpenGL, and usually needs more
instructions than OpenGL to do the same things.
 
R

Ravi Teja

Xah said:
Regarding VisualPython... i saw a demo in 2002 by a professor
friend. I think it is good. Though, why is its licensing not GPL or
otherwise Open Source? That's kinda odd since Pyhton is.

You are confusing VPython with Activestate's Visual Python IDE plugin
for Visual Studio.
From VPython's home page in very bold font - "VPython is free and
open-source"
http://www.vpython.org/
 
K

Keith Keller

["Followup-To:" header set, but it's best not to followup at all.]

Xah Lee wrote:

OpenGL is low level, that's right, but it is not crap.

Whether it is or not, Xah doesn't know and doesn't care, as he is
a troll (and anyone who would say "I don't know X but it's crap" is
definitely either clueless or trolling). Please don't pay attention
to his rants.

--keith
 
J

John Ersatznom

Xah said:
Dear Jon Harrop,

Thanks for the informative reply.

I don't know OpenGL, but i think it is a low-level crap, and have done
the industry huge irreparable damage the same way unix has.

Like it or not, OpenGL is the only free-as-in-speech alternative we have
to MS's Direct3D (and I'm not sure what covers the same bases as MS's
other DirectFoos -- DirectInput, DirectSound, DirectCrash, DirectReboot,
DirectErrMsg, and the like...not that we really need free
implementations of the latter three undocumented ones that most modern
games use from time to time).

Incidentally, something about the post I'm replying to is incompatible
with something about the news server I'm using. The following mysterious
and problematic things happened, despite my not making any mistakes:

* I hit "reply" in news software.
* I trim unneeded quoted material.
* I put my original text in, below the quoted material.
* I hit "send".
* It incorrectly fails (I do the exact things listed above often and it
always worked before). It claims there's a header missing, "followup
to". A header that either should be there automatically without my doing
anything special or should not be required, one or both.
* I notice that for some unclear reason there are extra newsgroup
entries, though I don't recall deciding to crosspost my reply. I remove
all but comp.lang.java.programmer, since that's the group I'm actually
reading and replying in, and hit send again.
* It complains again, this time about the posting being a duplicate.
Either it's wrong, or the first posting actually succeeded and the other
error message was *doubly* wrong, both by claiming my submission had
something wrong with it (when I did exactly what I normally do, and it's
something that normally succeeds) *and* that it hadn't succeeded.

Anyone have any idea what's going on here? Here's hoping that this one
works. It *should* have worked the first time -- type response and hit
"post" always *used* to work, and I don't see why suddenly at eight AM
on December 29 2006 that should suddenly change and some more
complicated procedure become required...
 
A

ajsiegel

Xah said:
Here's their license:
http://www.vpython.org/webdoc/visual/license.txt

I read it wrong before.
Thanks for correction.

This is superb! I'll be looking into vpython!

Xah

Of course it does what it does by resort to OpenGL and C++, so is part
of the problem ;)

I am looking forward to your tutorial efforts, and hoping those efforts
can be accessed without exposure to too much polemics. Though if that
is the price of admission, that is the price of admission.

BTW, VPython is most of the way through a 4.xxx release which provides
some nice additional functionality to the 3.xx series core - like
transparency and texturing. Problem being the the lead developer has
graduated and moved on, and the NSF funding that had supported the
effort has run out.

And the core folks around the project are either science educators or
Python folks - there is little C++ expertise currently involved with
the project.

The project is looking for help.

Anyone willing to jump in should perhaps reply here or at:


(e-mail address removed)

Art
 
H

hg

Xah said:
I don't know OpenGL, but i think it is a low-level crap, and have done
the industry huge irreparable damage the same way unix has.

So you _are_ psychic ! is the end of the world be in 2007 ?
 
J

John Ersatznom

And the core folks around the project are either science educators or
Python folks - there is little C++ expertise currently involved with
the project.

The project is looking for help.

Anyone willing to jump in should perhaps reply here or at:
[snip address]

I see lots of mentions of C++ and Python, but not Java, so suggesting
that anyone reply "here" (i.e. comp.lang.java.programmer) seems
questionable to me.

And what the hell is wrong with my goddam newsserver? Again it
complained that a header was missing (which either should have been
there to start with or not been an error) and then when I added it that
the message was a duplicate (it was a duplicate only if the previous try
had succeeded, but it claimed the previous try had failed).

I'm thinking of ditching aioe. Anyone know of any other public, free
newsservers that permit posting as well as reading? A whole lot of Web
research has failed to turn up any besides aioe. Mind you, I found a lot
of high quality free ones that permit reading only (some with binaries!
not that I need 'em) and at least one that calls itself "free" and says
it permits posting but actually charges an "account setup fee" -- where
are truth in advertising laws when you need them? "Free" doesn't mean
"No monthly payments" or "No recurring payments", it means FREE, as in
NO PAYMENTS AT ALL, MORONS ... :p
 
X

Xah Lee

Xah Lee wrote in 2006-12-22:
Of Interest:

Introduction to 3D Graphics Programing
http://xahlee.org/3d/index.html

Folks, i have expanded my tutorial to several pages in the past nearly
two months, and thank you very much for those who have given
encouragement.

I had plans to write pages that actually contained Python or Perl and
elisp code to demonstrate the mingled use of common languages with
POV-RAY and other tools for doing algorithmic mathematical art...

However, i'm posting now for one in-credible discovery that amazed me,
and believe it is a revolutionary both with respect to technology, as
well as its social impact.

Following is my brief introduction. The web version is at:
Introduction to Second Life
http://xahlee.org/sl/sl.html

-------

Introduction to Second Life

Xah Lee, 2007-01-09

above: A screenshot of a location in Second Life.

This place is called “The Futureâ€, it is a place built by Henry
Segerman ↗ built.

Second Life is a online virtual world with 2 million accounts as of
2006-12, and reportedly 10 thousand users logged in at any moment.
Basically, you operate a software that is a 3D world much like 3D
games, but everything in the “game†is built by users, and you can
interact with other users, including buying and selling virtual land
with real money. What people do inside Second Life is entirely up to
them (as in real life). And, as it happens, what people do mostly in
Second Life are pretty much what people do in real life. The major
activities are: sex, shopping, socializing, dancing.

My mathematician friend Henry Segerman introduced me to 2nd life. (also
because it appeared in Time Mag in 2006-12.) Henry has a 2nd life page
that contains many math objects made in Second Life:
http://www.stanford.edu/~segerman/2ndlife.html.

Part of my interest in Second Life is to build geometric models. (See
Introduction to 3D Graphics Programing) I have for the past couple
years sought for a software platform/system where i can build 3D
objects, with abilities to do interactive adjustment (such as moving a
slide to change a surface's parameter), dynamic rotation (viewing from
different angles), animations (such as morphing that shows geometric
processes), and most of all, walk-thru in it as if it is a building.

As far as my experiences goes, no software platform for 3D graphics are
close to the ideal of what i need to do. They lack one feature or the
other, or otherwise requires the programer to be a specialist with
years of dedication in learning the tool. For example, Mathematica↗
has great collection of math functions but no dynamic graphics.
POV-RAY↗ and 3D-modelers like AutoCAD↗ can do great in building 3D
objects but they are not designed for interactivity, animations, or
walk-thru. Java the programming language↗ allows one to write applets
that does rotation and interactive manipulation but programing in Java
is extremely unnecessarily complex and yet it is still not possible to
do walk-thrus. The one class of platform that does all these, is 3D
game engines. But alas, they take a dedicated game programing
specialist to be able to use it. Second Life changed all this.

(Note: Just for completness, my requirement for a 3D-graphics
programing software system is this: • easy to use for average
programers or scientists. • Easy to build geometry models, such as
basic shapes like spheres and blocks, as well as surfaces or meshes of
triangles. • designed for interactivity. That is, the programer can
easily build buttons and sliders that changes parameters and have the
object reflect these changes visually right away. • the user can
easily change viewing angles or rotate the object. • The programer
can easily do animations. For example, morph a sphere into a cube, or a
bunch of spheres flying in space as a swarm of flies. • The ability
to do walk-thru (or fly-thru). For example, if i build a fancy 3D-maze
or architecture, i should be able to — say — become a ant, and walk
inside the object, so as to view the object from inside and as well as
getting the real experience of perceiving such a building. (Before my
discover of Second Life, the platform that i was considering nearly
ideal and preparing to learn, are VPython↗ and Macromedia Flash↗ (i
do still plan to learn these technologies) ))

Second Life is not just the answer to my mathematical fantasies, but
because of its Real-World nature, being run and build by real people,
and with scarily real money market of the virtual dollars it uses, is
nothing but a technological revolution with great social impact. It is
essentially the virtual-3D-world-wide-web dream of VRML↗ envisioned
around 1995.

Anshe Chung↗ is famouly known for being the first to become a (real
world) millionaire by selling entirely virtual items and virtual
services inside Second Life.

For a encyclopedic introduction, see: Second Life↗

Here are some articles about Second Life. (note that there are a lot
linked at the bottom of the Wikipedia article.)

* Time Mag: “My So-Called Second Lifeâ€, By Joel Stein,
20061216.↗
* businessWeek online: INSIDE INNOVATION — IN SIDE. Second Life
Lessons. By Reena Jana and Aili McConnon. 2006-11-27.↗

2007-01-21, Addendum

Recently i heard of Entropia Universe↗. I haven't taken a closer look
but i think it is a competitor to Second Life.

Note that Second Life may not be and is probably not the first virtual
world. And, when virtual world like Second Life becomes household
activity as the internet is today, it will probably not be known as
Second Life or run by one single company, but diverse companies with
servers all over the world, where there is a unified virtual world all
the world's people can be in. (This situation may be likened to the
internet circa 1995. Or, perhaps also similar when telephone was in its
pioneering days.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top