-
-
Notifications
You must be signed in to change notification settings - Fork 194
Open
Description
I am using Jetpack Compose Kotlin with SceneView (implementation("io.github.sceneview:sceneview:2.3.0")). I am running on a physical device. If I load the 3D model without its texture, it displays correctly. But when I load it with the texture, the model does not render properly, even though the 3D model itself is completely clean and without issues. It seems there is a problem in the library.




my Code :
// Filament 3D Engine
val engine = rememberEngine()
// Asset loaders
val modelLoader = rememberModelLoader(engine)
val materialLoader = rememberMaterialLoader(engine)
val environmentLoader = rememberEnvironmentLoader(engine)
val view = rememberView(engine)
// Créer la texture avec le bitmap inversé
val TexturePSG = ImageTexture.Builder()
.bitmap(
MainActivity.instance.assets.open(
"texture/texture.png"
).readBytes().decodeToImageBitmap().asAndroidBitmap()
)
.build(engine)
Scene(
modifier = Modifier.fillMaxSize(),
engine = engine,
// Core rendering components
view = view,
renderer = rememberRenderer(engine),
scene = rememberScene(engine),
// Asset loaders
modelLoader = modelLoader,
materialLoader = materialLoader,
environmentLoader = environmentLoader,
// Collision System
collisionSystem = rememberCollisionSystem(view) ,
// Add a direct light source (required for shadows)
mainLightNode = rememberMainLightNode(engine) { intensity = 100_000.0f },
// Set up environment lighting and skybox from an HDR file
environment = rememberEnvironment(environmentLoader) {
environmentLoader.createHDREnvironment(
assetFileLocation = "environments/sky.hdr"
)!!
},
// Configure camera position
cameraNode = rememberCameraNode(engine) {
position = Position(z = 4.0f)
},
// Enable user interaction with the camera
cameraManipulator = rememberCameraManipulator(),
// Add 3D models and objects to the scene
childNodes = rememberNodes {
// Add a glTF model
add(
ModelNode(
// Create a single instance model from assets file
modelInstance = modelLoader.createModelInstance(
assetFileLocation = "Tshert/a.glb"
),
// Make the model fit into a 1 unit cube
scaleToUnits = 1.0f
).apply {
// Define the Texture
this.setMaterialInstance(
materialInstance = materialLoader.createTextureInstance(
texture = TexturePSG
)
)
}
)
},
)
}
Metadata
Metadata
Assignees
Labels
No labels