Questions tagged [metalkit]

Use this tag for questions MetalKit, a framework that provides functions and classes intended to reduce the effort required to create a Metal application. Consider using a more specific tag such as [mtkview] or [mtktextureloader].

MetalKit is a framework that first appeared in iOS 9 and OS X El Capitan. It provides functions and classes intended to reduce the effort required to create a Metal application.

The following functions are the three key areas MetalKit provides:

  • Texture Loading enables your application to load textures from various sources easily. Loading of textures can be achieved in an asynchronous way with only a few lines of code. For more information, please see the MTKTextureLoader Class Reference.
  • Model Handling enables Metal-specific functionality to easily interface with Model I/O assets; these highly-optimized functions and objects make up of a collection that enables efficient data transfer between Metal buffers and Model I/O.
  • View Management provides a standard implementation of a Metal view and an optional drawing delegate, which reduce greatly the amount of code needed to generate graphics rendering in Metal app. For more information, please see the MTKView Class Reference and MTKViewDelegate Protocol Reference.

This tag is appropriate for general questions about MetalKit. Specific questions about any of the aformentioned functions should use a more specific tag instead, such as or .

400 questions
31
votes
1 answer

Using a MTLTexture as the environment map of a SCNScene

I want to set a MTLTexture object as the environment map of a scene, as it seems to be possible according to the documentation. I can set the environment map to be a UIImage with the following code: let roomImage = UIImage(named:…
halileohalilei
  • 2,220
  • 2
  • 25
  • 52
12
votes
2 answers

Ignore .metal files when building for iOS Simulator target

Whenever I build a project that includes a metal shader to an x86_64 target (iOS simulator), I get a dependency analysis warning: warning: no rule to process file '[File Path]/Shaders.metal' of type sourcecode.metal for architecture x86_64 I know…
Tricky
  • 7,025
  • 5
  • 33
  • 43
11
votes
1 answer

Texture ARMeshGeometry from ARKit Camera frame?

This question somewhat builds on this post, wherein the idea is to take the ARMeshGeometry from an iOS device with LiDAR scanner, calculate the texture coordinates, and apply the sampled camera frame as the texture for a given mesh, hereby allowing…
ZbadhabitZ
  • 2,753
  • 1
  • 25
  • 45
10
votes
1 answer

What is the coordinate system used in metal?

In metal what coordinate system to use inside shader (in and out)? and when we render to texture is it the same? with the z buffer also? Are there any inconsistencies? finally what are the difference between metal, opengl and directX ?
zeus
  • 12,173
  • 9
  • 63
  • 184
10
votes
1 answer

How to use multisampling with an MTKView?

I'm trying to get multisampling working with MTKView. I have an MTKView with a delegate. I set the view's sampleCount property to 4. I create a pipeline state descriptor with the rasterSampleCount set to 4, and use that to make a render pipeline…
user1118321
  • 25,567
  • 4
  • 55
  • 86
10
votes
1 answer

Applying MPSImageGaussianBlur with depth data

I am trying to create an imitation of the portrait mode in Apple's native camera. The problem is, that applying the blur effect using CIImage with respect to depth data, is too slow for the live preview I want to show to the user. My code for this…
Eyzuky
  • 1,843
  • 2
  • 22
  • 45
9
votes
1 answer

Show current frame rate of a MTKView

I know that in SceneKit, you can enable a banner on the side of the SKView to look at real time frame rates and other useful debugging information. But what about MTKView? I don't seem to find such a property to enable, or how I can query the…
jackxujh
  • 983
  • 10
  • 31
9
votes
1 answer

Applying compute/kernel function to vertex buffer before vertex shader

I would like to use a compute shader to modify my vertices before they are passed to the vertex shader. I can’t find any examples or explanations of this, except that it seems to be mentioned here: Metal emulate geometry shaders using compute…
Nils Nielsen
  • 131
  • 5
9
votes
2 answers

Blend Mode in Metal

These are the two the blend-mode i used in OpenGL what is the conversion to the metal in IOS glEnable(GL_BLEND); glBlendFuncSeparate(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE,…
Ruban4Axis
  • 821
  • 6
  • 27
9
votes
1 answer

What is the main difference between float4 and half4 in fragment shader function?

I try to set render pipeline and MTKView color attachment pixel format of MTLPixelFormatRGBA16Float. However, it seem same with MTLPixelFormatBGRA8Unorm_sRGB. I just want to make the render color range higher(HDR). Is the return type of the fragment…
BigFatTom
  • 149
  • 1
  • 6
9
votes
1 answer

Metal shader texture read vs sample

In Metal shading language, what is the exact difference between read and sample function to access texture pixels, and which one should be used when?
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
9
votes
1 answer

Metal / UIKit synchronisation with .presentsWithTransaction

The Apple docs for CAMetalLayer state that the property presentsWithTransaction is: A Boolean value that determines whether the layer presents its content using a Core Animation transaction As I'm using UIKit to drive some metal animations…
Tricky
  • 7,025
  • 5
  • 33
  • 43
9
votes
1 answer

MTKView Displaying Wide Gamut P3 Colorspace

I'm building a real-time photo editor based on CIFilters and MetalKit. But I'm running into an issue with displaying wide gamut images in a MTKView. Standard sRGB images display just fine, but Display P3 images are washed out. I've tried setting the…
Kevin
  • 224
  • 3
  • 12
9
votes
0 answers

MTLRenderPassColorAttachmentDescriptor.clearColor does not respect alpha value

I am new to Metal and am trying to add a metal view on top of another NSView. Within the metal view (MTKView) i want to render a triangle, over clear (transparent) background. However, the background of the MTKView is always a solid color. Here is…
Reneli
  • 1,756
  • 2
  • 16
  • 26
8
votes
0 answers

CIImage display MTKView vs GLKView performance

I have a series of UI Images (made from incoming jpeg Data from server) that I wish to render using MTKView. Problem is it is too slow compared to GLKView. There is lot of buffering and delay when I have a series of images to display in MTKView but…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
1
2 3
26 27