Newton Raytracer - Now Interactive!

Share with us how are you using the powerrrr of the force

Moderator: Alain

Newton Raytracer - Now Interactive!

Postby agi_shi » Fri Nov 21, 2008 6:49 pm

Edit:
Now I've made an interactive version:

<snip, I've got reports of a blue screen, going to reupload when I fix it>

I'd love to see how this runs on one of those quad-cores. For my dual-core X2 3800+, 256x256 runs pretty nicely (for a ray tracer) with 4 threads and 2 levels of reflection, and 24 balls.

Old:
Image
Image
~10 seconds for each render. Only 1 thread, uses NewtonWorldRayCast. 512x512. Seems to artifact a bit on the ground box :|

After about 1.5 days of messing around, basically. The hardest and most annoying part is setting up the camera projection stuff correctly, after that it's easy. Newton makes things damn easy and fast.
Last edited by agi_shi on Sun Dec 07, 2008 12:46 pm, edited 4 times in total.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby agi_shi » Fri Nov 21, 2008 6:58 pm

Added shadows:
Image
~15 seconds to render. Max of 50 reflection iterations, 512x512 renderer, 1 shadow ray per lit point.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby agi_shi » Fri Nov 21, 2008 7:14 pm

3 lights, shadows, 50 iteration reflections, 250 spheres of 2 radius:
Image
~50 seconds
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby agi_shi » Fri Nov 21, 2008 8:15 pm

Extremely high-quality 4096x4096 (rescaled to 1024x1024 for web-hosting) shot:
Image
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby agi_shi » Fri Nov 21, 2008 9:45 pm

Some ambient occlusion:
Image
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby vectrex » Fri Nov 21, 2008 11:08 pm

:shock: What a delightfully crazy thing to do with newton :mrgreen:
vectrex
 
Posts: 21
Joined: Sat Oct 01, 2005 10:15 am
Location: Australia

Re: Newton Raytracer

Postby agi_shi » Fri Nov 21, 2008 11:12 pm

Here's a 4096x4096 (scaled again) render that took a few hours (single-threaded):
Image
Loads of reflections and shadows. 500 spheres and 1 box for the ground.

Is it safe to call NewtonWorldRayCast() from several threads? Would speed up the thing linearly...
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby Julio Jerez » Sat Nov 22, 2008 9:59 am

Oh darn, :mrgreen:
Hey Agi in what lever are you in school know, you are making the guru that write paper look like idiots.
A few year ago the people that did this stuff where writing paper, and books, now you can do it by simple using a physic engine and your intelligence.
If I did not see those images I would not believe it.
This is using a general purpose ray cast function, this is tell me that if the function is optimized for rendering, plus the using the newer GPU or multicourse CPUs, a ray trace is perfectly possible and probably much more superior to raster graphics.


agi_shi wrote:Here's a 4096x4096 (scaled again) render that took a few hours (single-threaded):
Loads of reflections and shadows. 500 spheres and 1 box for the ground.

Is it safe to call NewtonWorldRayCast() from several threads? Would speed up the thing linearly...

Yes all of the collision and reay cast funstion can be call for separate threads. they are all re entrant in 2.0
what SDK do you have now?

Hey I have an idea how about exposing the multithreading function of the engine,
Something like

NewtonSumitTask (Newton, TaskCallback, Data)
NetwonSinck (Newton)


You use it like this:
devided the job into batches of more of lest equal load. For example if you have a dual core you have two threads, the you assign use the upper haft of the image to one thread and the lower half to the other

Code: Select all
For (I  = 0; I < thread count; I ++) {
NewtonSumitTask (Newton, TaskCallback, &Data[I] )
}
NetwonSinck (Newton)

It should reduce the time to haft more of less, with more cores it is even better.
Would you like to try that?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton Raytracer

Postby agi_shi » Sat Nov 22, 2008 10:56 am

:D

I'm using the beta17 SDK. I made a little demo if you or anyone else wants to try it out:
mirror0: http://www.MegaShare.com/532597
mirror1: http://cheapfilehost.com/file.php?file= ... 23d741a175
The _corona version uses the corona image library to generate an offline image, the _sdl version uses SDL to display contents as they are calculated - it randomizes the pixel positions to look like it's being 'fast' even though it's no faster than the left-to-right or top-to-bottom alternative :D. It takes about 30 seconds to generate on my X2 4800+. It's hardcoded to 512x512, 500 spheres, 1 big cube as the ground, and a maximum of 100 reflection iterations (each reflection can have more reflections and shadows).

Your idea of exposing the multi-threaded 'tasks' is really intriguing, I'd love to try it out :D
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby Julio Jerez » Sat Nov 22, 2008 11:14 am

It take 43 secund to make the image in my quad 660 2.4 ghz
I will add the inteface for threading, stand by
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton Raytracer

Postby agi_shi » Sat Nov 22, 2008 11:24 am

Hm, then mine must've been much over 30 seconds :lol:. Then again, there's lots of shadowing and reflections, and 501 objects, and it only uses one thread, so it's not too bad. If we get this multi-threading working out the way we plan, you should be able to get the same scene for 10 seconds :shock:
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby agi_shi » Sat Nov 22, 2008 2:20 pm

Added some multithreading, I saw a 50% speed increase :D (only 2 cores here) Soon a demo will be up.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby agi_shi » Sat Nov 22, 2008 3:04 pm

Done, here's the multi-threaded version: http://www.MegaShare.com/532685

Just run, enter width, height, and number of threads (separated by spaces), like "512 512 4", and hit enter :D (keep the size a square for now, it has some yet unsolved issues with perspective when not rendering a square).

Please tell me your results :D, I'm very interested. Here it takes 22 seconds for a 512x512 with 1 thread, and 12 seconds for 512x512 with 2 threads. Results will obviously not be identical due to use of rand(), but they should be consistent (reflective spheres, no odd artifacts).
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby agi_shi » Sat Nov 22, 2008 6:17 pm

If it complains about a missing mingw DLL (probably because I used the compiled Boost.Thread library), this is it: http://www.megashare.com/532733
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton Raytracer

Postby Julio Jerez » Sat Nov 22, 2008 6:22 pm

wow here
512 x 512 x 1 take 22 secund
512 x 512 x 4 take 6 secunds :shock:

I tryed for fun a 512 x 512 x 8 and it takes only 4 secunds, even i fth copu is a quad core.
man I woder how will i takes in my 8 cores mac pro, by I removes windows from it.

when i try 512 x 512 x 32 it is also 4 secunds. bu can you imagin tha code running on cuda with 128 cores?

whio many level of recursion do you implement?
can you make a one level recursion to see how fast can be?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 12 guests

cron