Dear experts, I'm working on adding UI for my cpp based path tracer renderer.
I want to create metal cpp device and pass it to renderer, but also I want to use ImGui and GLFW (for window manager and input events handling). I've found solution how I can mix obj c code that requires by GLFW window setup and cpp code: https://github.com/ikryukov/MetalCppImGui
// Here is key thing for integration GLFW with Metal Cpp
// GLFW supports only obj c window handle
NSWindow *nswin = glfwGetCocoaWindow(window);
CA::MetalLayer* layer = CA::MetalLayer::layer();
layer->setDevice(device);
layer->setPixelFormat(MTL::PixelFormatBGRA8Unorm); // bridge to obj c here because NSWindow expetcs objc
CAMetalLayer* l = (__bridge CAMetalLayer*)layer;
nswin.contentView.layer = l;
nswin.contentView.wantsLayer = YES;
Is there any official way to handle event in Metal cpp without objective c support? Maybe MetalKit will have such features in future?
Post
Replies
Boosts
Views
Activity
Hi experts, I'm working on PathTracer using metal-cpp and I use per-primitive data from you latest presentation: https://developer.apple.com/videos/play/wwdc2022/10105/ and described here: https://developer.apple.com/documentation/metal/ray_tracing_with_acceleration_structures
Currently I want to store something like this structure:
struct Triangle
{
vector_float3 positions[3];
uint32_t normals[3];
uint32_t tangent[3];
uint32_t uv[3];
};
Are there any guidelines on size of this small amounts of data that I could store in acceleration structure? And if it stores inside BVH nodes -> that could affect traversal performance.
Thanks!