Add intensity property to solar imagery

This commit is contained in:
Emil Axelsson
2019-10-23 14:18:53 +02:00
parent b220bdcbae
commit 570455be82
7 changed files with 32 additions and 8 deletions

View File

@@ -68,6 +68,11 @@ namespace {
"Enable frustum",
"Enables frustum around the current spacecraft imagery"
};
static const openspace::properties::Property::PropertyInfo MultiplierValueInfo = {
"multiplierValue",
"Multiplier",
"Multiplier for imagery intensity, applied before gamma, contrast and lut"
};
static const openspace::properties::Property::PropertyInfo GammaValueInfo = {
"gammaValue",
"Gamma",
@@ -103,6 +108,7 @@ RenderableSolarImagery::RenderableSolarImagery(const ghoul::Dictionary& dictiona
, _contrastValue(ContrastValueInfo, 0.f, -15.f, 15.f)
, _enableBorder(EnableBorderInfo, false)
, _enableFrustum(EnableFrustumInfo, false)
, _multiplierValue(MultiplierValueInfo, 1.f, 0.f, 10.f)
, _gammaValue(GammaValueInfo, 0.9f, 0.1f, 10.f)
, _moveFactor(MoveFactorInfo, 1.0, 0.0, 1.0)
, _planeOpacity(PlaneOpacityInfo, 1.f, 0.f, 1.f)
@@ -152,6 +158,7 @@ RenderableSolarImagery::RenderableSolarImagery(const ghoul::Dictionary& dictiona
addProperty(_enableBorder);
addProperty(_enableFrustum);
addProperty(_activeInstruments);
addProperty(_multiplierValue);
addProperty(_gammaValue);
addProperty(_contrastValue);
addProperty(_downsamplingLevel);
@@ -215,6 +222,10 @@ const SpacecraftCameraPlane& RenderableSolarImagery::getCameraPlane() {
return *_spacecraftCameraPlane;
}
float RenderableSolarImagery::getMultiplierValue() {
return _multiplierValue;
}
float RenderableSolarImagery::getContrastValue() {
return _contrastValue;
}
@@ -326,6 +337,7 @@ void RenderableSolarImagery::render(const RenderData& data, RendererTasks&) {
_lut,
sunPositionWorld,
_planeOpacity,
_multiplierValue,
_contrastValue,
_gammaValue,
_enableBorder,

View File

@@ -63,6 +63,7 @@ public:
TransferFunction* getTransferFunction();
const std::unique_ptr<ghoul::opengl::Texture>& getImageryTexture();
const SpacecraftCameraPlane& getCameraPlane();
float getMultiplierValue();
float getContrastValue();
float getGammaValue();
float getImageResolutionFactor();
@@ -75,6 +76,7 @@ private:
properties::FloatProperty _contrastValue;
properties::BoolProperty _enableBorder;
properties::BoolProperty _enableFrustum;
properties::FloatProperty _multiplierValue;
properties::FloatProperty _gammaValue;
properties::DoubleProperty _moveFactor;
properties::FloatProperty _planeOpacity;

View File

@@ -153,6 +153,7 @@ void RenderableSolarImageryProjection::render(const RenderData& data, RendererTa
_shader->setUniform("planePositionSpacecraft[" + std::to_string(i) + "]",
glm::dvec3(planeRot * glm::dvec4(planePos, 1.0)));
_shader->setUniform("gammaValue[" + std::to_string(i) + "]", solarImagery->getGammaValue());
_shader->setUniform("multiplierValue[" + std::to_string(i) + "]", solarImagery->getMultiplierValue());
_shader->setUniform("contrastValue[" + std::to_string(i) + "]", solarImagery->getContrastValue());
_shader->setUniform("scale[" + std::to_string(i) + "]", solarImagery->getScale());
_shader->setUniform("centerPixel[" + std::to_string(i) + "]", solarImagery->getCenterPixel());

View File

@@ -205,11 +205,16 @@ void SpacecraftCameraPlane::createFrustum() {
void SpacecraftCameraPlane::render(const RenderData& data,
ghoul::opengl::Texture& imageryTexture,
TransferFunction* lut,
const glm::dvec3& sunPositionWorld, float planeOpacity,
float contrastValue, float gammaValue,
bool enableBorder, bool enableFrustum,
const glm::dvec3& sunPositionWorld,
float planeOpacity,
float multiplierValue,
float contrastValue,
float gammaValue,
bool enableBorder,
bool enableFrustum,
const glm::vec2& currentCenterPixel,
float currentScale, float multipleImageryOffset,
float currentScale,
float multipleImageryOffset,
bool isCoronaGraph)
{
glEnable(GL_CULL_FACE);
@@ -255,6 +260,7 @@ void SpacecraftCameraPlane::render(const RenderData& data,
_planeShader->setUniform("centerPixel", currentCenterPixel);
_planeShader->setUniform("imageryTexture", imageUnit);
_planeShader->setUniform("planeOpacity", planeOpacity);
_planeShader->setUniform("multiplierValue", multiplierValue);
_planeShader->setUniform("gammaValue", gammaValue);
_planeShader->setUniform("contrastValue", contrastValue);
_planeShader->setUniform(

View File

@@ -43,8 +43,8 @@ public:
void render(const RenderData& data, ghoul::opengl::Texture& imageryTexture,
TransferFunction* lut, const glm::dvec3& sunPositionWorld, float planeOpacity,
float contrastValue, float gammaValue, bool enableBorder, bool enableFrustum,
const glm::vec2& currentCenterPixel, float currentScale,
float multiplierValue, float contrastValue, float gammaValue, bool enableBorder,
bool enableFrustum, const glm::vec2& currentCenterPixel, float currentScale,
float multipleImageryOffset, bool isCoronaGraph);
void update();

View File

@@ -25,6 +25,7 @@ uniform sampler2D imageryTexture;
uniform sampler1D lut;
uniform bool additiveBlending;
uniform float multiplierValue;
uniform float contrastValue;
uniform float gammaValue;
uniform float planeOpacity;
@@ -42,7 +43,7 @@ float contrast(float intensity) {
Fragment getFragment() {
float intensityOrg = texture(imageryTexture, vec2(vs_st.x, 1 - vs_st.y)).r;
intensityOrg = contrast(intensityOrg);
intensityOrg = contrast(intensityOrg * multiplierValue);
vec4 outColor;
if (hasLut) {

View File

@@ -41,6 +41,7 @@ uniform bool isEnabled[MAX_SPACECRAFT_OBSERVATORY];
uniform bool isCoronaGraph[MAX_SPACECRAFT_OBSERVATORY];
uniform float scale[MAX_SPACECRAFT_OBSERVATORY];
uniform vec2 centerPixel[MAX_SPACECRAFT_OBSERVATORY];
uniform float multiplierValue[MAX_SPACECRAFT_OBSERVATORY];
const float SUN_RADIUS = 1391600000 * 0.5;
@@ -68,7 +69,8 @@ Fragment getFragment() {
uv.y -= ((centerPixel[i].y) / SUN_RADIUS) / 2.0;
float intensityOrg = texture(imageryTexture[i], vec2(uv.x, 1.0 - uv.y)).r;
intensityOrg = contrast(intensityOrg, i);
float multipliedIntensity = multiplierValue[i] * intensityOrg;
intensityOrg = contrast(multipliedIntensity, i);
vec4 res;
if (hasLut[i]) {