Post

Replies

Boosts

Views

Activity

Reply to Surface shader can't get opacity from the texture
Sure, here's the complete code Sure var triMat = SimpleMaterial(color: .orange, isMetallic: false) triMat.color = SimpleMaterial.BaseColor( tint: .white.withAlphaComponent(0.9), texture: MaterialParameters.Texture(try! .load(named: "whity_4x4"))) self.components[ModelComponent.self] = try! ModelComponent(mesh: .generate(from: [meshDesc]), materials: [triMat]) guard let device = MTLCreateSystemDefaultDevice() else { fatalError("Error creating default metal device.") } let library = device.makeDefaultLibrary()! let geomShader = CustomMaterial.GeometryModifier(named: "billboard", in: library) let surfaceShader = CustomMaterial.SurfaceShader(named: "scroll", in: library) var customMaterials:[RealityKit.Material] = [] let materials = self.model?.materials for material in materials! { var material = try? CustomMaterial(from: material, surfaceShader: surfaceShader, geometryModifier: geomShader) //these custom values are to define the speed and direction of the scrolling material?.custom.value[0] = 100 material?.custom.value[1] = 4 material?.custom.value[2] = 4 customMaterials.append(material!) } self.model?.materials = customMaterials Hmm, are you saying that for opacity there should be another texture like normal texture? and we can't get the alpha value from the RGBA texture?
Topic: Graphics & Games SubTopic: General Tags:
Jul ’23
Reply to Entity rotation animation doesn't go beyond 180 degree?
Hi, I mean if I try to rotate 1.5 pi, I get 90 degree counter clockwise, .pi I get 180 degree rotation clockwise. I guess it only rotates the difference, so if I try to rotate 4 pi (I assume this will rotate 360 twice) this will not rotate anything as this is basically 0 degree, Any idea on how to approach rotation in animation that doesn't involve repeating the move method?
Topic: Graphics & Games SubTopic: RealityKit Tags:
Jul ’23