POV-Ray : Newsgroups : povray.off-topic : kd-trees rule! : Re: kd-trees rule! Server Time
6 Sep 2024 05:14:38 EDT (-0400)
  Re: kd-trees rule!  
From: Severi Salminen
Date: 13 Feb 2009 03:22:14
Message: <49952db6@news.povray.org>
scott wrote:

> Wow that's really cool that you have done this all yourself so quickly,
> at this rate you'll be ahead of POV in a few months :-)

:D Well, maybe not :) POV has a totally different approach to ray
tracing problem so it is hard to compare. With path tracing it is SOOOO
much easier to get many light related phenomena correct. With POV the
devs had to work hard to get the desired result as many phenomena are
separately implemented. With ssRay I don't have to shoot photons
separately to get caustics, I don't have to implement radiosity to get
global illumination and all related indirect effects etc. I get them for
free. Who doesn't like that :)

> I guess the goal here is to have the minimum number of steps down the
> kd-tree on average over all rays.  My very naive instinct is that you
> should split the nodes so there are equal numbers of triangles on each
> side, but that's probably wrong if you don't take into account the size
> of each triangle.

That is intuitively a good solution but in reality it is a bad one :D
Actually you want to cut off big empty regions early. That makes tracing
and traversing the tree cheap. If you take "object median" as the split
point you get two expensive child nodes. That usually is not a good idea.

But there are some very good documents and books about kd-tree creation
so I don't have to re-invent the wheel completely.

Basically you assign a certain cost for ray-object intersection test.
And certain cost for traversing an interior node of the kd-tree. Then
you figure out all the possible splitting plane points (in all 3
directions) and use the cost model to minimize the kd-tree cost. The key
here is to use the surface area of a node to get a probability that a
random ray would actually go through that node.

There is also another very interesting acceleration structure called
BIH: bounding interval hierarchy. It looks quite simple and still very
efficient. I'll stick to ke-tree for now but will definitely try BIH at
some point.

> Yes if you have the time it can produce beautiful results, I have been
> using MCPov almost exclusively recently for renders, I hope that
> path-tracing can make it into official POV at some point.

I hope that too! Fidos has shown that POV can be turned to path tracer.
And POV has a very strong SDL and other infrastructure so it would be
nice to have alternative rendering engine for it.

I still think that most POV users prefer the most realistic outcome of
the renderings. And unbiased is the best way to go if that is the main
goal. I hope the devs will consider that with POV4.

> 1) Multi-threaded, this can't be harder than running multiple instances
> at once, but does it already utilise all cores or how hard will it be to
> implement that?

Yes, ssRay is already multithreaded and scales very well - basically
perfectly. I have 2 cores running at ~100% and ssRay handles as many
threads as the user wants. Now I assign different pixel rows for each
thread. That is actually a good approach. I don't need mutexes and the
load is still quite well balanced in almost all scenes.


> 2) How do you describe the scenes at the moment, are they all hard coded
> or do you have some scripting system already?

Hardcoded at the present. At some point I have to implement a parser but
that is not a fun thing to do and developing a good SDL takes time...


Post a reply to this message

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