[Haskell-cafe] Scene description/construction

Andrew Coppin andrewcoppin at btinternet.com
Mon Mar 30 15:38:12 EDT 2009


John Van Enk wrote:
> > Declarative 3D scene construction? ;-)
>  
> +1
> On Mon, Mar 30, 2009 at 3:16 PM, Andrew Coppin 
> <andrewcoppin at btinternet.com <mailto:andrewcoppin at btinternet.com>> wrote:
>
>     Sebastiaan Visser wrote:
>
>         Lennart, what is the next language DSL you are going to build?
>         Prolog? XSLT?
>
>
>     Declarative 3D scene construction? ;-)
>
>     (What? I can wish, can't I?)
>

I was going to write an email about this anyway, so...

POV-Ray already has a very nice scene description language:

http://www.haskell.org/haskellwiki/POV-Ray_SDL_project

Originally it was just for *describing* scenes. However, it slowly 
mutated and became a Turing-complete scene *construction* language. 
Unfortunately, it does this using macro-style textual substitution, so 
it's slow as hell, and maddening to debug.

Obviously Haskell is a far superior _programming language_. No need to 
elaborate further on that. It simply remains to come up with a good set 
of abstractions and a convinient syntax for a scene description DSL and 
you're golden.

(The question then becomes, "what do you do with this description?" 
Obvious answers include pretty printing it as POV-Ray SDL or writing 
your own ray tracer and feeding it to that.)

Initially I was focusing on taking POV-Ray's existing SDL and simply 
removing the macros and putting in something more elegant (i.e., 
Haskell). But now I'm thinking it might be better to design an entire 
new language from scratch instead. POV-Ray's SDL has a few limitations:

- Messy stuff that exists only for backwards compatibility.
- Each primitive can be described in only one way. (E.g., a cylinder can 
only be described by a radius and two endpoints. Not by, say, a center 
point, a length, and a diammeter.) There is no particular reason for 
such a limitation to exist.
- There is no support for "inspecting" things which have already been 
constructed. E.g., you can't take an existing object, remove its 
texturing and replace it. You can only add another texture layer on top.
- Given a powerful language like Haskell, you could go crazy and start 
trying to do parametric moddelling, physical simulations, etc.

So there you have it. A typical hobby project: tonnes of ideas, few 
concrete design plans.



More information about the Haskell-Cafe mailing list