Some questions about OptiX+GGX

I am studying OptiX, with a goal of rendering GGX surface in real-time. There is a slides here [url]http://on-demand.gputechconf.com/gtc/2016/presentation/s6244-roettger-optix-mdl.pdf[/url], which provides me with many useful information. But unlike a textbook, it only gives me a high level idea of OptiX. What matter are details, so I have some questions about OptiX+GGX to ask here:

  1. Is MDL SDK the only way to work with OptiX to render a GGX material? Is it possible to work completely within OptiX to render a GGX surface (I have know the technical details of GGX) without MDL?
  2. can I achieve real-time rendering for OptiX+GGX (1024x768 resolution, say) on a consumer-level Kepler graphics card? If not, what is the minimum graphics card required?
  3. Is there any sample codes of real-time OptiX+GGX available for download?

Thanks a lot.

That presentation is way too advanced for an OptiX beginner and was from before the MDL SDK was open-sourced on
[url]https://github.com/NVIDIA/MDL-SDK[/url].
Means I wrote the whole MDL-capable renderer from scratch including all BSDFs like GGX.

1.) OptiX is a general purpose high-level ray casting SDK and you can implement any rendering algorithm and material system you want.

2.) Depends on your light transport algorithm.
The problem with glossy surfaces in a ray tracer is that the reflections of objects around that material are fuzzy, so it’s not possible to capture that with a single reflection ray.
For real-time usage your ray budget is currently still very small and lots of advanced filtering methods need to be applied to get a smooth glossy reflection then.
Follow the links on this page for more examples, esp. the GameWorks technology video: [url]https://developer.nvidia.com/rtx/raytracing[/url]
Then watch the “Ray Tracing with Low Sample Counts with NVIDIA’s Ray Tracing Denoisers” presentations here: [url]http://on-demand-gtc.gputechconf.com/gtc-quicklink/eCWqVGT[/url]

I would not expect that a Kepler board is able to do that (if you say real-time is 24 fps). There are already four newer GPU generations and actual hardware ray-tracing support in Turing.

3.) I’m not aware of any public OptiX example implementing the GGX microfacet distribution, but that is not too difficult in a path tracer if you have the necessary formulas describing that, see paper below.

For a simpler quick-start with OptiX please watch the OptiX Introduction presentation and work through the example code.
Links here: [url]https://devtalk.nvidia.com/default/topic/998546/optix/optix-advanced-samples-on-github/[/url]

At example number 07 you have everything you need to add more BSDF implementations like GGX.
That renderer’s core architecture is a simplified version of my MDL-capable renderer.

Means if you have the sampling and evaluation functions from the usual papers (e.g. “Microfacet Models for Refraction through Rough Surfaces” from Walter, Marschner, Li, Torrance) you just need to implement two additional functions following the code in
[url]https://github.com/nvpro-samples/optix_advanced_samples/blob/master/src/optixIntroduction/optixIntro_07/shaders/bsdf_diffuse_reflection.cu[/url]
and add a new enum in
[url]https://github.com/nvpro-samples/optix_advanced_samples/blob/master/src/optixIntroduction/optixIntro_07/shaders/function_indices.h[/url]
to support GGX or any other BSDF.

That is progressive frame rendering and not real-time though, but will give you a better understanding of OptiX and an idea what is required for your use case.

But there is now public source code within the MDL SDK:
https://github.com/NVIDIA/MDL-SDK/blob/4e688e04df2de29e32cdb458bb2df1b21edd8628/src/mdl/jit/libbsdf/libbsdf.cpp#L308

sample function: hvd_ggx_sample + eval function: hvd_ggx_eval + microfacet_mask_smith_ggx …
https://github.com/NVIDIA/MDL-SDK/blob/4e688e04df2de29e32cdb458bb2df1b21edd8628/src/mdl/jit/libbsdf/libbsdf_utilities.h#L536

Hi, m1:

Thank you very much for pointing this out. I have just built the MDL SDK from source. But I cannot find the GGX sample in the build\examples folder. I tried to search files in that folder that contains string “hvd_ggx_sample” but no result returns. Do you know which sample contains GGX? Thanks a lot.

Hi hzhou3,

Its not in the examples folder, its in the “src” folder and then some deeper nested sub folders:

hvd_ggx_sample is here: MDL-SDK-2018.1.1\src\mdl\jit\libbsdf\libbsdf_utilities.h
microfacet_sample is here: MDL-SDK-2018.1.1\src\mdl\jit\libbsdf\libbsdf.cpp

When you use for example df::microfacet_ggx_smith_bsdf() in your MDL material .mdl file and run the OptiX “optixMDLSphere” sample, then the MDL SDK uses one of these functions to create PTX code for sample+evaluate distribuition.functions
you can try this by using the “df_cuda” example,
That example uses this MDL material ::nvidia::sdk_examples::tutorials::example_df
which is located here : MDL-SDK-2018.1.1\examples\mdl\nvidia\sdk_examples\tutorials.mdl
in material “example_df”

(I assume you downloaded the MDL SDK source code from https://developer.nvidia.com/mdl-sdk and
unpacked the archive MDL-SDK-2018.1.1)