Skip to content

Instantly share code, notes, and snippets.

@prideout
Created April 3, 2020 01:08
Show Gist options
  • Save prideout/00411c80f9b6dc3621afff62f3866049 to your computer and use it in GitHub Desktop.
Save prideout/00411c80f9b6dc3621afff62f3866049 to your computer and use it in GitHub Desktop.
getting-started-ibl
override fun onCreate(savedInstanceState: Bundle?) {
// ...
loadGlb("DamagedHelmet")
loadEnvironment("venetian_crossroads_2k")
}
private fun loadEnvironment(ibl: String) {
// Create the indirect light source and add it to the scene.
var buffer = readAsset("envs/$ibl/${ibl}_ibl.ktx")
KtxLoader.createIndirectLight(modelViewer.engine, buffer).apply {
intensity = 50_000f
modelViewer.scene.indirectLight = this
}
// Create the sky box and add it to the scene.
buffer = readAsset("envs/$ibl/${ibl}_skybox.ktx")
KtxLoader.createSkybox(modelViewer.engine, buffer).apply {
modelViewer.scene.skybox = this
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment