Graphics and Games

RSS for tag

Build captivating gaming experiences for Apple platforms.

Graphics and Games Documentation

Posts under Graphics and Games tag

27 Posts
Sort by:
Post not yet marked as solved
1 Replies
470 Views
Hi, I'm displaying linear gray by CAMetalLayer with the shader below. fragment float4 fragmentShader(VertexOut in [[stage_in]], texture2d<float, access::sample> BGRATexture [[ texture(0) ]]) { float color = in.texCoordinates.x; return float4(float3(color), 1.0); } And my CAMetalLayer has been set to linearSRGB. metalLayer.colorspace = CGColorSpace(name: CGColorSpace.linearSRGB) metalLayer.pixelFormat = .bgra8Unorm Why the display seem add gamma? Apparently the middle gray is 187 but not 128.
Posted
by
Post not yet marked as solved
0 Replies
428 Views
Hi Apple and Swift friends. I'm not really a fluent Swift programmer (or any language) just knowledgable, I just a vague logic of what's going on. This is a gamepad controller remapper similar to DS4Windows on the PC and DSX on Steam gaming. On macOS Sonoma, it successfully compiled and connected the amazing Sony Playstation DualSense but because it has 33 yellow warning, the Setting doesn't show. It says something about outdated something and needs to be replaced by a newer framework.network. It also says it can't use self: It should look like these: What could be the syntax changes that won't produce the 30+ yellow warnings? The file can be had here: [https://github.com/marcowindt/ds4macos) God bless.
Posted
by
Post not yet marked as solved
0 Replies
336 Views
I have my Xbox Controller plugged into my Macbook, but my controller won't stay on (no batteries are needed for this controller, and the plug I am using works). Also in system settings when I scroll to Xbox Controllers it says no devices found. How do I fix this?
Posted
by
Post not yet marked as solved
1 Replies
568 Views
Hello. When I try to profile a frame capture of an app running on iPad, I get the following error: Unexpected Replayer Termination Abort trap: 6 This is my configuration: macOS 14.0 Xcode 15.0 iPad Pro (10.5-inch) - A10X iPadOS 17.2 Is this expected? Is there a way to fix the issue? Thanks
Posted
by
Post not yet marked as solved
0 Replies
506 Views
The touch input stutter issue that exists since iOS 16 on devices with Pro Motion Displays has not been fixed yet. I filed a bug report in July but there isn't any progress since months. I see the problem in all games I tried. My game is fast paced so the stutters are quite obvious and I receive a lot of complaining emails. My game did run smoothly on Pro Motion devices with iOS 15. Is there a known workaround? I am seeing other developers having the same issue but I can't find any solutions. Other threads about this issue: IPhone 14 Pro stuttering in most games when using touch controls FPS drops when tapping the screen on iPhone 13 Pro Max
Posted
by
Post not yet marked as solved
0 Replies
623 Views
I am trying to control the orientation of a box in Scene Kit (iOS) using gestures. I am using the translation in x and y to update the x and y rotation of the SCNNode. After a long search I have realised that x and y rotation will always lead to z rotation, thanks to this excellent post: [https://gamedev.stackexchange.com/questions/136174/im-rotating-an-object-on-two-axes-so-why-does-it-keep-twisting-around-the-thir?newreg=130c66c673f848a7be2873bf675573a9) So I am trying to get the z rotation causes, and then remove this from my object by applying the inverse quaternion however when I rotate the object 90 deg around x, and then 90 deg around Y it behaves VERY weirdly. It is almost behaving as it is in gimbal lock, but I did not think that using quaternion in the way that I am would cause gimbal lock in this way. I am sure it is something I am missing, or perhaps I am not able to remove the z rotation in this way. Thanks! I have added a video of the strange behaviour here [https://github.com/marcusraty/RotationExample/blob/main/Example.MP4) And the code example is here [https://github.com/marcusraty/RotationExample)
Posted
by
Post not yet marked as solved
3 Replies
1k Views
I'm using DrawableQueue to create textures that I apply to my ShaderGraphMaterial texture. My metal render is using a range of alpha values as a test. My objects displayed with the DrawableQueue texture are working as expected, but the alpha component is not working. Is this an issue with my DrawableQueue descriptor? My ShaderGraphMaterial? A missing setting on my scene objects? or some limitation in visionOS? DrawableQueue descriptor let descriptor = await TextureResource.DrawableQueue.Descriptor( pixelFormat: .rgba8Unorm, width: textureResource!.width, height: textureResource!.height, usage: [.renderTarget, .shaderRead, .shaderWrite], // Usage should match the requirements for how the texture will be used //usage: [.renderTarget], // Usage should match the requirements for how the texture will be used mipmapsMode: .none // Assuming no mipmaps are needed for the text texture ) let queue = try await TextureResource.DrawableQueue(descriptor) queue.allowsNextDrawableTimeout = true await textureResource!.replace(withDrawables: queue) Draw frame: guard let drawable = try? drawableQueue!.nextDrawable(), let commandBuffer = commandQueue?.makeCommandBuffer()//, //let renderPipelineState = renderPipelineState else { return } let renderPassDescriptor = MTLRenderPassDescriptor() renderPassDescriptor.colorAttachments[0].texture = drawable.texture renderPassDescriptor.colorAttachments[0].loadAction = .clear renderPassDescriptor.colorAttachments[0].storeAction = .store renderPassDescriptor.colorAttachments[0].clearColor = clearColor /*renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColor( red: clearColor.red, green: clearColor.green, blue: clearColor.blue, alpha: 0.5 )*/ renderPassDescriptor.renderTargetHeight = drawable.texture.height renderPassDescriptor.renderTargetWidth = drawable.texture.width guard let renderEncoder = commandBuffer.makeRenderCommandEncoder(descriptor: renderPassDescriptor) else { return } renderEncoder.pushDebugGroup("DrawNextFrameWithColor") //renderEncoder.setRenderPipelineState(renderPipelineState) // No need to create a render command encoder with shaders, as we are only clearing the drawable. // Since we are just clearing the drawable to a solid color, no need to draw primitives renderEncoder.endEncoding() commandBuffer.commit() commandBuffer.waitUntilCompleted() drawable.present() }
Post marked as solved
4 Replies
1.5k Views
Hello everyone. I wonder what conditions should be met to let Sonoma activate Game Mode for my App? The app is a 3D application with high demands on GPU, so gaining additional performance from OS would be great. But simply going full screen does not activate Game Mode like e.g. games from Steam do. Are there any settings that one could influence to let the app trigger Game Mode? Best regards, Alex
Posted
by
Post not yet marked as solved
0 Replies
754 Views
I've got a Mac Mini running as a CI/CD server; it's a game project, and every time we push a change to the repo, the server creates a build & uploads it to TestFlight. I've noticed that after running the server for around a week or so, the main drive is getting filled to the point of the machine becoming unresponsive (and our builds failing). After some investigation, I've determined that /private/var/folders/ is getting filled up with... something, related to the Xcode build/archive. It seems like we absolutely do not need this information, so I've periodically run rm -rf /private/var/folders/* to clean it out – some folders are permission-protected, but regardless, I'm able to recover >100GB with this method. Although this workaround does suffice, I'm just wondering what kinds of files Xcode is creating here, and whether there's a cleaner/best-practice method to remove them.
Posted
by
Post not yet marked as solved
0 Replies
608 Views
How is this a valid stack trace with mangled symbol names and file/line information? I've already demangled the name, even though Windows does this for me. The recommended approach to get file/line seems to be to proc "atos" process repeatedly on the symbols to turn them all into file/line. But shouldn't there just be a function call for this, or option to backtrace_symbols() since it's looking up the symbol anyways. I don't get how this external process call would work for iOS, and it seems slow for macOS as well. Compare this with Window CaptureStackBackTrace, and then there is a simple function call via DbgHelp.lib to retrieve the file/line. Am I supposed to somehow use the CoreSymbolicate framework on macOS/iOS?
Posted
by
Post not yet marked as solved
0 Replies
833 Views
The macOS screen recording tool doesn't appear to support recording HDR content (f.e. in QuickTime player). This tool can record from the camera using various YCbCr 422 and 420 formats needed for HVEC and ProRes HDR10 recording, but doesn't offer any options for screen recording HDR. So that leaves in-game screen recording with AVFoundation. Without any YCbCr formats exposed in Metal api, how do we use CVPixelBuffer with Metal, and then send these formats off to the video codes directly? Can we send Rec2020 RGB10A2Unorm data directly? I'd like the fewest conversions possible.
Posted
by
Post marked as solved
1 Replies
856 Views
Hello everyone! Here with another graphics api question but slightly different. I'm currently looking at 2 SDK's for physics called PhysX and Bullet. The game asphalt 9 uses metal and bullet and I would like to do the same with asphalt 9. With metal 3 out and stable it seems, I would like to use one of these engines for my upcoming metal api rendering engine. Bur there's a catch, I wish to use objective-c or c++ for both the rendering engine and the physics engine as I mentioned above, but not me touching swift(its a good language but i wish to use c++ for game development). What do you guys say about this?
Posted
by
Post not yet marked as solved
5 Replies
1.3k Views
What is the most efficient way to use a MTLTexture (created procedurally at run-time) as a RealityKit TextureResource? I update the MTLTexture per-frame using regular Metal rendering, so it’s not something I can do offline. Is there a way to wrap it without doing a copy? A specific example would be great. Thank you!
Posted
by
Post not yet marked as solved
4 Replies
2.7k Views
I have a Macbook Pro 16 M1Pro 16Gb Ram MacOS 14 Sonoma Beta 4 and GPT 1.0.2 and currently testing Diablo 4 V 1.04 (latest Update on 08.08.2023). The game is awesome and it runs in 2560x1440 in 50-60fps on my 4K-LG Display over HDMI very smoothly, until .... see Problem 1 and Problem 2 Graphics details are in full detail. smooth shadows and even FSR2 works perfectly. Diablo4 needs around 9-11 GB Ram on my system. There are no background activities running! Problem 1: exploring new areas causes Ram Buffer overflow, freezes the screen, and crashes, and a new system reboot is needed. Problem 2: when trying to buy/sell an item, or just the characters menu will be opened, the game freezes. A game reboot is necessary! While running the HUD in games I can see what's going on and could analyze, that while it's the case Problem 1 and Problem 2 happening, The RAM jumps from 9-11 GB to 16-18 GB. This is much more than the System can deliver and cause the screen freezes and crash. Either the whole system reboot or mostly just the game reboot is needed. Would be very nice if Apple could fix/adjusts GPT in the next versions of Diablo 4. Many thanks in advanced
Posted
by
Post not yet marked as solved
0 Replies
1.3k Views
We have some problems with achievements which were unlocked in Game Center. This is our first time that we implemented Game Center features inside our app and it seems that leaderboards, score reporting and unlocking achievements are all working fine. We can see unlocked achievements in the achievements board but they are becoming locked again just a few seconds later. Everything seem to be working fine except this weird behavior (all handlers are returning success etc.) We also tried many tests with different type of achievements (both with achievable more than once YES and NO achievements). It may be an expected behavior with achievements which are of kind achievable more than once but they are becoming locked again if they are not as such) As the only thing that comes to our minds: the version with achievements and leaderboard is not published yet in AppStore and we are testing achievements with some sandbox testers and a real user device. Could such resetting (becoming locked again) be due to not yet being published in store? Thanks in advance for very appreciated tries, help and assistance If it will help you guide us: * GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler: returns all achievement registered in appstore connect GKAchievement reportAchievements: always return success (and so we can see them in gamecenter board) GKAchievement loadAchievementsWithCompletionHandler: returns completed achievements until that reset occurs (i.e. after completing the achievement, we send a request -&gt; it is there; a few seconds later again we send a request -&gt; it is again there; a few more tries and it is gone ...)
Posted
by
Post not yet marked as solved
0 Replies
861 Views
In regular Metal, I can do all sorts of tricks with texture masking to create composite objects and effects, similar to CSG. Since for now, AR-mode in visionOS requires RealityKit without the ability to use custom shaders, I'm a bit stuck. I'm pretty sure so far that what I want is impossible and requires a feature request, but here it goes: Here's a 2D example: Say I have some fake circular flashlights shining into the scene, depthwise, and everything else is black except for some rectangles that are "lit" by the circles. The result: How it works: In Metal, my per-instance data contain a texture index for a mask texture. The mask texture has an alpha of 0 for spots where the instance should not be visible, and an alpha of 1 otherwise. So in an initial renderpass, I draw the circular lights to this mask texture. In pass 2, I attach the fullscreen mask texture (circular lights) to all mesh instances that I want hidden in the darkness. A custom fragment shader multiplies the alpha of the full-screen mask texture sample at the given fragment with the color that would otherwise be output. i.e. out_color *= mask.a. The way I have blending and clear colors set-up, wherever the mask alpha is 0, an object will be hidden. The background clear color is black. The following is how the scene looks if I don't attach the masking texture. You can see that behind the scenes, the full rectangle is there. In visionOS AR-mode, the point is for the system to apply lighting, depth, and occlusion information to the world. For my effect to work, I need to be able to generate an intermediate representation of my world (after pass 2) that shows some of that world in darkness. I know I can use Metal separately from RealityKit to prepare a texture to apply to a RealityKit mesh using DrawableQueue However, as far as I know there is no way to supply a full-screen depth buffer for RealityKit to mix with whatever it's doing with the AR passthrough depth and occlusion behind the scenes. So my Metal texture would just be a flat quad in the scene rather than something mixed with the world. Furthermore, I don't see a way to apply a full-screen quad to the scene, period. I think my use case is impossible in visionOS in AR mode without customizable rendering in Metal (separate issue: I still think in single full app mode, it should be possible to grant access to the camera and custom rendering more securely) and/or a RealityKit feature enabling mixing of depth and occlusion textures for compositing. I love these sorts of masking/texture effects because they're simple and elegant to pull-off, and I can imagine creating several useful and fun experiences using this masking and custom depth info with AR passthrough. Please advise on how I could achieve this effect in the meantime. However, I'll go ahead and say a specific feature request is the ability to provide full-screen depth and occlusion textures to RealityKit so it's easier to mix Metal rendering as a pre-pass with RealityKit as a final composition step.
Posted
by
Post not yet marked as solved
1 Replies
3.2k Views
Hi all, I installed the game porting toolkit, installed Battle.net.exe, and finished downloading Diablo IV. Clicking the Play button returns "No GPUs found! A GPU is required to play Diablo IV. This might occur if you are currently installing GPU drivers." Could anyone tell me how to fix this issue? How can I install the driver and run the game? I am not good at typing command lines so I really appreciate it if you guys can show me some codes to fix it. Thanks!
Posted
by
Post not yet marked as solved
2 Replies
985 Views
I render with func drawIndexedPrimitives( type primitiveType: MTLPrimitiveType, indexType: MTLIndexType, indexBuffer: MTLBuffer, indexBufferOffset: Int, indirectBuffer: MTLBuffer, indirectBufferOffset: Int ), when I use Argument Buffer to set textures(e.g. to fragnent shader), everything is fine. But is there a way to set textures without Argument Buffer? Argument Buffer is the only way?
Posted
by
Post marked as solved
16 Replies
1.8k Views
Apparenrly, shadows aren’t generated for procedural geometry in RealityKit: https://codingxr.com/articles/shadows-lights-in-realitykit/ Has this been fixed? My projects tend to involve a lot of procedurally-generated meshes as opposed to importes-models. This will be even more important when VisionOS is out. On a similar note, it used to be that ground shadows were not per-entity. I’d like to enable or disable them per-entity. Is it possible? Since currently the only way to use passthrough AR in Vision OS will be to use RealityKit, more flexibility will be required. I can‘t simply apply my own preferences.
Posted
by
Post not yet marked as solved
1 Replies
2.1k Views
Sadly, I was not able to register for the Games Q&A at. WWDC. My question is as follows: For making a Universal Binary, one compatible with Big Sur and up, will the tools in Xcode 15 help me port over a Win32 project over, or does the tool only work assuming macOS Sonoma and up, exclusively on Apple Silicon?
Posted
by