Jump to content


* * * * * 1 votes

raycasting algorithm for 3D objects


11 replies to this topic

#1 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 16 March 2012 - 01:58 PM

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 :)

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 5305 posts
  • LocationBellevue, WA

Posted 16 March 2012 - 04:45 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 16 March 2012 - 05:10 PM

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

#4 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 17 March 2012 - 11:14 AM

View PostXcrypt, on 16 March 2012 - 01:58 PM, said:

However I'm not sure where to begin
Spheres :)

#5 Vilem Otte

    Valued Member

  • Members
  • PipPipPipPip
  • 345 posts

Posted 18 March 2012 - 12:39 AM

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 ;)
My blog about game development (and not just game development) - http://gameprogramme...y.blogspot.com/

If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D

#6 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 18 March 2012 - 01:21 PM

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?

#7 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 18 March 2012 - 04:01 PM

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.

#8 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 18 March 2012 - 05:36 PM

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

#9 Stainless

    Member

  • Members
  • PipPipPipPip
  • 577 posts
  • LocationSouthampton

Posted 18 March 2012 - 06:44 PM

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

#10 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 18 March 2012 - 08:14 PM

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 :)

#11 Mikey Lillowitz

    New Member

  • Members
  • Pip
  • 3 posts

Posted 16 April 2012 - 07:43 AM

Hi Xcrpy.

Can you elaborate a little further on your needs?

- Mikey

#12 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 23 April 2012 - 07:45 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users