Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  A simple real time ray tracing  (Read 2755 times)
0 Members and 1 Guest are viewing this topic.
Offline phu004

JGO Coder


Medals: 4
Projects: 9
Exp: 10 years


NoSuchPersonException


« Posted 2005-06-30 10:48:35 »

Despite its realistic, Ray tracing is not the leading technology  in the computer graphic field. The main disadvantage is the lack of speed which makes it impossible to generate real time graphic using current pc.  But without doubt it will all change when pc start to have enough power to handle ray traced graphic in a reasonable speed, everyone will use it because it simply can make the most realistic graphics!

The program below is a simulation of ray tracing technology,  but much more simpler. The only deflectable material is the floor in this case. And because  it is much simpler than a real ray tracing, your pc will be able to run it in real time.  Hit your arrow keys to change the view direction, and "w" to move forward, "s" ro move backward.

Chilc the link below to start the animation.

http://www.freewebs.com/phu004/run.html

here is a shot


the full source code (since i am not a English speaker, some of my comments can be massy or make no sense, hope you
guys dont mind)

http://www.freewebs.com/phu004/ray%20tracer%20demo.zip
Offline c_lilian

Senior Member


Projects: 1


Java games will probably rock someday...


« Reply #1 - Posted 2005-06-30 11:12:35 »

Hey I'm not alone ! Wink

Your algorithm won't scale well, you've avoided the complexity of raytracing by limiting the number of objects of the scene...  but it's a good start.

I wish you to find some nice tricks of optimization, to be able to draw a more complex scene...

here are some :
 - first pass rendering in opengl : one color for each primitive : avoids you the cost of finding the initial ray intersection, use standard GL speedups (bsp...)
 - skip pixels to find intersecting objects and go back when they change (works if your primitives are big enough)
 - limit field of view (don't scan primitives too far away)
 - space partitioning (divide space in cubes, affect primitives to one or more cubes, and have the ray walk through the cubes) : much much harder but some examples can be found on the web (i haven't published my version... which is far from perfect and unreadable)
 

I'll update bubbleracer one day with those two tricks (which are in another raytrace engine of mine).

Good luck !

Lilian

Offline phu004

JGO Coder


Medals: 4
Projects: 9
Exp: 10 years


NoSuchPersonException


« Reply #2 - Posted 2005-07-03 01:24:57 »

To Lilian,

The tricks you mentioned are definitely worth trying if one wants to make 100% ray tracing grapics. But the world is never perfect, i am thinking  the idea to combine the ray tracing algorithm with polygon modeling,  that is first sort all the polygons using a BSP tree,  then perform ray tracing on the pixels that belong to a polygon which is visiable to the camera and has special porperties (eg. transparent, deflectable ...).   In this way we can greatly reduce the number of rays.  In your bubble racer program, it will be faster just to trace the pixels bounded by the circles not the entire screen.  The shadow somehow is a problem since  we dont trace the  pixels from the ground any more,  but we still can make pretty realistic shadow using other methods.

I know the resultant graphic will be less impressive than the  real ray traced graphic,  but we will gain a lot more frame rate while still keep half
of ray tracing properties. I will consider this a big achievement.

I hope these make sense.

cheers!
Pages: [1]
  ignore  |  Print  
 
 

 
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!