var body: some View {
RealityView { content in
// Add the Model content
if let modelEntity = try? await Entity(named: "Victorian_Living_Room", in: realityKitContentBundle) {
content.add(immersiveContentEntity)
// Add an ImageBasedLight for the immersive content
guard let resource = try? await EnvironmentResource(named: "shiwai_a") else { return }
//An ImageBasedLightReceiverComponent has been set up for this entity, which enables the entity to receive image-based lighting.
let iblComponent = ImageBasedLightComponent(source: .single(resource), intensityExponent: 0.25)
modelEntity.components.set(iblComponent)
modelEntity.components.set(ImageBasedLightReceiverComponent(imageBasedLight: modelEntity))
}
}
}
}
Topic:
Graphics & Games
SubTopic:
RealityKit
Tags: