It should be red output whatever ImageFile be set.
Post
Replies
Boosts
Views
Activity
Temporarily solved by using TextureResource.init dimensions 3D with r16Float raw pixelFormat. Successfully set runtime dynamic volume texture parameter on ShaderGraphMaterial.
Also tried create 3D texture from PNG images and set parameter on ShaderGraphMaterial. But still not work. Image3D/Image3DPixel output always white, Image3DRead output always black.
var images: [CGImage] = []
for i in 0..<32 {
let image = UIImage(named: "\(i).png")!.cgImage!
images.append(image)
}
let tex = try! await TextureResource.texture3D(slices: images, options: TextureResource.CreateOptions(semantic: .color))
let entity = scene.findEntity(named: "Slice")!
var material = entity.components[ModelComponent.self]!.materials.first as! ShaderGraphMaterial
try! material.setParameter(name: "Volume", value: .textureResource(tex))
So, likely the problem does not come from the KTX file, but Realitykit does not support Image3D yet?
Typo:
for _ in range(1) should be for _ in range(size)