ssRay - my OWN path tracing program

Discuss stuff not about Indigo.
Severi
Posts: 4
Joined: Tue Aug 19, 2008 12:19 am
Contact:

ssRay - my OWN path tracing program

Post by Severi » Tue Aug 19, 2008 12:22 am

Hi all!

A short story about me. I've using POVRay since late 80's. This year I decided to learn some C++ and programmed a simple physics simulator. Yeah, it worked but was a bit boring. Then I read POVRay forums and noticed a few posts about path tracing (someone there made a patch to convert POVRay into path tracer). The images looked a lot better than anything normal POVRay can produce so I got interested.

The algorithm looked quite simple so I wanted to try if I can do it also. Then I started programming ssRay which you can find here:

http://www.saunalahti.fi/~sevesalm/ssRay/ssRay.php

It is still lacks some fundamental features but the images look promising - IMO!

Now I'm trying to figure out how to handle light sources. Now light sources are just objects with emission. I simply trace the ray and if it hits emitting object, it returns...well...light. I was thinking that you could "scan" lightsources separately at each bounce for direct lighting. The problem is I don't know how to sample them.

For example:
- I hit a diffuse surface.
- I have a cube light source which is partially visible.

How do I take a random point on that cube to check the actual lighting without affecting bias. I guess I simply cannot generate a random point on the surface of the cube. And how about spherical light source or a general unbiased method?

Yeah, then I have to program transformations (I suck at matrices) and acceleration structures. Then I'm partially happy. :lol:

But anyway, this is a fun project and images made with LuxRender and Indigo Renderer just motivates to continue.
Last edited by Severi on Fri Feb 13, 2009 12:21 pm, edited 1 time in total.

User avatar
pixie
Indigo 100
Posts: 2332
Joined: Sat Dec 29, 2007 4:54 am
Location: Away from paradise
3D Software: Cinema 4D
Contact:

Post by pixie » Tue Aug 19, 2008 2:53 am

:shock: :shock:

Neat!

User avatar
vmuriel
Posts: 17
Joined: Thu Apr 03, 2008 12:45 pm
Contact:

Post by vmuriel » Tue Aug 19, 2008 4:34 am

Nice man.

alex22
Posts: 171
Joined: Thu Apr 12, 2007 12:07 pm
Location: Germany

Post by alex22 » Tue Aug 19, 2008 6:40 am

Try using barycentric coordinates. If you have a triangle with points A, B and C, then you can define a point P on the surface as:
A*w+B*u+C*v=P
where w+u+v=1
So what you do is set two random numbers for two of the variables u,v or w and set the third variable so they all add up to 1. Then add them together as shown above to create P.
There might be faster ways, but it should work. Used it for my own Raytracer, but there for triangle intersection testing.

edit: Just thought about the random numbers. If it set for example u to 0.663 and v to 0.532 you'd have a problem because the sum is already above 1 and P won't be in the triangle area. So if you work with random numbers between 0 and 1 you should adjust the second random number so it can't be bigger than the first.
For example u:=randomnumber
v:=randomnumber*(1-u)
w:=1-(v+u)
Last edited by alex22 on Tue Aug 19, 2008 7:26 am, edited 2 times in total.

User avatar
matsta
Posts: 730
Joined: Mon Jan 29, 2007 7:50 am
Location: 127.0.0.1

Post by matsta » Tue Aug 19, 2008 7:08 am

Wow very nice! those look amazing! great job man!

greetz
mat

User avatar
lycium
Posts: 1216
Joined: Wed Sep 12, 2007 7:46 am
Location: Leipzig, Germany
Contact:

Post by lycium » Sat Aug 23, 2008 9:30 pm

you should consider posting on ompf instead of hijacking indigo's forum :/

User avatar
PureSpider
Posts: 1459
Joined: Tue Apr 08, 2008 9:37 am
Location: Karlsruhe, BW, Germany
Contact:

Post by PureSpider » Sat Aug 23, 2008 10:59 pm

This is the off-topic-area so calm down lol

Severi
Posts: 4
Joined: Tue Aug 19, 2008 12:19 am
Contact:

Post by Severi » Fri Sep 19, 2008 10:41 pm

Yeah, if off-topic isn't on-topic on off-topic, then what is?? :lol:

This is how I do it now on spherical light:

1. Choose a random point on the sphere. (Actually only on the surface that could be visible)
2. Take a radiance reading from that point if it is really visible.
3. Scale the value based on the ratio of solid angle of the visible sphere surface and hemisphere. This is the answer I was looking for.

The speedup after evaluating direct lighting was 20x-40x! So this was worth it.

The next thing is to make this work on other shapes besides spheres. The problem is that it is very difficult to sample a direction on a projected solid angle if the shape is something else than a sphere. But I think I could do this: bound every shape by a sphere and sample that instead. Some rays then miss the actual shape but that is not a big problem.

I hope I am on the right tracks here.

Severi
Posts: 4
Joined: Tue Aug 19, 2008 12:19 am
Contact:

Post by Severi » Sat Feb 21, 2009 11:55 pm

Some new images after I implemented kd-tree which is working quite well now.

A simple city with DOF:

Image

And the Stanford Dragon, in silver and in greenish glass:

Image

User avatar
PureSpider
Posts: 1459
Joined: Tue Apr 08, 2008 9:37 am
Location: Karlsruhe, BW, Germany
Contact:

Post by PureSpider » Sun Feb 22, 2009 12:11 am

Those images look amazing!
Keep it up!

neo0.
Posts: 1784
Joined: Thu Feb 28, 2008 7:11 am
Location: the US of A

Post by neo0. » Sun Feb 22, 2009 7:04 am

Are there any plans for a user interface?

User avatar
PureSpider
Posts: 1459
Joined: Tue Apr 08, 2008 9:37 am
Location: Karlsruhe, BW, Germany
Contact:

Post by PureSpider » Sun Feb 22, 2009 9:31 am

Did you even bother reading the site of the program?
http://www.saunalahti.fi/~sevesalm/ssRay/Features.php wrote:UI which lets the user select the rectangle area being rendered for faster preview

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Sun Feb 22, 2009 9:44 am

Pretty nice stuff :D Keep it up :)


OT: What happened to all the other raytracers, mentioned in the past here?
I mean from some you hear things from time to time/they actually got pretty famous, but most more or less............ disappeared...

Big Fan
Posts: 745
Joined: Tue Oct 17, 2006 9:37 am
Location: Nelson NZ

Post by Big Fan » Sun Feb 22, 2009 2:28 pm

almost like this one did ;)

neo0.
Posts: 1784
Joined: Thu Feb 28, 2008 7:11 am
Location: the US of A

Post by neo0. » Sun Feb 22, 2009 3:14 pm

UI which lets the user select the rectangle area being rendered for faster preview
OK. Um.. Yeah.. :roll: That doesn't say much. I meant a UI that can do things more than that.. Like all the things you would need to actually use the program.. Like object translations (move, scale, rotate, etc.) and materials.

Right now SSray looks to be a fantastic renderer, but it still obviously a front end, some way for the user to interact with it.

So I guess about now I should be chipping in with did you even bother to read my post? :wink:

Post Reply
16 posts

Who is online

Users browsing this forum: No registered users and 96 guests