Python Renderer??

Could there be a python renderer, a rendering engine that uses python? I know that python can edit images… so it must be able to “theoretically” render an image if not as good as C or C++?

Sure you can! Python is just a language, and a rather expressive one, so you can write whatever you want in Python. You’ll just have issues with the performance.


Whoops, didn’t mean to write this one–ignore

I don’t know much about computer science… Would it be hard? That would be really cool.

You could write a render engine in python but there is a reason why no production renderer is using it (hint: it is slooooooooooooooooooow)

Maybe you could use Cython though.

It kind of depends on what you want to do with it.

If you just want to learn how raytracers work and you like python - go ahead and write one. Yes, it will probably be pretty slow, but the knowledge you gain won’t be any less valuable. It’s not even that complicated, you could probably fit one in one or two thousand lines. People have written raytracers in JavaScript. Python can’t possibly be worse than that. (Can it? Those modern browsers got pretty amazing JS compilers lately…)

If what you want is to actually render real things with it… well… Let me put it like this: It’s easy to write a basic raytracer. It’s really hard to make a production raytracer. Don’t do it. Use one of the existing ones.

Ok… I will take your word for it…

you can write a basic tracer in POV-Ray, it’s in the tutorial :slight_smile:

A little google-fu and there it is:

Heh. Really basic, but just 200 lines. Not bad :slight_smile:

Umm… I have been researching rendering and I think i have an idea to make it faster but maybe this has been done… What if the renderer figured out first where objects it would render were, then find the area they are in, (draw a convex hull around them??) then only trace rays in that area? That would a lot of the time reduce rays traced to 15 percent less if this hasn’t been done or could be done?

oh… is this binary space partitioning?

What about LOLTracer ? :slight_smile: (A path tracer written in LOLCODE.)

There’s also smallpt, consisting of 99 sloc of C++.

You’re (almost) describing a BVH. Except that a convex hull wouldn’t really cut down on render times very much because there would still be a complicated bounding area to check against. Using a simple bounding box is much faster to check against, and it then can be split up into even more volumes. But yeah… pretty much every renderer already does this.

I would rather use the term “tree structure” which a BVH is one implementation, one side of the story.

By the way, here’s a rendition of Cycles’ tree traversal: