raycasting algorithm for 3D objects

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Mar 16, 2012 at 13:58

Hi, I would like to write my own raycasting algorithm implementation with C++, for all types of 3D objects. However I’m not sure where to begin, on google there’s a lot of junk and I can’t seem to find anything of worth.

Can anyone point me in the right direction? Thanks :)

11 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Mar 16, 2012 at 16:45

Just to be clear, do you just want references for ray intersection tests for various shapes? Or are you doing a raytracer and want a full reference on it including acceleration structures, light/shading and the like?

For intersection tests: here’s a giant chart of references to intersection algorithms for various combinations of shapes.

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Mar 16, 2012 at 17:10

just the physics, although the raytracing stuff might come in handy too, for later :)
That link is very nice, thanks!

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Mar 17, 2012 at 11:14

@Xcrypt

However I’m not sure where to begin

Spheres :)

B20d81438814b6ba7da7ff8eb502d039
0
Vilem_Otte 117 Mar 18, 2012 at 00:39

Begin with spheres, AABBs (axis aligned bounding boxes) and triangles. Then read something on optimizing (BVHs, KDTrees and such hot stuff) … and when you’ve got this implemented, then it’s solid start ;)

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Mar 18, 2012 at 13:21

Seems like more game programmers do their physics themselves than I thought! Nice :D

I already did triangles and working on AABBs/OBBs/spheres atm, reading the book “real-time collision detection” :)

I’m planning to (try) make a full-scaled current-gen physics engine starting from next year, over a period of 5 years, while going for a computational physics/mathematics degree :)
Atm I just need some basics for a game project I’m working on, which is not so physics intensive.

Can’t wait ‘till then, I love physics!

Although I have always dreamed about making a physics engine, I’m a bit uncertain if this is productive…
Is there a future in this area, for game development?
Or would I have to direct myself to robotics?

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Mar 18, 2012 at 16:01

I was totally disillusioned after creating my first (and only) 2D physics engine. In theory things are beautiful. In practice, one needs a huge amount of hacks to get things (e.g. stacking) stable. It wasn’t fun.

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Mar 18, 2012 at 17:36

I’ll have to find that out for myself then ;)

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Mar 18, 2012 at 18:44

There are really good physics engines out there, both 2D and 3D.

If you want to write one for your own enlightenment, fair play to you. Loads of support and good wishes.

However we have no idea what the hardware will be like in 5 years time, XBOX will be dead, or replaced, same for PS3 I would imagine.

With the work I am doing, it’s entirely possible the games machine as we know it will not exist by then and your TV will be the centre of your audio visual universe.

So keep your techniques general, and don’t get caught up in “I can make the whole thing work really fast on a quad core fred bloggs processor as long as I have a TI994a Harrry Ramsden graphics card”

:D

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Mar 18, 2012 at 20:14

Thanks for the tips, but I didn’t mean to optimise specifically, it’s the physics & techniques that interest me :) (as well as generic optimisation, independent of hardware: eg: spatial partitioning)

Besides, one man making a physics engine who is totally new to the field can not compete to 50 experienced and well-respected men in the field, so it’s intent is not commercial, I’ll probably make it freeware. I just hope it would be a good thing for my portfolio :)

00000000000000000000000000000000
0
Anonymous Apr 16, 2012 at 07:43

Hi Xcrpy.

Can you elaborate a little further on your needs?

  • Mikey
A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Apr 23, 2012 at 19:45

The first answer given by Reedbeta pretty much gave me what I wanted :)