I am fond of creating graphics and animations using the frameworks on the iOS platform; lately, I discovered that, in order to create better visual designs, those higher-level of frameworks do not provide enough controls to satisfy the needs of creating more advanced-level designs. Hence, I decided to invest my time in studying OpenGL ES.

Whilst doing so, I came across the ray-tracing topic; I have spent quite a bit of time studying the mathematics and topics related to it. And, I have been able to render simple stationary objects (geometrically) using this technique.

In order to learn deeper, I started to toy around with the idea of allowing these objects to have movements based upon user-interactions (I.e., when the user moves the object on the screen with her finger, the corresponding object will spin around or simply move to the respective location based upon the user's touch (on mobile device)).

According to what I have studied thus far on ray-tracing, however, this operation of allowing the objects to move based on user-interactions could be very costly in ray-tracing. To me, for example, it would mean that, if a rendered sphere were to spin around based on user's touch on the screen, I would need to ray-trace the whole sphere for every frames as the sphere spins.

Is my understanding correct here?

My question is, is it possible to perform ray-tracing on objects that are movable; if so, is there another ray-tracing technique specialized especially for this purpose, which could be less costly? Or, is ray-tracing more suitable for rendering only architectural objects, which are usually stationary?

Thank you.

  • \$\begingroup\$ Moving or rotating an object unfortunately means that you have to render it again from the new point of view. If your rendering is ray-tracing-based, that can indeed be a performance penalty. I don't know of any technique to avoid this. \$\endgroup\$
    – Quentin
    Aug 11, 2016 at 7:53
  • 1
    \$\begingroup\$ You mean, like this: youtube.com/watch?v=2ow7cbtzg1E ? \$\endgroup\$
    – Mars
    Aug 11, 2016 at 8:46
  • \$\begingroup\$ @Mars Wow; simply amazing. Besides being real-time, reflection, refraction and depth of field are all brought into play. Would you know how they accomplish this? Is there a field (or fields) I should look at? I would like to learn more. Thanks. \$\endgroup\$
    – Unheilig
    Aug 11, 2016 at 18:55
  • \$\begingroup\$ Have no idea. Could be just raytracing with optimizations: max ray bounces, max ray distance without intersection, using some space partitioning like octree, etc. And then they could have Quadro-grade card so it could be real-time. Never tried it myself, so I have no resources on this topic. Just google the topic and try to make it better and better. \$\endgroup\$
    – Mars
    Aug 11, 2016 at 21:31

1 Answer 1


Ray tracing is great for many uses and very interesting but it is a very computationally heavy process. Most of the time when you move an object you are going to have to retrace it, but this is not always the case. If you are not changing the perspective or the camera or the orientation of the object and it's not in shadow then you could keep the already traced version as a display.

Alternatively, you could have a fallback method of rendering for when you are moving the object around if this is not an extremely dynamic scene. For example if it's an adventure game then moving objects around does not usually happen that often so you could fall back onto standard rendering. Then your ray tracing could be done offline ie in a multi-frame process instead of making your whole rendering wait. Then once it's ready you could pop the finished render into the scene.

I did something similar in a project a while back to create icons for a drag and drop inventory and it worked like a charm.

  • \$\begingroup\$ I have yet looked at methods such as offline rendering or multi-frame process, because all these are still very new to me. I will see if I could find a book/online tutorial regarding the aforementioned methods (I haven't been successful googling one for the past hours). I understand that for objects that do not need to reveal their back side based on user's touch such as a plane, re-tracing might not be necessary (as you kindly pointed out; we'd just need to transform the objects). But as for a sphere, whose backside would be revealed as it spins, doing retrace is needed, unfortunately. \$\endgroup\$
    – Unheilig
    Aug 11, 2016 at 19:11
  • \$\begingroup\$ If I am off with my understanding in the above comment, feel free to correct me. In addition, is the project that you mentioned a toy project, which you could perhaps share? If not as a whole, even a slimmed-down version containing the thus far mentioned techniques would be very helpful, because by going through it line by line, I could educate myself better. Thanks. \$\endgroup\$
    – Unheilig
    Aug 11, 2016 at 19:17
  • \$\begingroup\$ For a spinning ball you could just default to regular rendering until it stops moving. I can't easily share that code because it's a huge project and not in a working state, and it's integrated to a not free engine as well. But in opengl you should be able to ray trace into a frame buffer offline. It's pretty much either something like that or just give up on ray tracing. Or give up on having things able to move. If there is tons of movement though then ray tracing is probably not the way to go anyhow, don't torture yourself. But I agree it is very nice and I'd love to see more if it. \$\endgroup\$
    – Yudrist
    Aug 12, 2016 at 8:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .