NVIDIA / OptiX_Apps

Advanced Samples for the NVIDIA OptiX 7 Ray Tracing SDK
Other
273 stars 48 forks source link

more realistic shadow render #7

Closed ypwang61 closed 2 years ago

ypwang61 commented 2 years ago

Hello, thanks to your optix7course and Optix_Apps's guiding, I can try some simple but cool examples, but if I want to render scenes with
glass and hope to get realistic shadow, maybe I need to consider more about the absorbtion since to distanct travelling in the glass and the Fresnel Effect? Which part of code maybe needed to change for this? Thanks a lot for your help. The following is the shadow picture from rtigo3 image

droettger commented 2 years ago

maybe I need to consider more about the absorbtion since to distanct travelling in the glass and the Fresnel Effect?

Both are already implemented. Search the source code for "Fresnel" and "absorption".

Read this code which implements the glass material: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/rtigo3/shaders/bxdf_specular.cu#L94

Returning the traveled distance happens here: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/rtigo3/shaders/closesthit.cu#L165

The calculation for absorption in homogeneous volumes happens here: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/rtigo3/shaders/raygeneration.cu#L91

The intro_* examples show that with the two nested cube and sphere objects which use a blue water and a green glass material. The necessary parameters to control either are exposed inside the GUI.