Post

Replies

Boosts

Views

Activity

Can Materials not assigned to entities be retrieved from a .reality file?
like: let mat = try await ShaderGraphMaterial(named: "matname", from: "reality") currently I use an USD file with materials like so and it works: try await ShaderGraphMaterial(named: "/Root/matname", from: "file.usda", in: appBundle) when i try it with .reality i get "NameNotFound". so is it possible or do i have to have a bunch of dummy entities with my materials assigned so i can find the entity>components>material? or what's the best way to author materials in RCP3 for quick access in realitykit?
3
0
1.9k
3w
Is there a working example for Fog post effect for non AR game?
i can read the depth and mix it with the rendered image and get a linear fog effect but I can't get a true radial fog. I've been going back and forth with gemini and chatgpt and neither can do it. gemini got me a radial gradient but it's jsut projected flat across all 3d objects. it's been all day trial after trial this is what gives me the flat radial gradient using namespace metal; struct DepthFogEffectConstants { float4 fogColor; float density; // We no longer need the inverse projection matrix here! }; kernel void depthFogKernel( texture2d<half, access::read> inColor [[texture(0)]], texture2d<float, access::read> inDepth [[texture(1)]], texture2d<half, access::write> outColor [[texture(2)]], constant DepthFogEffectConstants& uniforms [[buffer(0)]], uint2 gid [[thread_position_in_grid]]) { float w = outColor.get_width(); float h = outColor.get_height(); if (gid.x >= w || gid.y >= h) { return; } half4 originalColor = inColor.read(gid); float rawDepth = inDepth.read(gid).r; // 1. Guard check for empty backgrounds/skyboxes if (rawDepth <= 0.00001f || rawDepth >= 0.9999f) { outColor.write(originalColor, gid); return; } // 2. Map screen pixels from the center of the lens (-1.0 to 1.0) float2 screenPos = float2( ((float(gid.x) / w) * 2.0f) - 1.0f, 1.0f - ((float(gid.y) / h) * 2.0f) ); // 3. Since rawDepth is already acting as a view-space Z proxy, // we use it to calculate the true spherical ray distance from the lens center. // The hypotenuse of screen offset (X, Y) and depth (Z) gives the radial distance. float radialDistance = sqrt(screenPos.x * screenPos.x + screenPos.y * screenPos.y + rawDepth * rawDepth); // 4. Calculate exponential fog matching your visual test float fogFactor32 = exp(-radialDistance * uniforms.density); half fogFactor = half(clamp(fogFactor32, 0.0f, 1.0f)); half4 fogColor = half4(uniforms.fogColor); // Mix and write colors out cleanly half4 finalColor = mix(fogColor, originalColor, fogFactor); outColor.write(radialDistance, gid); } in this code i'm just outputing the radial distance to see that calculation and it's just wrong. i don't know what to do anymore
1
1
1.5k
3w
How to play Vorbis/OGG files with swift?
Does anyone have a working example on how to play OGG files with swift? I've been trying for over a year now. I was able to wrap the C Vorbis library in swift. I then used it to parse an OGG file successfully. Then I was required to use Obj-C&#92;&#43;+ to fill the PCM because this method seems to only be available in C&#92;&#43;+ and that part hangs my app for a good 40 seconds to several minutes depending on the audio file, it then plays for about 2 seconds and then crashes. I can't get the examples on the Vorbis site to work in objective-c and i tried every example on github I could find (most of which are for iOS - I want to play the files on mac) I also tried using Cricket Audio framework below. https://github.com/sjmerel/ck It has a swift example and it can play their proprietary soundbank format but it is also supposed to play OGG and it just doesn't do anything when trying to play OGG as you can see in the posted issue https://github.com/sjmerel/ck/issues/3 Right now I believe every player that can play OGGs on mac is written in Objective-C or C++. Anyway, any help/advice is appreciated. OGG format is very prevalent in the gaming community. I could use unity, which I believe plays oggs through the mono framework but I really really want to stay in swift.
2
0
5.3k
Jul ’25
developer.apple.com slow/unresponsive after a few minutes from logging in
Whenever I'm on this site on Safari and I log in, after a little while pages will load very very slow or not at all and reeplies to posts will fail over and over. In general this website becomes unusable under safari and upon restarting (i can't just log out because that won't work either) Safari, everything works again. This affects the documentation pages too, not just the forums. So I'll quit, log in, try to put in my post as fast as possible before I can't anymore. I usually copy and paste my post before hitting submit incase my time has ran out.
3
0
2k
Oct ’23
cannot preview in this - unexpected error occurred
i haven't even edited the template file and this happens. steps: Create visonOS app from template the immersive view previews and it show 3d objects Select the realitykit package and Click 'open in reality composer pro' Change color of material and save go back to xcode result: file no longer previews and i get the error in the title like that's it, how do i edit 3d files?
0
0
795
Jun ’23
How do i get multiple UV Channels into SceneKit from Cinema 4D?
This is really frustrating. i know in SceneKit editor in Xcode there is an option to select a uv channel to apply a texture to, but i can't see how to bring in a model with multiple UVs i'm working in cinema 4d, i can add multiple uv tags and export as FBX and it keeps multiple UV channels intact. But i can't import FBX into SceneKit. Other formats like USD (ugh), Collada, etc only keep 1 channel map. does anyone know the correct workflow to go from C4D to SceneKit with multiple maps per model?
2
0
1.9k
Feb ’22
Can Materials not assigned to entities be retrieved from a .reality file?
like: let mat = try await ShaderGraphMaterial(named: "matname", from: "reality") currently I use an USD file with materials like so and it works: try await ShaderGraphMaterial(named: "/Root/matname", from: "file.usda", in: appBundle) when i try it with .reality i get "NameNotFound". so is it possible or do i have to have a bunch of dummy entities with my materials assigned so i can find the entity>components>material? or what's the best way to author materials in RCP3 for quick access in realitykit?
Replies
3
Boosts
0
Views
1.9k
Activity
3w
Is there a working example for Fog post effect for non AR game?
i can read the depth and mix it with the rendered image and get a linear fog effect but I can't get a true radial fog. I've been going back and forth with gemini and chatgpt and neither can do it. gemini got me a radial gradient but it's jsut projected flat across all 3d objects. it's been all day trial after trial this is what gives me the flat radial gradient using namespace metal; struct DepthFogEffectConstants { float4 fogColor; float density; // We no longer need the inverse projection matrix here! }; kernel void depthFogKernel( texture2d<half, access::read> inColor [[texture(0)]], texture2d<float, access::read> inDepth [[texture(1)]], texture2d<half, access::write> outColor [[texture(2)]], constant DepthFogEffectConstants& uniforms [[buffer(0)]], uint2 gid [[thread_position_in_grid]]) { float w = outColor.get_width(); float h = outColor.get_height(); if (gid.x >= w || gid.y >= h) { return; } half4 originalColor = inColor.read(gid); float rawDepth = inDepth.read(gid).r; // 1. Guard check for empty backgrounds/skyboxes if (rawDepth <= 0.00001f || rawDepth >= 0.9999f) { outColor.write(originalColor, gid); return; } // 2. Map screen pixels from the center of the lens (-1.0 to 1.0) float2 screenPos = float2( ((float(gid.x) / w) * 2.0f) - 1.0f, 1.0f - ((float(gid.y) / h) * 2.0f) ); // 3. Since rawDepth is already acting as a view-space Z proxy, // we use it to calculate the true spherical ray distance from the lens center. // The hypotenuse of screen offset (X, Y) and depth (Z) gives the radial distance. float radialDistance = sqrt(screenPos.x * screenPos.x + screenPos.y * screenPos.y + rawDepth * rawDepth); // 4. Calculate exponential fog matching your visual test float fogFactor32 = exp(-radialDistance * uniforms.density); half fogFactor = half(clamp(fogFactor32, 0.0f, 1.0f)); half4 fogColor = half4(uniforms.fogColor); // Mix and write colors out cleanly half4 finalColor = mix(fogColor, originalColor, fogFactor); outColor.write(radialDistance, gid); } in this code i'm just outputing the radial distance to see that calculation and it's just wrong. i don't know what to do anymore
Replies
1
Boosts
1
Views
1.5k
Activity
3w
How to play Vorbis/OGG files with swift?
Does anyone have a working example on how to play OGG files with swift? I've been trying for over a year now. I was able to wrap the C Vorbis library in swift. I then used it to parse an OGG file successfully. Then I was required to use Obj-C&#92;&#43;+ to fill the PCM because this method seems to only be available in C&#92;&#43;+ and that part hangs my app for a good 40 seconds to several minutes depending on the audio file, it then plays for about 2 seconds and then crashes. I can't get the examples on the Vorbis site to work in objective-c and i tried every example on github I could find (most of which are for iOS - I want to play the files on mac) I also tried using Cricket Audio framework below. https://github.com/sjmerel/ck It has a swift example and it can play their proprietary soundbank format but it is also supposed to play OGG and it just doesn't do anything when trying to play OGG as you can see in the posted issue https://github.com/sjmerel/ck/issues/3 Right now I believe every player that can play OGGs on mac is written in Objective-C or C++. Anyway, any help/advice is appreciated. OGG format is very prevalent in the gaming community. I could use unity, which I believe plays oggs through the mono framework but I really really want to stay in swift.
Replies
2
Boosts
0
Views
5.3k
Activity
Jul ’25
developer.apple.com slow/unresponsive after a few minutes from logging in
Whenever I'm on this site on Safari and I log in, after a little while pages will load very very slow or not at all and reeplies to posts will fail over and over. In general this website becomes unusable under safari and upon restarting (i can't just log out because that won't work either) Safari, everything works again. This affects the documentation pages too, not just the forums. So I'll quit, log in, try to put in my post as fast as possible before I can't anymore. I usually copy and paste my post before hitting submit incase my time has ran out.
Replies
3
Boosts
0
Views
2k
Activity
Oct ’23
cannot preview in this - unexpected error occurred
i haven't even edited the template file and this happens. steps: Create visonOS app from template the immersive view previews and it show 3d objects Select the realitykit package and Click 'open in reality composer pro' Change color of material and save go back to xcode result: file no longer previews and i get the error in the title like that's it, how do i edit 3d files?
Replies
0
Boosts
0
Views
795
Activity
Jun ’23
How do i get multiple UV Channels into SceneKit from Cinema 4D?
This is really frustrating. i know in SceneKit editor in Xcode there is an option to select a uv channel to apply a texture to, but i can't see how to bring in a model with multiple UVs i'm working in cinema 4d, i can add multiple uv tags and export as FBX and it keeps multiple UV channels intact. But i can't import FBX into SceneKit. Other formats like USD (ugh), Collada, etc only keep 1 channel map. does anyone know the correct workflow to go from C4D to SceneKit with multiple maps per model?
Replies
2
Boosts
0
Views
1.9k
Activity
Feb ’22