The size of a GAS with DMM is 5~10 times that of general GAS


I want a tactics to improve the quality of triangles, so I try displacement micromap DMM.
The size of a GAS with DMM is about 523 9808 bytes, a general GAS’s size is about 56 3712 bytes.
I was confused is that data normal? Did I use DMM correctly?

And any help ablout how to improve the speed of traversing AS composed of narrow and tightly distributed triangles could be appreciated.


The size of the DMM depends on what sub-division level and encoding you created the DMMs with.
While the data is stored in a compressed form internally, you can still generate up to 1024 micro-triangles from a single triangle in OptiX and that needs to be stored somewhere.

You could see that for yourself when adding the following output code to the OptiX SDK 8.0.0 example optixDisplacementMicromesh

void buildAndCompact( OptixDeviceContext                  context,
                      CUstream                            cuStream,
                      CuBuffer<>&                         temp,
                      CuBuffer<>&                         output,
                      OptixTraversableHandle&             handle,
                      const OptixAccelBuildOptions&       asOptions,
                      const std::vector<OptixBuildInput>& bi )
    OptixAccelBufferSizes bufferSizes;
    OPTIX_CHECK( optixAccelComputeMemoryUsage( context, &asOptions,, (unsigned int)bi.size(), &bufferSizes ) );

    // Add this code to print the required memory for the optixAccelBuild:    
    std::cout << "outputSizeInBytes = " << bufferSizes.outputSizeInBytes 
              << ", tempSizeInBytes = " << bufferSizes.tempSizeInBytes << std::endl;

and build that example as release target.
Then run it and use the keys 1 and 2 on the numpad to change the DMM sub-division level between 0 and 5.
Drop it down to 0 and then toggle the DMMs with the key D, then enable it again and increase the sub-division level again with key 2 on the numpad until you get this output:

// Here subdivision levels should be 0.
enable DMMs: 0
outputSizeInBytes = 4224, tempSizeInBytes = 2560
enable DMMs: 1
outputSizeInBytes = 11392, tempSizeInBytes = 12288
DMM subdivision levels: 1
outputSizeInBytes = 11392, tempSizeInBytes = 12288
DMM subdivision levels: 2
outputSizeInBytes = 11392, tempSizeInBytes = 12288
DMM subdivision levels: 3
outputSizeInBytes = 11392, tempSizeInBytes = 12288
DMM subdivision levels: 4
outputSizeInBytes = 27264, tempSizeInBytes = 32000
DMM subdivision levels: 5
outputSizeInBytes = 48512, tempSizeInBytes = 58240

So as you see, the sub-division level 5 needs about 11.5 times as much memory as DMMs disabled in that configuration (4,224 vs 48,512 bytes).

The OptiX Programming Guide chapter 5.12.2 Displacement Micro-Maps goes into more detail about the different sub-division levels and encoding formats.

I assume you mean to 563,712 bytes without DMMs and 5,239,808 bytes with DMMs.
I wouldn’t really call that big given that you can have graphics boards with 48 GB of VRAM.
You could also compare that against the size you get when actually sub-dividing the triangles yourself.

Well, the outputSize of level 0 and level 1 are same in my code, I think I used it in a wrong way.
I built it by refering to example optixDisplacementMicromesh, Is there more examples ablout DMM?