fix: model having wrong turbidity value

This commit is contained in:
minjaesong
2023-07-10 23:14:56 +09:00
parent f0fa5830bd
commit 2b62b4f413
3 changed files with 6 additions and 10 deletions

View File

@@ -211,9 +211,9 @@ class Application(val WIDTH: Int, val HEIGHT: Int) : Game() {
oneScreen = Pixmap(outTexWidth, outTexHeight, Pixmap.Format.RGBA8888)
DatasetSpectral
// DatasetSpectral
DatasetCIEXYZ
DatasetRGB
// DatasetRGB
ApplicationController(this)
}

View File

@@ -82,7 +82,7 @@ object Skybox : Disposable {
val elevationDeg = (it / turbCnt).plus(elevations.first).toDouble()
val elevationRad = Math.toRadians(elevationDeg)
val turbidity = 1.0 + (it % turbCnt) / 100.0
val turbidity = 1.0 + (it % turbCnt) / 2.0
val state = ArHosekSkyModel.arhosek_xyz_skymodelstate_alloc_init(turbidity, albedo, elevationRad.abs())
val pixmap = Pixmap(1, gradSize, Pixmap.Format.RGBA8888)

View File

@@ -147,7 +147,7 @@ internal object WeatherMixer : RNGConsumer {
}
private var turbidity = 2.0
private var turbidity = 4.0
private var gH = 2f * App.scr.height
private val HALF_DAY = DAY_LENGTH / 2
@@ -158,7 +158,6 @@ internal object WeatherMixer : RNGConsumer {
val parallaxZeroPos = (world.height / 3f)
val parallaxDomainSize = world.height / 6f
// we will not care for nextSkybox for now
val timeNow = (forceTimeAt ?: world.worldTime.TIME_T.toInt()) % WorldTime.DAY_LENGTH
val daylightClut = currentWeather.daylightClut
@@ -166,7 +165,6 @@ internal object WeatherMixer : RNGConsumer {
val globalLight = getGradientColour2(daylightClut, world.worldTime.solarElevationDeg, timeNow)
globalLightNow.set(globalLight)
/* (copied from the shader source)
UV mapping coord.y
@@ -190,8 +188,8 @@ internal object WeatherMixer : RNGConsumer {
val degThis = deg.floor()
val degNext = degThis + if (timeNow < HALF_DAY) 1 else -1 // Skybox.get has internal coerceIn
val texture1 = Skybox.get(degThis, turbidity)
val texture2 = Skybox.get(degNext, turbidity)
val texture1 = Skybox[degThis, turbidity]
val texture2 = Skybox[degNext, turbidity]
val lerpScale = (if (timeNow < HALF_DAY) deg - degThis else 1f - (deg - degThis)).toFloat()
val gradY = -(gH - App.scr.height) * ((parallax + 1f) / 2f)
@@ -209,8 +207,6 @@ internal object WeatherMixer : RNGConsumer {
}
fun Float.clampOne() = if (this > 1) 1f else this
private operator fun Color.times(other: Color) = Color(this.r * other.r, this.g * other.g, this.b * other.b, 1f)
fun colorMix(one: Color, two: Color, scale: Float): Color {