Delve into the world of graphics and game development. Discuss creating stunning visuals, optimizing game mechanics, and share resources for game developers.

Post

Replies

Boosts

Views

Activity

Cannot install keras on macOS
I'm using an anaconda environment Tensorflow-macos 2.15 Keras 2.15 Python 3.11.5 macOS m2 14.1 I guess problem with Pycharm, because cod is working and error is: Cannot find reference 'keras' in 'imported module tensorflow | init.py'. Previously I built a model on a simple MNIST and it's working but have same problem. I have tried different references and versions of python. I've changed environments at least 3 times and it doesn't work.
0
0
640
Dec ’23
VisionOS: Immersive space with Metal framework
Hi, I'm trying to build an app demo with Metal framework on visionOS. I've found out that when I enabled immersive space it was in a fully immersive mode and the Metal was rendering the background with black color. And I've inspected the demo code and the clear color was (0, 0, 0, 0). I wonder if it is possible to render just like RealityKit with mixed reality effect that some 3D models can be rendered in the real world without a black background. Any idea or explanation?
2
0
605
Dec ’23
App renders as a black on screen
Hello, I am creating an application that is cross-platform with Flutter, the problem is that when I launch my application on my Macbook there is only a black page displayed. This is a recurring problem with all Flutter applications on this Mac. When I debug my application, this is what appears in the console. Error submitting command buffer. 2023-12-27 15:58:12.468 tranzic[2333:21044] Error Domain=MTLCommandBufferErrorDomain Code=4 "Ignored (for causing prior/excessive GPU errors) (00000004:kIOAccelCommandBufferCallbackErrorSubmissionsIgnored)" UserInfo={NSLocalizedDescription=Ignored (for causing prior/excessive GPU errors) (00000004:kIOAccelCommandBufferCallbackErrorSubmissionsIgnored), MTLCommandBufferEncoderInfoErrorKey=( "<errorState: MTLCommandEncoderErrorStatePending, label: (null), debugSignposts: (null)>", "<errorState: MTLCommandEncoderErrorStatePending, label: (null), debugSignposts: (null)>", "<errorState: MTLCommandEncoderErrorStatePending, label: (null), debugSignposts: (null)>" )} Error submitting command buffer. 2023-12-27 15:58:18.455 tranzic[2333:21044] Error Domain=MTLCommandBufferErrorDomain Code=4 "Ignored (for causing prior/excessive GPU errors) (00000004:kIOAccelCommandBufferCallbackErrorSubmissionsIgnored)" UserInfo={NSLocalizedDescription=Ignored (for causing prior/excessive GPU errors) (00000004:kIOAccelCommandBufferCallbackErrorSubmissionsIgnored), MTLCommandBufferEncoderInfoErrorKey=( "<errorState: MTLCommandEncoderErrorStatePending, label: (null), debugSignposts: (null)>", "<errorState: MTLCommandEncoderErrorStatePending, label: (null), debugSignposts: (null)>", "<errorState: MTLCommandEncoderErrorStatePending, label: (null), debugSignposts: (null)>" )} I have a Macbook Pro mid-2012 running macOS Monterey and here's an issue I opened on the flutter repo for more details. https://github.com/flutter/flutter/issues/137859
2
2
515
Dec ’23
Understanding MaterialX support in USDZ Quicklook
Hello, I'm exporting a 3D model with a shader created in Reality Composer Pro's Shader Graph to a USDZ file for viewing in QuickLook. Once exported, the USDZ file in QuickLook appears without the shader material. When I import the file back into Xcode, the material renders properly. Is it possible to publish MaterialX shaders to be viewed in QuickLook? Hopefully it is, because it seems the push to MaterialX and USDZ is supposed to be for universal support :) Any guidance is appreciated!
3
0
570
Dec ’23
Apple Core Package for Unity
I have installed the aple game kit and when it is time to build the packages i go to unity pakage manager and find the .tgz file and open it but the apple core pakage does not appear on the list inside package manager. Using unity 2022.2.2 [08:53:18] [Package Manager Window] Error adding package: file:./Assets/External Packages/unityplugins-main/Build/fbx20133_converter_mac.pkg.tgz. Unable to add package file: /Assets/External Packages/unitvolugins-main/Build/fbx20133 converter mac.nka.tazl: [08:56:07] [Package Manager Window] Error adding package: file:./Assets/External Packages/unityplugins-main/Build/fbx20133_converter_mac.pkq.tqz. Unable to add package tile:.. Assets/External Packages unitvplugins-mainBulld/TbX20133_converter mac.pka.taz: [08:59:311 [Package Manager Window] Error adding package: file../ Assets/External Packages/unityplugins-main/Build/fbx20133_converter_mac.pkg.tgz. unable to add package TIle….. AssETS/External Packages unityplugins-main/Bulld/TOX20133_converter_mac.pkq.tqz: [09:03:111 [Package Manager Window] Error adding package: file../Assets/External Packages/unityplugins-main/Build/fbx20133_converter_mac.pkg.tgz. unable to add package Tile:.. AssEts/Extemalackagesunitypiugins-main/Bulla/TOXU133_convener_mac.pko.toz]: ¿ Perso [Package Manager Window] Error adding package: file:./ Assets/External Packages/unityplugins-main/Build/fbx20133_converter_mac.pkg.tgz. Unable to add package [file:../Assets/External Packages/unityplugins-main/Build/fbx20133_converter_mac.pkg.tgz]: The file L/var/folders/39/drmm3vg15tsggs7nt7z360lh0000gn/T/.tmp-9365-Q2GPWMjILnkO/package.json] cannot be found
1
0
601
Dec ’23
Multiple root level objects Error [USDZ/Reality Composer Pro]
Hey everyone, I'm running into this issue of my USDZ model not showing up in Reality Composer Pro, exported from Blender as a USD and converted in Reality Converter. See Attached image: It's strange, because the USDz model appears fine in Previews. But once it is brought inside RCP, I receive this pop up, and does not appear. Not sure how to resolve this multiple root level issue. If anyone can point me in the right direction or any feedback, all is much appreciated! Thank you!
1
0
875
Dec ’23
Strange error when using memory barrier in MTLRenderCommandEncoder with imageblocks
I'm attempting to put two mesh draws into a MTLRenderCommandEncoder with a memory barrier between them. I'm also using image blocks in the fragment functions in the two pipelines. Something like this: [encoder setRenderPipelineState:pipeline1]; [encoder drawMeshThreadgroups:threadgroupsPerGrid threadsPerObjectThreadgroup:threadsPerObjectThreadgroup threadsPerMeshThreadgroup:threadsPerMeshThreadgroup]; [encoder memoryBarrierWithScope:MTLBarrierScopeBuffers afterStages:MTLRenderStageMesh beforeStages:MTLRenderStageObject]; [encoder setRenderPipelineState:pipeline2]; [encoder drawMeshThreadgroups:threadgroupsPerGrid threadsPerObjectThreadgroup:threadsPerObjectThreadgroup threadsPerMeshThreadgroup:threadsPerMeshThreadgroup]; I get a strange error: Execution of the command buffer was aborted due to an error during execution. Too many unique viewports, scissor rectangles or depth-bias values to support memoryless render pass attachments. (0000000c:kIOGPUCommandBufferCallbackErrorExceededHardwareLimit) I'm not using multiple viewports or scissor rectangles and I'm not using depth bias. I don't have memoryless attachments, though as mentioned, I am using imageblocks. Without the memory barrier I don't get the error. Using memoryBarrierWithResources rather than memoryBarrierWithScope This is on an M2 Max running 14.3 Beta (23D5033f) I can't tell if I encountered a real limitation or a Metal driver bug.
1
1
295
Dec ’23
Seeking Clarification on UsdPrimvarReader Node Functionality
Hello fellow developers, I am currently exploring the functionality of the UsdPrimvarReader node in Shader Graph Editor and would appreciate some clarification on its operational principles. Despite my efforts to understand its functionality, I find myself in need of some guidance. Specifically, I would appreciate insights into the proper functioning of the UsdPrimvarReader node, including how it should ideally operate, the essential data that should be specified in the Varname field, and the Primvars that can be extracted from a USD file. Additionally, I am curious about the correct code representation of a Primvar in USD file to ensure it can be invoked successfully. If anyone could share their expertise or point me in the right direction to relevant documentation, I would be immensely grateful. Thank you in advance for your time and consideration. I look forward to any insights or recommendations you may have.
1
0
606
Dec ’23
How do I change the background color of a visionOS immersive space?
In visionOS, once an immersive space is opened, the background color is solid black. How do I change this? I just need to set a static color without any shading, but I can't find any documentation or examples on how to do this, and the template that comes with Xcode 15.1 beta 3 doesn't change the background color. I've searched around for information, but all I can find points back to MTKView.clearColor, which I can't use when drawing into an immersive space, since immersive spaces on visionOS use Compositor Services and not MTKView or CAMetalLayer for drawing 3D content.
2
0
871
Dec ’23
MTLVertexDescriptor's offset -- everybody's doing it wrong
In pretty much every Metal tutorial out there, people use MTLVertexDescriptor like this: they create a struct like struct Vertex { var position: float3 var color: float3 } then a vertex array and buffer: let vertices: [Vertex] = ... guard let vertexBuffer = device.makeBuffer(bytes: vertices, length: MemoryLayout<Vertex>.stride * vertices.count, options: []) else { ... } This is all good, we have a buffer with interleaved position and color data. The problem is, when creating a vertex descriptor, they use MemoryLayout<float3>.stride as the offset for the second attribute: let vertexDescriptor = MTLVertexDescriptor() vertexDescriptor.attributes[0].format = .float3 vertexDescriptor.attributes[0].offset = 0 vertexDescriptor.attributes[0].bufferIndex = 0 vertexDescriptor.attributes[1].format = .float3 vertexDescriptor.attributes[1].offset = MemoryLayout<float3>.stride // <-- here! vertexDescriptor.attributes[1].bufferIndex = 0 vertexDescriptor.layouts[0].stride = MemoryLayout<Vertex>.stride This does not look correct to me. The code happens to work only because the stride of SIMD3<Float> (a.k.a. float3) matches the alignment of the fields in this particular struct. But if we have something like this: struct Vertex { var attr0: Float var attr1: Float var attr2: SIMD3<Float> } then the naive approach of using stride won't work. Because of padding, attr2 does not start right after the two floats, at offset 2 * MemoryLayout<Float>.stride but at offset = 16. So it seems to me that the only correct and robust way to set the vertex descriptor's offset is to use offset(of:), like this: vertexDescriptor.attributes[2].offset = MemoryLayout<Vertex>.offset(of: \.attr2)! Yet, I'm not able to find a single code example that does this. Am I missing something, or is everybody else just being careless with their offsets?
0
0
290
Dec ’23
OpenGL on future iPhones and Macs?
Hello everyone! After some time to think about I proceed with graphics api, I figured opengl will be my first since I'm completely new to graphics programming. As in my last post you may find, I was speaking on moltenvk and might just use metal instead, along with the demos I found using metal. So for now, and I know this is said MANY TIMES, apple deprecated opengl but wish to use it because I'm new to graphics programming and want to develop an app(a rendering engine really) for the iPhone 14 Pro Max and macOS Ventura 13.2(I think this is the latest). So what do you guys think? Can I still use opengl es on the 14 max, along with opengl 4+ on latest macOS even though is deprecated?
15
0
5.6k
Feb ’23
iOS 16 & 17 touch input stutter on Pro Motion devices. Workaround?
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
0
0
685
Dec ’23
Overloaded operator & device memory
Hi, In a metal shader I have a user-defined struct with a square brackets operator. This is a simplified version of it: struct MyData { float data[12]; float operator[](int i) const { return data[i]; } }; I pass a device buffer of that type in a compute kernel function: device const MyData* myDataBuffer Using the operator with a thread-space object works fine: MyData data_object = myDataBuffer[0]; float x = data_object[0]; // ok ..but trying to use it with the device-space buffer fails: float x = myDataBuffer[0][0]; // compilation error No viable overloaded operator[] for type 'const device MyData' Candidate function not viable: address space mismatch in 'this' argument ('const device MyData'), parameter type must be 'const MyData' For other operators I could define the function outside the struct and pass a reference to a device-memory object but the function for the square brackets operator can only be a member function. Am I missing something that could make the above statement compile?
2
0
310
Dec ’23
Create CGColorSpace from CFPropertyList
I am trying to create a custom CGColorSpace in Swift on macOS but am not sure I really understand the concepts. I want to use a custom color space called Spot1 and if I extract the spot color from a PDF I get the following: "ColorSpace<Dictionary>" = { "Cs2<Array>" = ( Separation, Spot1, DeviceCMYK, { "BitsPerSample<Integer>" = 8; "Domain<Array>" = ( 0, 1 ); "Filter<Name>" = FlateDecode; "FunctionType<Integer>" = 0; "Length<Integer>" = 526; "Range<Array>" = ( 0, 1, 0, 1, 0, 1, 0, 1 ); "Size<Array>" = ( 1024 ); } ); }; How can I create this same color space using the CGColorSpace(propertyListPlist: CFPropertyList) API func createSpot1() -> CGColorSpace? { let dict0 : NSDictionary = [ "BitsPerSample": 8, "Domain" : [0,1], "Filter" : "FlateDecode", "FunctionType" : 0, "Length" : 526, "Range" : [0,1,0,1,0,1,0,1], "Size" : [1024]] let dict : NSDictionary = [ "Cs2" : ["Separation","Spot1", "DeviceCMYK", dict0] ] let space = CGColorSpace(propertyListPlist: dict as CFPropertyList) if space == nil { DebugLog("Spot1 color space is nil!") } return space }
0
0
485
Dec ’23
GPTK on Apple TV
I did not know that you can also get GPTK when you're working on an AppleTV app. I'm getting back into game programming so I booted up an app I installed on my AppleTV a few months ago and the display showed GPTK so I was able to see performance. Drew
0
0
659
Dec ’23
Crash when running custom train step and layers
My environment: Tensorflow: 2.14, tf-metal: 1.1, M3 Max I am working on an GAN full of residual sum and concatenation. It is trained correctly if using CPU only. However, if I enable GPU, it would cause: oc("mps_slice_1"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/d615290d-668b-11ee-9734-0697ca55970a/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":359:0)): error: 'mps.slice' op failed: length value 32 does not fit within the dimension size (33) with start value (32) /AppleInternal/Library/BuildRoots/d615290d-668b-11ee-9734-0697ca55970a/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphExecutable.mm:2133: failed assertion `Error: MLIR pass manager failed' Some customization I guess might be related to the error: tf.bitwise.bitwise_xor, tf.concat, tf.pad in custom layers numpy.random in train steps. Another debug hint I found is that the "32" is the number of channel of my models' conv layer, and change as I change the number of channel. Is there anyone know what is wrong? Thank you so much
1
1
491
Dec ’23
Which attribute should I use to know which eye in the fragment shader?
Hi, I have an app based on Metal and it runs on VisionOS. It has a huge sphere mesh and renders video outputs (from AVPlayer) on it. What I want to do is rendering left portion of my video output on left eye, and right portion of my video output on right eye. In my fragment shader, I think I need to know that the thread in shader is for left eye or right eye. (I'm not using MV-hevc encoded video but just hevc encoded one) So, what I currently do is, I assume 'amplification_id' is for the thing which determines the side of eyes. But, I'm not sure this is correct.
2
0
678
Aug ’23
Scene Kit Rotation - rotating around X and Y axis only, causing Z rotation
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)
0
0
821
Dec ’23