Fix createDensityProfileLayer dropping passed in values.

Enable sky density panel to update advanced atmo precomputed textures.

Take wild stab at appropriate ranges for density parameters in edit panel UI.

Clean up debug-only code that isn't necessary anymore.

Point autobuild at latest version of libatmosphere package.
master
Graham Linden 2018-09-07 17:24:29 +01:00
parent 451ab80ca6
commit 4bd2b8b98b
8 changed files with 66 additions and 112 deletions

View File

@ -64,9 +64,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>722693009586e18aa4d611218c26c5e3</string>
<string>bca20bcdf1a2c26b16e71fb2c1316cbe</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/23969/184338/libatmosphere-1.0.0.100-darwin-519274.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/24187/188163/libatmosphere-1.0.0.100-darwin-519422.tar.bz2</string>
</map>
<key>name</key>
<string>darwin</string>
@ -76,9 +76,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>9ecdbb77a18a5dea905ebd3d7faf1f8f</string>
<string>9ce4c97f1eda8caa556573abd6e1ebd0</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/23968/184333/libatmosphere-1.0.0.100-darwin64-519274.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/24188/188166/libatmosphere-1.0.0.100-darwin64-519422.tar.bz2</string>
</map>
<key>name</key>
<string>darwin64</string>
@ -88,9 +88,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>05e113c2988bf77dcde7df0216c26481</string>
<string>6a61502ab1cca316f85310ded8bf9b9a</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/23971/184350/libatmosphere-1.0.0.100-windows-519274.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/24190/188181/libatmosphere-1.0.0.100-windows-519422.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>
@ -100,9 +100,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>1b5fcfbc0123263d68843ac4570c8204</string>
<string>496410cb43e03ddf1777cd295c2d5dba</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/23970/184345/libatmosphere-1.0.0.100-windows64-519274.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/24189/188175/libatmosphere-1.0.0.100-windows64-519422.tar.bz2</string>
</map>
<key>name</key>
<string>windows64</string>

View File

@ -573,11 +573,11 @@ LLSD LLSettingsSky::createDensityProfileLayer(
F32 aniso_factor)
{
LLSD dflt_layer;
dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere
dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f;
dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f;
dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f;
dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f;
dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = width; // 0 -> the entire atmosphere
dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = exponential_term;
dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = exponential_scale_factor;
dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = linear_term;
dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = constant_term;
if (aniso_factor != 0.0f)
{
@ -670,7 +670,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position)
dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f;
dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f;
dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f;
dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f;
dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f;
dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault();
dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault();
@ -1160,7 +1160,7 @@ F32 LLSettingsSky::getSunArcRadians() const
F32 LLSettingsSky::getMieAnisotropy() const
{
return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal();
return getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR].asReal();
}
LLSD LLSettingsSky::getRayleighConfig() const
@ -1183,20 +1183,17 @@ LLSD LLSettingsSky::getAbsorptionConfig() const
LLSD LLSettingsSky::getRayleighConfigs() const
{
LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray());
return copy;
return mSettings[SETTING_RAYLEIGH_CONFIG];
}
LLSD LLSettingsSky::getMieConfigs() const
{
LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray());
return copy;
return mSettings[SETTING_MIE_CONFIG];
}
LLSD LLSettingsSky::getAbsorptionConfigs() const
{
LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray());
return copy;
return mSettings[SETTING_ABSORPTION_CONFIG];
}
void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig)

View File

@ -232,26 +232,6 @@ LLAtmosphere::~LLAtmosphere()
m_model = nullptr;
}
#if DEBUG_ATMO_TEX_GEN
uint8_t* GetTexture2d(int width, int height, int components, GLuint texture)
{
glActiveTextureARB(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
uint8_t* storage = (uint8_t*)malloc(width * height * components * sizeof(float));
glGetTexImage(GL_TEXTURE_2D, 0, components == 3 ? GL_RGB : GL_RGBA, GL_FLOAT, storage);
return storage;
}
uint8_t* GetTexture3d(int width, int height, int depth, int components, GLuint texture)
{
glActiveTextureARB(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_3D, texture);
uint8_t* storage = (uint8_t*)malloc(width * height * depth * components * sizeof(float));
glGetTexImage(GL_TEXTURE_3D, 0, components == 3 ? GL_RGB : GL_RGBA, GL_FLOAT, storage);
return storage;
}
#endif
bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings)
{
if ((m_model != nullptr) && (settings == m_settings))
@ -271,8 +251,6 @@ bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings)
getIlluminance()->setTexName(0);
// Init libatmosphere model
m_config.num_scattering_orders = 4;
m_model = new atmosphere::Model(
m_config,
m_wavelengths,
@ -303,19 +281,7 @@ bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings)
getScattering()->setTexName(m_textures.scattering_texture);
getMieScattering()->setTexName(m_textures.single_mie_scattering_texture);
getIlluminance()->setTexName(m_textures.illuminance_texture);
#if DEBUG_ATMO_TEX_GEN
// for debug only...
U8* transmittance = GetTexture2d(m_config.transmittanceTextureWidth, m_config.transmittanceTextureHeight, 3, m_textures.transmittance_texture);
U8* scattering = GetTexture3d(m_config.scatteringTextureWidth, m_config.scatteringTextureHeight, m_config.scatteringTextureDepth, 3, m_textures.scattering_texture);
U8* single_mie_scattering = GetTexture3d(m_config.scatteringTextureWidth, m_config.scatteringTextureHeight, m_config.scatteringTextureDepth, 3, m_textures.single_mie_scattering_texture);
U8* illuminance = GetTexture2d(m_config.illuminanceTextureWidth, m_config.illuminanceTextureHeight, 3, m_textures.illuminance_texture);
free(transmittance);
free(scattering);
free(single_mie_scattering);
free(illuminance);
#endif
m_settings = settings;
}
return m_model != nullptr;

View File

@ -36,8 +36,8 @@ VARYING vec2 vary_frag;
void main()
{
// pass through untransformed fullscreen pos (clipspace)
gl_Position = vec4(position.xyz, 1.0);
// pass through untransformed fullscreen pos at back of frustum for proper sky depth testing
gl_Position = vec4(position.xy, 0.99f, 1.0);
vary_frag = texcoord0;
}

View File

@ -505,22 +505,19 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
if (gPipeline.canUseWindLightShaders())
{
if (gPipeline.useAdvancedAtmospherics())
{
renderSkyHazeDeferred(origin, camHeightLocal);
renderHeavenlyBodies();
}
else
{
// Disable depth-test for sky, but re-enable depth writes for the cloud
// rendering below so the cloud shader can write out depth for the stars to test against
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
if (gPipeline.useAdvancedAtmospherics())
{
renderSkyHazeDeferred(origin, camHeightLocal);
}
else
{
renderSkyHaze(origin, camHeightLocal);
}
renderHeavenlyBodies();
renderSkyHaze(origin, camHeightLocal);
renderHeavenlyBodies();
}
renderSkyClouds(origin, camHeightLocal);
}
gGL.setColorMask(true, true);

View File

@ -358,6 +358,7 @@ void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settin
layer.width = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal();
settingsOut.m_mieProfile.push_back(layer);
}
settingsOut.m_mieAnisotropy = psky->getMieAnisotropy();
LLSD absorption = psky->getAbsorptionConfigs();
settingsOut.m_absorptionProfile.clear();
@ -1633,15 +1634,12 @@ void LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky)
mSky->update();
mBlenderSky.reset();
#if 0
if (gAtmosphere)
{
AtmosphericModelSettings settings;
LLEnvironment::getAtmosphericModelSettings(settings, psky);
gAtmosphere->configureAtmosphericModel(settings);
}
#endif
}
void LLEnvironment::DayInstance::setWater(const LLSettingsWater::ptr_t &pwater)

View File

@ -662,15 +662,12 @@ void LLPanelSettingsSkyDensityTab::updateProfile()
mSkySettings->update();
setIsDirty();
/*
if (gAtmosphere)
{
AtmosphericModelSettings atmospheric_settings;
LLEnvironment::getAtmosphericModelSettings(atmospheric_settings, mSkySettings);
gAtmosphere->configureAtmosphericModel(atmospheric_settings);
}
*/
}
void LLPanelSettingsSkyDensityTab::onRayleighExponentialChanged()

View File

@ -24,10 +24,10 @@
visible="true"
height="14">
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
left_delta="5"
@ -40,38 +40,38 @@
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.000001"
initial_value="0"
layout="topleft"
min_val="-1"
max_val="1"
min_val="-0.01"
max_val="0.01"
name="rayleigh_exponential_scale"
label="Rayleigh Exponential Scale:"
width="400"
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.000001"
initial_value="0"
layout="topleft"
min_val="0"
max_val="1"
max_val="0.00001"
name="rayleigh_linear"
label="Rayleigh Linear Term:"
width="400"
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
min_val="0"
@ -82,10 +82,9 @@
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="1"
follows="left|top"
height="14"
increment="1"
initial_value="0"
layout="topleft"
min_val="1000"
@ -104,10 +103,10 @@
visible="true"
height="16">
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
left_delta="5"
@ -120,42 +119,42 @@
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
min_val="-1"
max_val="1"
min_val="-0.01"
max_val="0.01"
name="mie_exponential_scale"
label="Mie Exponential Scale:"
width="400"
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.000001"
initial_value="0"
layout="topleft"
min_val="0"
max_val="3.0"
max_val="0.000004"
name="mie_linear"
label="Mie Linear Term:"
width="400"
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
min_val="0"
max_val="10"
max_val="1"
name="mie_constant"
label="Mie Constant Term:"
width="400"
@ -176,10 +175,10 @@
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="1"
follows="left|top"
height="14"
increment="1"
increment="0.1"
initial_value="0"
layout="topleft"
min_val="1000"
@ -198,10 +197,10 @@
visible="true"
height="14">
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
left_delta="5"
@ -214,10 +213,10 @@
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
min_val="-1"
@ -228,10 +227,10 @@
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
min_val="0"
@ -242,10 +241,10 @@
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="6"
follows="left|top"
height="14"
increment="0.01"
increment="0.0000001"
initial_value="0"
layout="topleft"
min_val="0"
@ -256,10 +255,10 @@
label_width="160"
can_edit_text="true"/>
<slider
decimal_digits="2"
decimal_digits="1"
follows="left|top"
height="14"
increment="1"
increment="0.1"
initial_value="0"
layout="topleft"
min_val="1000"