POV-Ray : Newsgroups : povray.programming : Python and POVRay Server Time
28 Jul 2024 14:29:38 EDT (-0400)
  Python and POVRay (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: Roberto Ferrer de Amorim
Subject: Python and POVRay
Date: 12 Mar 2001 10:31:37
Message: <3aacebd9$1@news.povray.org>
Hi all...

  I've been using POV-Ray for a couple years and I must say I've never
really liked the scene description language used by POV (being an OO-head).
I started a project to use class hierarchies in Java to describe objects in
POVRay, rendering that to the scene description language used by POV, then
rendering it. It would be very extensible, and yadayadayada.

  Right in the start I came to the shortcomings of the Java language for
such a project and judged it wasn't worth it.

  Until I found Python. (http://www.python.org/)

  So, I'm starting the project again implementing a full object-oriented
approach to POV using the Python language. A simple scene would be something
like

scene = Scene()
sphere = Sphere(
[0,0]
)
scene.Add(sphere)
scene.render()

  As Python is highly extensible and easily embedded, my goal is to
substitute completely the scene description language in POV by a Python
counterpart with advanced features like real physics, particle systems, key
systems (morph targets, texture keys, etc) and such.

  I'm posting here to know if somewhere else would be interested to help me
in this project. Right now I don't have any (functional) code, but the class
design is going well, and I may have something ready soon.

  Let me know if this interests any of you.

  Best regards,

  Roberto "Wolfox" Amorim


Post a reply to this message

From: Chris Huff
Subject: Re: Python and POVRay
Date: 12 Mar 2001 10:50:46
Message: <chrishuff-D2A07D.10464212032001@news.povray.org>
This isn't a new idea...look back in these newsgroups and you will see 
some long, heated discussions about it.

Anyway, it's already been done, sort of...VPython: 
http://cil.andrew.cmu.edu/projects/visual/
It's not specially made for POV, and doesn't do everything POV does, but 
you may find it interesting.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Roberto Ferrer de Amorim
Subject: Re: Python and POVRay
Date: 12 Mar 2001 12:04:53
Message: <3aad01b5@news.povray.org>
It's quite similar in some ways, but at a lower level than what I plan to
do. I can't really use its ideas because of its license, but I'll surely
take a look on it.

What I plan is something that allows me to do something like this:

scene = Scene()
sphere = Sphere([0,0])
path = LinearPath([[0,0,0,1], [1,1,1,20], [-2,-2,-2,60]])    # [x, y, z,
framenumber] - this is a comment
sphere.SetPath(path)

scene.render()

It would render a scene with 60 frames with the sphere going from 0,0,0 on
frame 1 to 1,1,1 on frame 20, and then to -2,-2,-2 in frame 60, and such.
You would be able to specify spline and math paths with ease, and adapt to
the frames with no problems.

Right after I finish the class design I'll start a draft explaning this
concepts and posting it here. I hope it helps.

One more thing... what do you think about this? You didn't say if you think
it's a good or bad idea.

Thanks...

> This isn't a new idea...look back in these newsgroups and you will see
> some long, heated discussions about it.
>
> Anyway, it's already been done, sort of...VPython:
> http://cil.andrew.cmu.edu/projects/visual/
> It's not specially made for POV, and doesn't do everything POV does, but
> you may find it interesting.


Post a reply to this message

From: Chris Huff
Subject: Re: Python and POVRay
Date: 12 Mar 2001 13:19:06
Message: <chrishuff-4AE738.13150112032001@news.povray.org>
In article <3aad01b5@news.povray.org>, "Roberto Ferrer de Amorim" 
<ram### [at] comdescontocombr> wrote:

> One more thing... what do you think about this? You didn't say if you 
> think it's a good or bad idea.

You don't want to know what I think of Python as a scene description 
language...
The basic idea isn't bad, I just don't like Python, and don't think it 
is the best choice for this. I think a language designed for the purpose 
of scene description would be better...with built-in support for 
vectors, colors, transformations, etc...and a more OO way of doing 
things. (Python still looks procedural to me...)
I've been working on the idea of a CSDL (C-like Scene Description 
Language) for a while now, I might start writing an interpreter soon. It 
would be a language loosely based on C (the loop and conditional syntax, 
{} blocks, semicolon statement endings, etc), but designed around the 
idea of manipulating objects (shapes) in a 3D environment. It would be a 
separate program that would take a CSDL file and output a .pov file (and 
possibly formats for other renderers), platform specific versions could 
automatically render the output file.
There wouldn't be any "classes", objects would inherit from other 
objects, and inheritance would be done by creating a modified copy of 
the parent object. There would be a base object, a "prototype" that all 
shapes and other objects would inherit from.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Roberto Ferrer de Amorim
Subject: Re: Python and POVRay
Date: 12 Mar 2001 14:16:59
Message: <3aad20ab$1@news.povray.org>
> You don't want to know what I think of Python as a scene description
> language...

Scrolling back I saw an "Object-Oriented language for POV" thread, and by
reading it, I know what you think of Python, yes. :-)

> The basic idea isn't bad, I just don't like Python, and don't think it
> is the best choice for this. I think a language designed for the purpose
> of scene description would be better...with built-in support for
> vectors, colors, transformations, etc...and a more OO way of doing
> things. (Python still looks procedural to me...)

Python combines the best things about OO, functional and procedural
programming without turning into a mess. I will not try to "convert" you,
but I can't find a better tool for the job than Python.

In a web application server called Zope, they designed ways to run Python
code on a sandbox and with little syntax differences. What do I mean by
that? I mean that it is possible to write a Python script like

def f(x):
x = 1 + 2
:end

for instance - no whitespace needed, and it could be converted easily to

def f(x):
  x = 1 + 2

before being parsed. That way you can use it as you use C (although I do
prefer the whitespace approach). That's not an issue.

I see Python as a great language for that job because:

- it can be highly OO - multiple inheritance is not a problem, and all data
structures are high-level
- it's easy to learn
- it can be easily extended and/or embedded.

Who knows, maybe when I get it done you'll actually like it. I hope so. :-)

> I've been working on the idea of a CSDL (C-like Scene Description
> Language) for a while now, I might start writing an interpreter soon. It
> would be a language loosely based on C (the loop and conditional syntax,
> {} blocks, semicolon statement endings, etc), but designed around the
> idea of manipulating objects (shapes) in a 3D environment. It would be a
> separate program that would take a CSDL file and output a .pov file (and
> possibly formats for other renderers), platform specific versions could
> automatically render the output file.
> There wouldn't be any "classes", objects would inherit from other
> objects, and inheritance would be done by creating a modified copy of
> the parent object. There would be a base object, a "prototype" that all
> shapes and other objects would inherit from.

If well designed, this CSDL can be great. However, I may be wrong, but I
think it can be way easier using Python. I'm using Python for all the new
projects on my job, and it fits great on most (if not all) programming needs
I have - and it's faster to develop with than Java, PHP, Perl and such (at
least for me).

As a last comment, some guy called Bruce Eckel feels the same as me about
Python. Check http://www.mindview.net/ and
http://www.mindview.net/Python/ThinkingInPython.html . Quoting from the
C++/Java ubermaster himself:

"Considering that Python is my language of choice for virtually all my own
programming projects, my research into the language is continuing apace."

Best regards,

Wolfox


Post a reply to this message

From: Alessandro Coppo
Subject: Re: Python and POVRay
Date: 12 Mar 2001 18:19:27
Message: <3aad597f@news.povray.org>
Oh dear!
I wrote a couple of months ago something very similar (in Java) as a front
end to POV but scrapped the project as I have decided to do the lot in C++
(because I am toying with the idea of writing a POV-compatible render engine
as Free Sofware Project...).

By the way, if anybody is really determined to work to this effect (I
consider Python GREAT for scripting tought I would prefer an hybrid
C++/CPython architecture), please e-mail me.

Alessandro Coppo
a.c### [at] iolit
www.geocities.com/alexcoppo/

P.S.: with the Java source I quickly got to the point of implementing a
significant subset of POV language. One has to create a scene which is a
collection of objects, lights and a camera and then one "writes" it,
emitting very basic POV code (no macros, defines etc., using POV just as a
rendering engine). Total development time: 2 weeks....


Post a reply to this message

From: Chris Huff
Subject: Re: Python and POVRay
Date: 17 Mar 2001 11:56:46
Message: <chrishuff-981BC1.11511517032001@news.povray.org>
In article <3aad20ab$1@news.povray.org>, "Roberto Ferrer de Amorim" 
<ram### [at] comdescontocombr> wrote:

> I see Python as a great language for that job because:
> - it can be highly OO - multiple inheritance is not a problem, and 
> all data structures are high-level - it's easy to learn - it can be 
> easily extended and/or embedded.

Are you sure multiple inheritance is a good thing? ;-)
I rather like Objective C, it is very easy to learn if you already know 
C, and highly flexible. It's a bit different if you are used to C++ or 
Java, though...


> If well designed, this CSDL can be great. However, I may be wrong, 
> but I think it can be way easier using Python. I'm using Python for 
> all the new projects on my job, and it fits great on most (if not 
> all) programming needs I have - and it's faster to develop with than 
> Java, PHP, Perl and such (at least for me).

Using Python to write the CSDL engine, or as the language itself?
The CSDL engine is going to be written in either C++ or Objective C...I 
would prefer Obj-C (for one thing, it would make creating a GUI for the 
Mac version much easier), but C++ may be better for cross-platform 
reasons (there is OpenStep available, though...so cross-platform use is 
possible). I will start off by creating a framework like the one you are 
making in Python...the CSDL interpreter will come later, but the 
framework may be useful by itself.
I'm also thinking that maybe this should be a "C-like Simulation 
Description Language", and not a POV-specific thing, just a language 
designed for manipulating 3D objects.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Python and POVRay
Date: 17 Mar 2001 14:19:45
Message: <3ab3b8d1$1@news.povray.org>
In article <chrishuff-981BC1.11511517032001@news.povray.org> , Chris 
Huff <chr### [at] maccom>  wrote:

> multiple inheritance is a good thing? ;-)

Yes, without question multiple inheritance is a good thing.  Of course,
one has to be sure when and how to use it.


     Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Geoff Wedig
Subject: Re: Python and POVRay
Date: 18 Mar 2001 08:18:28
Message: <3ab4b5a4@news.povray.org>
Chris Huff <chr### [at] maccom> wrote:

> Using Python to write the CSDL engine, or as the language itself?
> The CSDL engine is going to be written in either C++ or Objective C...I 
> would prefer Obj-C (for one thing, it would make creating a GUI for the 
> Mac version much easier), but C++ may be better for cross-platform 
> reasons (there is OpenStep available, though...so cross-platform use is 
> possible). I will start off by creating a framework like the one you are 
> making in Python...the CSDL interpreter will come later, but the 
> framework may be useful by itself.

Well, if cross platform GUIs are an interest, you might want to look at
wxPython or wxC++.  These make building GUIs that'll run under X and Windows
quite easy.  I understand there is a mac port underway, but as I don't use
them, I know little about it.

> I'm also thinking that maybe this should be a "C-like Simulation 
> Description Language", and not a POV-specific thing, just a language 
> designed for manipulating 3D objects.

If it exports to POV, that'd be fine.  However, the POV metaphor (solid
objects) and the metaphor of many graphics programs (meshes) may be
difficult to do in the same language easily.

Geoff


Post a reply to this message

From: Daniel Lin
Subject: Re: Python and POVRay
Date: 14 May 2001 21:57:10
Message: <3b008cf6@news.povray.org>
How far along is this CSDL thing?  This question is akin to seeing into the
future, but is CSDL a possibility for the scene description language for
POV-Ray 4.0?
(just wondering)

"Chris Huff" <chr### [at] maccom> wrote in message
news:chrishuff-4AE738.13150112032001@news.povray.org...
> I've been working on the idea of a CSDL (C-like Scene Description
> Language) for a while now, I might start writing an interpreter soon. It
> would be a language loosely based on C (the loop and conditional syntax,
> {} blocks, semicolon statement endings, etc), but designed around the
> idea of manipulating objects (shapes) in a 3D environment. It would be a
> separate program that would take a CSDL file and output a .pov file (and
> possibly formats for other renderers), platform specific versions could
> automatically render the output file.
> There wouldn't be any "classes", objects would inherit from other
> objects, and inheritance would be done by creating a modified copy of
> the parent object. There would be a base object, a "prototype" that all
> shapes and other objects would inherit from.
>
> --
> Christopher James Huff
> Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
> TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
>
> <><


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.