Post

Replies

Boosts

Views

Activity

Metal 4 & Acceleration Structures
I have really enjoyed looking through the code and videos related to Metal 4. Currently, my interest is to update a ReSTIR Project and take advantage of more robust ways to refit acceleration Structures and more powerful ways to access resources. I am working in Swift and have encountered a couple of puzzles: What is the 'accepted' way to create a MTL4BufferRange to store indices and vertices? How do I properly rewrite Swift code to build and compact an Acceleration Structure? I do realize that this is all in Beta and will happily look through Code Samples this Fall. If other guidance is available earlier, that would be fabulous! Thank you
2
0
416
2w
Upcoming Developments with Metal Ray Tracing
I have watched the Enhance Your App with Metal Ray Tracing video ( wwdc21-10149 ) a few times and am very interested in many of the upcoming features described. It seems as though there will be some tweaks ( ie. Instance IDs ) and some major additions ( ie. Keyframe Animation ). I am wondering if there is any sense of the timing of these features becoming available ( beta or otherwise ) and also, if some of the sample code might be provided in Swift. Thanks so much for the work that went into the video and explanations.
1
0
861
Jun ’21
Loading an HDR Image into a Metal Texture
I am working on implementing Image Based Lighting in a ray tracing project. In order to get the sampling to work predictably, I will need to load and process an HDR image into a MTLTexture. While using a MTKTextureLoader to load .jpg and .png files has been super-smooth, loading a .hdr file in Swift seems to have a few barriers. I have tried to follow the Processing HDR Images with Metal sample code [ Objective C ], but it relies on some finessing of pointers that I can't duplicate in Swift. Is there currently a best way to move an HDR image into a Metal texture using Swift? Thanks so much!
2
0
1.8k
Jan ’21
Filling in a MTLAccelerationStructureInstanceDescriptor
While translating the Accelerating Ray Tracing Using Metal sample project into Swift, I have run into an issue within the createAccelerationStructures function. I am trying to fill in the first three rows of the instance transformation matrix. In the Objective C example, it looks like: for (int column = 0; column < 4; column++) &#9;for (int row = 0; row < 3; row++) &#9;&#9;instanceDescriptors[instanceIndex].transformationMatrix.columns[column][row] = instance.transform.columns[column][row]; The matrix targeted is a MTLPackedFloat4x3. It has defied me pulling out the needed elements from my instance transform and placing them in the descriptor. I have tried the obvious: for column in 0..<( 4 ) &#9;{ &#9;for row in 0..<( 3 ) &#9;&#9;{ &#9;&#9;anInstanceDescriptorPointer.pointee.transformationMatrix.columns[column][row] = aNodeInstance.transform.columns[column][row] &#9;&#9;} &#9;} I have tried more obscure ideas related to simd matrices and Swift. The compiler errors generally warn me that MTLPackedFloat4x3 has no subscripts. Question - Is there an accepted way to assign three rows from the instance transform to the descriptor transformationMatrix in Swift? Thank you for your earlier help with all of this. I should mention that the new intersector feature in Metal has worked really well for me when feeding it a primitiveaccelerationstructure. Very elegant! But using instances seems to offer more flexibility going forward. Thank you very much!
3
0
1k
Jul ’20