val inputStream = requireContext().resources.openRawResource(R.raw.kicker_texture_blue)
var bitmap = BitmapFactory.decodeStream(inputStream)
val texture = createTextureFromBitmap(engine, bitmap)
objectNode.renderableNodes.find { it.name == target }?.apply {
Log.d("3DT", "SceneHolder: found $target node")
Log.d("3DT", "SceneHolder: ${materialInstances}")
materialInstance.setExternalTexture(texture)
// This works, but I lose the reflectance and metallic properties of the original texture
// setMaterialInstances(materialLoader.createTextureInstance(texture))
}
but I get a crash:
Panic
in getSamplerInfo:97
reason: sampler named "texture" not found
What could be the reason for this? setMaterialInstances(materialLoader.createTextureInstance(texture)) works fine.
I am trying to replace the texture of a model with an image using the following code:
but I get a crash:
What could be the reason for this?
setMaterialInstances(materialLoader.createTextureInstance(texture))
works fine.