Viewfactor Calculation in OptiX 7

Hello,
for my Bachelor’s Thesis I am tasked to expand a radiosity based Thermal-Tool for CubeSats and have it also cover specular reflections. OptiX seems like the easiest approach to implement reflections via Raytracing.
I have an engineering background and am fairly new to programming and have worked through the optix7samples.

My approach right now would be to simulate the sun as an parallelogram which emits parallel rays. How would I implement this kind of ray entry point in OptiX 7? Is this even the best way to simulate sun rays?

To determine the transferred heat my current plan is to track the total amount of cast rays and compare them to how often each primitive was hit.

I don’t quite understand how to set up a buffer (I guess i’ll need one).
How can I get a buffer the size of the quantity of my primitives and then have the closest_hit program add a hit to the corresponding entry in the puffer. Is this even how this works?

Also how can I access that information afterwards?

Thank you very much for help in advance, I hope my questions aren’t too trivial.

Hi martinwehr,

Your questions aren’t trivial, but we’ve got a lot of resources already setup to answer them. I recommend walking more slowly through the OptiX 7 SDK samples again and the OptiX documentation to see how to setup your entry points & buffers & such. Please let us know what specific stumbling blocks you hit.

A good sample to study for setting up a buffer, tracing rays, and then communicating the buffer to another kernel is optixRaycasting. If you want to get the buffer on the host (CPU), check out cudaMemcpy with the flag cudaMemcpyDeviceToHost. The entry point for tracing rays is the raygen program.

As for simulating the sun and tracing parallel rays, your idea sounds reasonable, but it depends on your engineering requirements. A parallelogram, of course, is only a rough approximation of the shape of the sun, so depending on your error tolerances, you might want to setup a mapping function so that you can emit parallel rays from a circular shape (for example: A Low Distortion Map Between Disk and Square, by Shirley & Chiu), or even use a more sophisticated spherical model of the sun. Using parallel rays is also an approximation that may or may not meet your needs.

Note it sounds to me like you are thinking about tracing rays starting from the light source. Keep in mind that most “ray tracing” and “path tracing” examples that we have and that you find online are emitting rays from the “camera” and then checking whether a random sample point on the light source is visible. Photons are most often simulated in reverse. You can do it either way, starting from the sun is a legitimate approach. Which is more efficient depends on what you need, I just wanted to call it out since if that wasn’t clear then a lot of examples might be a bit confusing.


David.