Fix default lighting intensities in ModelViewer

They were waaay too high
This commit is contained in:
Romain Guy
2020-05-05 00:25:19 -07:00
parent 05def1a789
commit 3e5fe994b9
3 changed files with 13 additions and 13 deletions

View File

@@ -43,7 +43,7 @@ buildscript {
'minSdk': 19,
'targetSdk': 29,
'compileSdk': 29,
'kotlin': '1.3.71',
'kotlin': '1.3.72',
'buildTools': '29.0.3',
'ndk': '21.0.6113669'
]

View File

@@ -26,6 +26,13 @@ import com.google.android.filament.android.UiHelper
import com.google.android.filament.gltfio.*
import java.nio.Buffer
private const val kNearPlane = 0.5
private const val kFarPlane = 10000.0
private const val kFovDegrees = 45.0
private const val kAperture = 16f
private const val kShutterSpeed = 1f / 125f
private const val kSensitivity = 100f
/**
* Helps render glTF models into a [SurfaceView] or [TextureView] with an orbit controller.
*
@@ -84,13 +91,6 @@ class ModelViewer : android.view.View.OnTouchListener {
private val target = DoubleArray(3)
private val upward = DoubleArray(3)
private val kNearPlane = 0.5
private val kFarPlane = 10000.0
private val kFovDegrees = 45.0
private val kAperture = 16f
private val kShutterSpeed = 1f / 125f
private val kSensitivity = 100f
init {
engine = Engine.create()
renderer = engine.createRenderer()
@@ -111,7 +111,7 @@ class ModelViewer : android.view.View.OnTouchListener {
val (r, g, b) = Colors.cct(6_500.0f)
LightManager.Builder(LightManager.Type.DIRECTIONAL)
.color(r, g, b)
.intensity(300_000.0f)
.intensity(100_000.0f)
.direction(0.0f, -1.0f, 0.0f)
.castShadows(true)
.build(engine, light)

View File

@@ -64,13 +64,13 @@ class MainActivity : Activity() {
// enable dynamic resolution
val options = modelViewer.view.dynamicResolutionOptions
options.enabled = true;
modelViewer.view.dynamicResolutionOptions = options;
options.enabled = true
modelViewer.view.dynamicResolutionOptions = options
modelViewer.view.ambientOcclusion = View.AmbientOcclusion.SSAO
val bloom = modelViewer.view.bloomOptions
bloom.enabled = true;
bloom.enabled = true
modelViewer.view.bloomOptions = bloom
}
@@ -92,7 +92,7 @@ class MainActivity : Activity() {
val ibl = "venetian_crossroads_2k"
readCompressedAsset("envs/$ibl/${ibl}_ibl.ktx").let {
scene.indirectLight = KtxLoader.createIndirectLight(engine, it)
scene.indirectLight!!.intensity = 50_000.0f
scene.indirectLight!!.intensity = 30_000.0f
}
readCompressedAsset("envs/$ibl/${ibl}_skybox.ktx").let {
scene.skybox = KtxLoader.createSkybox(engine, it)