|
|
|
02-24-2009, 10:31 PM
|
#1
|
Human being with feelings
Join Date: Sep 2007
Location: trondheim, norway
Posts: 375
|
realtime raytracer
realtime raytracing
very non-optimized version
burns cpu cycles!!
on my machine it's smooth at 150*150, but starts to get choppy around 200*200.
animated gif, lo-fi colors (realtime dithered to 256 colors):
the code is ugly at times, haven't prettified it, or structured it properly. lots of short-hands and hacks, single one-directional light (like the sun), diffuse lighting (no specular), one level of reflection only (no recursion in js), the eye/camera and fov (field of view) is a bit messed up. i might do some refactoring/cleanup, etc...
and, i would be grateful for any ideas about optimizations!
http://sites.google.com/site/jesucce.../gfx_raytracer
all of a sudden the triggers stopped working, they're supposed to start ('1') and stop ('0') the animation, or do single-frame rendering ('2'). but you can also change the anim time manually with the 'theta' slider
- ccernn
Last edited by cern.th.skei; 02-24-2009 at 10:51 PM.
Reason: animated gif ddn't work ?
|
|
|
02-25-2009, 09:29 AM
|
#2
|
Human being with feelings
Join Date: Jun 2006
Posts: 1,167
|
this is awesome! i'm surprised it takes such little code to do this and renders as fast as it does
|
|
|
02-25-2009, 09:58 AM
|
#3
|
Human being with feelings
Join Date: May 2006
Posts: 2,373
|
Nice!
Now make a raytracing reverb .
|
|
|
02-25-2009, 10:12 AM
|
#4
|
Human being with feelings
Join Date: Feb 2008
Posts: 1,467
|
Quote:
Originally Posted by LOSER
Nice!
Now make a raytracing reverb .
|
Or better... A radiosity reverb!
|
|
|
02-25-2009, 10:42 AM
|
#5
|
Human being with feelings
Join Date: Apr 2008
Posts: 510
|
the gfx_setpixel() has no mercy on my cpu. :O
i would suggest more primitive spheres if you are planning to make the fx with real time animation.
take a look at senocular's planets demo:
http://www.senocular.com/flash/source.php?id=0.54
a sphere constructed from lots of rectangles (gfx_rectto())
may be lot faster and not bad looking either - stylized
it can still has primitive shadows and reflections.
|
|
|
02-25-2009, 02:36 PM
|
#6
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,746
|
cool, for speed you could try tweaking it to render random rays, and make them blobs rather than pixels (so you get motion blur and weird quality)
edit: I couldn't help myself, here's a faster, cartoony mod:
https://stash.reaper.fm/oldsb/122780/...racer_cartoony
Last edited by Justin; 02-25-2009 at 02:57 PM.
|
|
|
02-25-2009, 02:59 PM
|
#7
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,746
|
Quote:
Originally Posted by liteon
the gfx_setpixel() has no mercy on my cpu. :O
i would suggest more primitive spheres if you are planning to make the fx with real time animation.
take a look at senocular's planets demo:
http://www.senocular.com/flash/source.php?id=0.54
a sphere constructed from lots of rectangles (gfx_rectto())
may be lot faster and not bad looking either - stylized
it can still has primitive shadows and reflections.
|
I dont think gfx_setpixel is responsible for the slownesss -- it's doing a lot of math per pixel (notice the reflections and shadows)..
|
|
|
02-25-2009, 03:58 PM
|
#8
|
Human being with feelings
Join Date: Jun 2006
Posts: 1,167
|
so, does this mean we'll soon see a JSDoom? Would be neat to somehow tie the music or midi to in-game graphics or control.
|
|
|
02-25-2009, 04:38 PM
|
#9
|
Human being with feelings
Join Date: Oct 2007
Location: A-town, Australia
Posts: 633
|
I think I may have to cancel my forum account so someone else can use my username. You've earnt it.
|
|
|
02-25-2009, 04:54 PM
|
#10
|
Human being with feelings
Join Date: Sep 2007
Location: trondheim, norway
Posts: 375
|
Quote:
Originally Posted by LOSER
Nice!
Now make a raytracing reverb .
|
Quote:
Originally Posted by DerMetzgermeister
Or better... A radiosity reverb!
|
hm, there could be some ideas worth looking at there...
- ccernn
|
|
|
02-25-2009, 04:57 PM
|
#11
|
Human being with feelings
Join Date: Sep 2007
Location: trondheim, norway
Posts: 375
|
Quote:
Originally Posted by Justin
|
cool!
i might borrow some ideas from this..
- ccernn
|
|
|
02-25-2009, 05:50 PM
|
#12
|
Human being with feelings
Join Date: Mar 2008
Location: Atlanta, GA
Posts: 1,057
|
FYI, this is all insanely cool from a layman. I have done a bit of POV ray tracer, and to see what you have done with JS is nothing more than amazing.
__________________
Comp Specs: WIN XPSP3, Q6600, ASUSP5K, 3 GB PC6400 RAM, Focusrite Saffire, AlphaTrack, lots of plugins and hardware.
|
|
|
02-25-2009, 07:01 PM
|
#13
|
Human being with feelings
Join Date: Mar 2008
Location: Sydney, Australia
Posts: 3,955
|
that's *obscene*
well done!
|
|
|
02-25-2009, 08:21 PM
|
#14
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,572
|
forgive my ignorance but what exactly does this do?
|
|
|
02-25-2009, 09:29 PM
|
#15
|
Human being with feelings
Join Date: Apr 2008
Posts: 510
|
Quote:
Originally Posted by Justin
I dont think gfx_setpixel is responsible for the slownesss -- it's doing a lot of math per pixel (notice the reflections and shadows)..
|
ah, yes thats what i ment in a way. lots of calculations per pixel.
reduced 'resolution' with gfx_rectto (4x4px, 8x8px rectangles) instead of per pixel action, would do great as a solution.
i can see ccern has a 'lowres' voxel landscape prototype posted in the other thread which uses rectangles in the same fashion.
|
|
|
02-26-2009, 04:24 AM
|
#16
|
Human being with feelings
Join Date: Sep 2007
Location: trondheim, norway
Posts: 375
|
Quote:
Originally Posted by Jason Brian Merrill
forgive my ignorance but what exactly does this do?
|
http://en.wikipedia.org/wiki/Ray_tracing_(graphics)
as it is now, it's quite useless. i mainly did it to see how JS handled lots of math, and also trying to stretch the boundaries of js coding, stepping a bit outside of what reaper/js is supposed to (be able to) do.
it could be used as a benchmark of some sort, except that there's no proper indication of cpu use or anything.
and, with something as cpu intensitive as this, i can experiment with js optimizations, trying out various tiny coding details and see their efficiency and performance.
last, when getting a better grip on the details (and hopefully a few small additions to the js language), we could start doing some more useful graphics plugins for VJ-ing and/or video things, realtime controllable via audio, midi, or whatnot.
- ccernn
|
|
|
02-26-2009, 04:40 AM
|
#17
|
Human being with feelings
Join Date: Oct 2008
Posts: 157
|
how much interactivity is possible, for instance, could you write a game where hitting a certain frequency pops the floating balls?
|
|
|
02-26-2009, 04:40 AM
|
#18
|
Human being with feelings
Join Date: Sep 2007
Location: trondheim, norway
Posts: 375
|
Quote:
Originally Posted by liteon
ah, yes thats what i ment in a way. lots of calculations per pixel.
reduced 'resolution' with gfx_rectto (4x4px, 8x8px rectangles) instead of per pixel action, would do great as a solution.
i can see ccern has a 'lowres' voxel landscape prototype posted in the other thread which uses rectangles in the same fashion.
|
i have been testing a bit with some adaptive subdivisions.. initially rendering for example 16*16 blocks, and if any of the corners differ (normal, color, texture u/v, ..) more than some defined threshold, subdivide the square, and continue, until we reach another minimum-size threshold (or down to 1 pixel).
polygons, or interpolated squares would help a lot here, so that we don't have to do this 'manually' with loops/setpixel.. perhaps some tricks with gfx_blitext and creative use of parts of gradient bitmaps.
but, i would like to look into algorithmic optimizations first, before doing code-based tweaking. easier to test new features, check if this or that algo is better/worse than another, and for not losing overview of the spaghetti code in there
- ccernn
and, i have (partially working) a better version of the voxel land too, with interpolation, both when reading from the height/color maps, and when rendering those vertical bars, in addition to some caching and min/max-y-drawn-so-far. update coming soon here too.
|
|
|
02-26-2009, 04:48 AM
|
#19
|
Human being with feelings
Join Date: Sep 2007
Location: trondheim, norway
Posts: 375
|
Quote:
Originally Posted by ichijou
how much interactivity is possible, for instance, could you write a game where hitting a certain frequency pops the floating balls?
|
everything is possible, if you have enough cpu cycles available. time (and motivation) will tell how far we can take this...
since it's all calculated, every parameter and value in there can be changed on the fly. we could do lots of weird things.. modify objects (size, color, etc) based on audio, distort the camera direction/rays, adding/removing objects, ... imagination is the main limit.
one thing i hoped for when making/posting this, was to inspire others to continue in their own directions, or take what they wanted and making somethng else, or come up with exciting new ideas. there's lots of possibilities!
|
|
|
02-26-2009, 09:58 AM
|
#20
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
You're all barking mad! Love it!
|
|
|
02-26-2009, 09:50 PM
|
#21
|
Human being with feelings
Join Date: Apr 2008
Posts: 510
|
Quote:
Originally Posted by cern.th.skei
but, i would like to look into algorithmic optimizations first, before doing code-based tweaking. easier to test new features, check if this or that algo is better/worse than another, and for not losing overview of the spaghetti code in there
|
i like the subdivisions idea.
the algorithm in its current state is quite heavy for realtime. 'compression' in one way or another will be required
btw that 'code extraction' or 'loop unroll' or whatever, will not reduce the cycles much for the gfx thread. i did some test the other day
Quote:
Originally Posted by IXix
You're all barking mad! Love it!
|
wolfenstein 3d & tetris are on the way for js (shocker) -
well its fun - some games in the daw.
blah...all that mixing and recording. xD
|
|
|
02-28-2009, 07:52 PM
|
#22
|
Human being with feelings
Join Date: Sep 2007
Location: trondheim, norway
Posts: 375
|
recoded the raytracer. it's not really realtime anymore. (yet?). but, now it handles recursive rays, has multiple light sources, a material system, and specular highlights. next out is the refractions, more object types (planes, cubes,..), and then i can start cleaning up, and optimizing.
- ccernn
|
|
|
02-28-2009, 08:36 PM
|
#23
|
Human being with feelings
Join Date: May 2006
Posts: 2,373
|
Quote:
Originally Posted by cern.th.skei
recoded the raytracer. it's not really realtime anymore. (yet?). but, now it handles recursive rays, has multiple light sources, a material system, and specular highlights. next out is the refractions, more object types (planes, cubes,..), and then i can start cleaning up, and optimizing.
- ccernn
|
Holy! That looks sweet.
|
|
|
03-02-2009, 01:14 PM
|
#24
|
Human being with feelings
Join Date: Sep 2007
Location: trondheim, norway
Posts: 375
|
new
new screenshot, things looking a bit more 'correct' now.
|
|
|
03-02-2009, 01:31 PM
|
#25
|
Human being with feelings
Join Date: Mar 2008
Location: Newcastle, WA
Posts: 70
|
This is amazing!
|
|
|
03-04-2009, 01:49 AM
|
#26
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
|
Cool!!
|
|
|
03-04-2009, 10:08 AM
|
#27
|
Human being with feelings
Join Date: Mar 2008
Location: Atlanta, GA
Posts: 1,057
|
Sweet!!! Maybe someday I can stop using POVRay and just use JS!
__________________
Comp Specs: WIN XPSP3, Q6600, ASUSP5K, 3 GB PC6400 RAM, Focusrite Saffire, AlphaTrack, lots of plugins and hardware.
|
|
|
03-05-2009, 03:22 PM
|
#28
|
-blänk-
Join Date: Jun 2008
Posts: 11,359
|
Unbelievable what you mad scientists come up with...
Quote:
Originally Posted by ichijou
how much interactivity is possible, for instance, could you write a game where hitting a certain frequency pops the floating balls?
|
Love the edutainment idea of this.
I could also imagine to play a good game of Pong with a mate and two guitars... and raytraced rackets
|
|
|
03-06-2009, 08:33 PM
|
#29
|
Human being with feelings
Join Date: Dec 2008
Posts: 189
|
How can I hook this up with ReaMote and Blender? I've been having trouble getting a reliable render farm set up, but ReaMote works fine on my system
|
|
|
03-07-2009, 03:21 AM
|
#30
|
Human being with feelings
Join Date: Apr 2008
Posts: 510
|
Quote:
Originally Posted by zildjohn01
How can I hook this up with ReaMote and Blender? I've been having trouble getting a reliable render farm set up, but ReaMote works fine on my system
|
Have you tried http://www.drqueue.org/cwebsite/?
What you are asking for here is a bit complicated since this JS fx should be made into a complete renderer with full geometry, texturing, complex lighting support and particle systems etc. While - image exporting, .blender file format support, python scripting..etc etc are added to the JS engine. ReaMote should be then optimized for rendering tasks and Blender. And Blender must add support for JS (as a renderer) and ReaMote (as a farm). :-) something like that...
Last edited by liteon; 03-07-2009 at 08:18 AM.
|
|
|
11-30-2011, 12:57 PM
|
#31
|
Human being with feelings
Join Date: Jun 2006
Posts: 1,167
|
With the Doom 3 source now released, it would be cool to see a port in JS... you up for the challenge?
|
|
|
11-30-2011, 01:33 PM
|
#32
|
Human being with feelings
Join Date: Oct 2006
Location: Greece
Posts: 3,554
|
Where's the teapot? I want a teapot...
|
|
|
10-24-2020, 03:44 AM
|
#33
|
Human being with feelings
Join Date: Jan 2020
Posts: 60
|
I decided to take the blob version of this and turn it into a visualizer. You have to hook the new sliders up to things from the audio statistics JS effect, but at least it is now capable of responding to audio input. It would be cool if this could be made into a video processor preset but I am not qualified to do that much.
|
|
|
10-24-2020, 10:33 AM
|
#34
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Video Processor works under completely different paradigms and is missing functions like setpixel.
So porting it would be challening.
|
|
|
11-07-2020, 12:48 AM
|
#35
|
Human being with feelings
Join Date: Sep 2015
Location: Paris
Posts: 544
|
Can I import my 80 million poly models in it already ? looooooooool No but seriously, awesome awesome fascinating initiative.
|
|
|
10-08-2023, 06:23 AM
|
#36
|
Human being with feelings
Join Date: Mar 2015
Location: India Mumbai
Posts: 816
|
Quote:
Originally Posted by cern.th.skei
realtime raytracing
very non-optimized version
burns cpu cycles!!
on my machine it's smooth at 150*150, but starts to get choppy around 200*200.
animated gif, lo-fi colors (realtime dithered to 256 colors):
the code is ugly at times, haven't prettified it, or structured it properly. lots of short-hands and hacks, single one-directional light (like the sun), diffuse lighting (no specular), one level of reflection only (no recursion in js), the eye/camera and fov (field of view) is a bit messed up. i might do some refactoring/cleanup, etc...
and, i would be grateful for any ideas about optimizations!
http://sites.google.com/site/jesucce.../gfx_raytracer
all of a sudden the triggers stopped working, they're supposed to start ('1') and stop ('0') the animation, or do single-frame rendering ('2'). but you can also change the anim time manually with the 'theta' slider
- ccernn
|
This post was so ahead of its times ! i guess now that reaper is also working as a Video NLE , this should be implored !
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 09:00 PM.
|