Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Paul Kahler, posted on October 21, 2001




Image Description, by Paul Kahler



This image is a screenshot from our game "rtChess".

The rt stands for Ray Traced. I'd been working on a fast "real time" ray tracing engine for some time when I realized you can't make an engine in a vacuum. I needed a real project to find the holes. That's when I recruited Ray Kelm to help with the project. Great choice, he tracked down the most significant bug in my RT code and made substantial contributions to the game.

Try rtChess at:
http://www.newimage.com/~rhk/rtchess/

The engine itself uses an axially aligned octree for spatial partitioning. This regular structure allows rapid insertion and deletion of objects, and I've got an amazingly fast algorithm to fire rays through it, but the released game uses a less optimized version to support older CPUs. I've run as many as 8M triangles in a scene at a couple FPS on an Athlon 700. I could have done more but I ran out of RAM. The chess pieces are mostly CSG quadrics except the high triangle-count knight. There is support for proceedural textures, but they are not used in the game (yet). When you grab and rotate the board it renders at a reduced quality (interpolation between rays) and then gets progressively better after the motion stops. When a piece is moved, the 2 areas of interest are rendered at high quality - sort of a dirty rectangle scheme. I'm waiting for a good performance increase from AMD and then I hope to make some insanely complex outdoor scenes to run around in. In the meantime, Ray asked if I want to do an OpenGL game he started toying with.

OK, so it's not time for ray traced FPS games, but board games are possible with some tricks.

G'day
Paul


[prev]
Image of the Day Gallery
www.flipcode.com

[next]

 
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Manuel Astudillo

October 21, 2001, 06:41 PM

Hi,

nice picture. It looks really good, but I just wonder do the objects have self shadows? it looks like they dont. but maybe its just me.

greets,


Sarwaz.

 
Sami Hamlaoui

October 21, 2001, 06:49 PM

looks like ray-tracing is in season on the IOTD :)

pretty cool screenshot. i'm downloading the demo now.


Manual: they do. look at the white piece in the far left row with the + on top (i'll be damned if i know what the actual pieces look like. is it a queen? a king?) and you'll see a shadow being casted south by the + onto the main part of the piece.

Sami

 
wogotus

October 21, 2001, 06:51 PM

They do seem to self-shadow, why not? The white king seems to shadow it's own upperhalf if you look closely.

 
Nathaniel

October 21, 2001, 08:28 PM

I'm actually getting the shadows confused with the reflections =)

Aside that, cool chess game, DL'ing it now.

 
goltrpoat

October 21, 2001, 08:39 PM

Any chance of improving the chess engine? :) The RTRT engine rocks, but the chess engine.. well.. I played it a couple of times, and it feels like someone put a Ferrari bodykit on a VW Beetle :)

-goltrpoat

 
EGreg

October 21, 2001, 09:00 PM

You might think about having it hook up with some chess dlls floating around on the internet. For checkers, at least, I know that there's some kind of standard dll interface. For chess, I don't know, although I'm a big fan of chess. Anyone want to play? :-)

Cheers,
Greg

PS: If you want to play check out www.chessclub.com

 
Joshua Schpok

October 21, 2001, 09:53 PM

Well, at least it's not terrain.

 
iNsaNEiVaN

October 21, 2001, 10:14 PM

Its hardly realtime on my P500 voodoo3 :) looks awesome though.

I can see ray-tracing as being the far-future standard, so getting into it now might be a good idea.

Good work!

 
lycium

October 21, 2001, 11:20 PM

really awesome stuff, the speed is really amazing (for the level of detail you're achieving). you should implement vectorised intersection via sse (2x2 ray bundles), that should give you a really nice speed increase (even though you seem to be developing for athlons).

this makes me reconsider using grids instead of bounding volume hierarchies as a subdivision scheme...

 
lycium

October 21, 2001, 11:27 PM

i wholeheartedly concur.

 
lycium

October 21, 2001, 11:36 PM

incidentally if my first name were ray, i'd seriously contemplate changing my surname to "trace" :)

 
Mattman

October 22, 2001, 12:24 AM

nt = no text

 
z66831

October 22, 2001, 01:21 AM

From the rtChess webpage:

"Update 2001-10-21 Please be patient, we're being "flipcoded" :) The pages may take longer to load, as this site runs off a 64K ISDN link, and so many hits-per-minute are taking their toll. It won't break under the load, but it will go slow."

ROFL! FlipCode, you have arrived. ^_^

-z

 
z66831

October 22, 2001, 01:22 AM

One of the I.T. guys at work's first name is Trace. It's his given name. T'would be cool if it were R. Trace Xxxxxxx. ^_^

-z

 
Rasmus Christian Kaae

October 22, 2001, 03:00 AM

How about getting the binaries hosted on ftp.flipcode.com? downloading at 1kbps is really annoying ;-)

 
Brebion flavien

October 22, 2001, 03:56 AM

That's really nice, but on a side note, i think it's very possible to achieve the same quality at 100+ fps, using 3d hardware acceleration. Not as interesting as doing a raytracer though :)

F. Brebion

 
Jerran

October 22, 2001, 04:05 AM

Well, I guess 3D accelerated chess was not the point, but to envelope more realistic way of showing virtual reality on screen. And I guess realtime raytracing is somewhat most best way in point of quality to do that (maybe in somewhere near in future)

Can't say the chess were very fast on my 466MHz Mobile Celeron with 192MB, but it surely was quite neat looking and I'm trigger happy with RTRT's coming more popular. Then it's more about how much your computer than calculate than how new (and expensive) 3D-accel you got.

 
=[Scarab]=

October 22, 2001, 04:50 AM

Cool! Too bad I don't really play chess. Any chance you'll be doing raytraced checkers? Wouldn't look half as cool though. :

 
Yan

October 22, 2001, 05:00 AM

I see a lot of selfshadows. look at the smaller "farmer" (from german: Bauer) pieces.

greetings

 
David Olsson

October 22, 2001, 11:51 AM

Just tried it out. Beat the game on my first attempt.

 
David Olsson

October 22, 2001, 11:55 AM

Just found out that one could set a higher difficulty. I used the default, just 2, no wonder it was that easy.

 
fluffy

October 22, 2001, 02:43 PM

Brebion: With reflections at 100fps, yes. With full shadows, no. 10fps if you're lucky and have a very nice card with fillrate to spare (and with fast stencil operations) and a geometry representation which allows you to generate minimal, non-redundant shadowvolumes.

Trust me on this.

 
John Hoffman

October 22, 2001, 05:50 PM

If your very nice card is one of the new geforce3 titaniums, you have hardware shadow buffers. =)

http://www.nvidia.com/view.asp?IO=feature_shadowbuffers

-John

 
phk

October 22, 2001, 10:16 PM

Several replies...

1) Thanks for the positive feedback.
2) Difficulty. Press the space bar to call up the menu and switch to higher level. It's slower, but it plays somewhat better.
3) Making the pieces reflect is just a matter of setting the "reflectivity" to something other than 0.0. It takes a small performance hit, and I need to limit stack depth (crashes with just the right ray). I don't think you always need to do things just because you can - it didn't look good. We've talked about glass pieces but haven't tried it.
4) SSE. The majority of time is spent traversing the octree. Object intersection tests are minimal with good partitioning. I may want to try some SSE when I upgrade. BTW, it's got a lot of OOP in places where it doesn't take a penalty for it.
5) As for hardware... Reflective Curved surfaces... and if that doesn't choke it, make a Million of them. RT will win every time.
6) Some piece of software used an old return address when I posted the IOTD. My correct address is phkahler@worldnet.att.net

Thanks,
Paul

 
fluffy

October 23, 2001, 12:41 AM

Shadow maps, you mean? If I'm not mistaken, those are even worse than stencil shadows in terms of fillrate (since you have to render the scene from every light's perspective as well), bus speed (for copying all the stuff around), and portability (since you can't do it on anything other than an nVidia card). You do get the advantage of soft shadows, though. But IMNSHO, shadow maps look like ass.

 
fluffy

October 23, 2001, 01:10 AM

Hey phk... here's an idea I just had for speeding up the object intersections a bit.

First of all, you don't really need an octree, since the environment is a regular 8x8 grid.

Anyway, as far as the intersection goes, why not do a traditional tagged-polygon render for the camera rays? i.e. use a software rasterizer to draw the entire scene into a buffer where instead of storing the color, store a pointer to the object in question. After you've done this, then just do the raytracing with the knowledge that you've already got pixel-perfect casts for the first bounce. I did some rudimentary experiments on that when I was first starting to code my research engine, and it was fairly easy to get it fast. Then your bottleneck would just be on the reflection bounce, and since the primary reflection is off of the board, you can cheat and precalculate the reflected rays' intersections in a similar way. Then you'd only have to do a full raytrace for the shadows.

 
Moby Disk

October 23, 2001, 01:05 PM

How is the environment an 8x8 grid? At some level, yes, it is an 8x8 chess board. But are we assuming that the pieces are not tall and cannot overlap another square? Or that the pieces cannot span squares when moving?

 
John Hoffman

October 24, 2001, 08:30 PM

Yeah.. it's an implementation of shadow mapping, minus aliasing. nVidia's whitepaper on their shadow buffer is pretty interesting. It looks great to me. The shadowing in most xbox games (if not gf3 ti's) is sweet and obviously very fast. =)

-John

 
DynaByte

October 25, 2001, 11:18 PM

Of course they self-shadow... It's RAY TRACING, hello!?

 
This thread contains 29 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.