mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 04:20:14 -05:00
Add intensity property to solar imagery
This commit is contained in:
@@ -68,6 +68,11 @@ namespace {
|
|||||||
"Enable frustum",
|
"Enable frustum",
|
||||||
"Enables frustum around the current spacecraft imagery"
|
"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 = {
|
static const openspace::properties::Property::PropertyInfo GammaValueInfo = {
|
||||||
"gammaValue",
|
"gammaValue",
|
||||||
"Gamma",
|
"Gamma",
|
||||||
@@ -103,6 +108,7 @@ RenderableSolarImagery::RenderableSolarImagery(const ghoul::Dictionary& dictiona
|
|||||||
, _contrastValue(ContrastValueInfo, 0.f, -15.f, 15.f)
|
, _contrastValue(ContrastValueInfo, 0.f, -15.f, 15.f)
|
||||||
, _enableBorder(EnableBorderInfo, false)
|
, _enableBorder(EnableBorderInfo, false)
|
||||||
, _enableFrustum(EnableFrustumInfo, false)
|
, _enableFrustum(EnableFrustumInfo, false)
|
||||||
|
, _multiplierValue(MultiplierValueInfo, 1.f, 0.f, 10.f)
|
||||||
, _gammaValue(GammaValueInfo, 0.9f, 0.1f, 10.f)
|
, _gammaValue(GammaValueInfo, 0.9f, 0.1f, 10.f)
|
||||||
, _moveFactor(MoveFactorInfo, 1.0, 0.0, 1.0)
|
, _moveFactor(MoveFactorInfo, 1.0, 0.0, 1.0)
|
||||||
, _planeOpacity(PlaneOpacityInfo, 1.f, 0.f, 1.f)
|
, _planeOpacity(PlaneOpacityInfo, 1.f, 0.f, 1.f)
|
||||||
@@ -152,6 +158,7 @@ RenderableSolarImagery::RenderableSolarImagery(const ghoul::Dictionary& dictiona
|
|||||||
addProperty(_enableBorder);
|
addProperty(_enableBorder);
|
||||||
addProperty(_enableFrustum);
|
addProperty(_enableFrustum);
|
||||||
addProperty(_activeInstruments);
|
addProperty(_activeInstruments);
|
||||||
|
addProperty(_multiplierValue);
|
||||||
addProperty(_gammaValue);
|
addProperty(_gammaValue);
|
||||||
addProperty(_contrastValue);
|
addProperty(_contrastValue);
|
||||||
addProperty(_downsamplingLevel);
|
addProperty(_downsamplingLevel);
|
||||||
@@ -215,6 +222,10 @@ const SpacecraftCameraPlane& RenderableSolarImagery::getCameraPlane() {
|
|||||||
return *_spacecraftCameraPlane;
|
return *_spacecraftCameraPlane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float RenderableSolarImagery::getMultiplierValue() {
|
||||||
|
return _multiplierValue;
|
||||||
|
}
|
||||||
|
|
||||||
float RenderableSolarImagery::getContrastValue() {
|
float RenderableSolarImagery::getContrastValue() {
|
||||||
return _contrastValue;
|
return _contrastValue;
|
||||||
}
|
}
|
||||||
@@ -326,6 +337,7 @@ void RenderableSolarImagery::render(const RenderData& data, RendererTasks&) {
|
|||||||
_lut,
|
_lut,
|
||||||
sunPositionWorld,
|
sunPositionWorld,
|
||||||
_planeOpacity,
|
_planeOpacity,
|
||||||
|
_multiplierValue,
|
||||||
_contrastValue,
|
_contrastValue,
|
||||||
_gammaValue,
|
_gammaValue,
|
||||||
_enableBorder,
|
_enableBorder,
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public:
|
|||||||
TransferFunction* getTransferFunction();
|
TransferFunction* getTransferFunction();
|
||||||
const std::unique_ptr<ghoul::opengl::Texture>& getImageryTexture();
|
const std::unique_ptr<ghoul::opengl::Texture>& getImageryTexture();
|
||||||
const SpacecraftCameraPlane& getCameraPlane();
|
const SpacecraftCameraPlane& getCameraPlane();
|
||||||
|
float getMultiplierValue();
|
||||||
float getContrastValue();
|
float getContrastValue();
|
||||||
float getGammaValue();
|
float getGammaValue();
|
||||||
float getImageResolutionFactor();
|
float getImageResolutionFactor();
|
||||||
@@ -75,6 +76,7 @@ private:
|
|||||||
properties::FloatProperty _contrastValue;
|
properties::FloatProperty _contrastValue;
|
||||||
properties::BoolProperty _enableBorder;
|
properties::BoolProperty _enableBorder;
|
||||||
properties::BoolProperty _enableFrustum;
|
properties::BoolProperty _enableFrustum;
|
||||||
|
properties::FloatProperty _multiplierValue;
|
||||||
properties::FloatProperty _gammaValue;
|
properties::FloatProperty _gammaValue;
|
||||||
properties::DoubleProperty _moveFactor;
|
properties::DoubleProperty _moveFactor;
|
||||||
properties::FloatProperty _planeOpacity;
|
properties::FloatProperty _planeOpacity;
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ void RenderableSolarImageryProjection::render(const RenderData& data, RendererTa
|
|||||||
_shader->setUniform("planePositionSpacecraft[" + std::to_string(i) + "]",
|
_shader->setUniform("planePositionSpacecraft[" + std::to_string(i) + "]",
|
||||||
glm::dvec3(planeRot * glm::dvec4(planePos, 1.0)));
|
glm::dvec3(planeRot * glm::dvec4(planePos, 1.0)));
|
||||||
_shader->setUniform("gammaValue[" + std::to_string(i) + "]", solarImagery->getGammaValue());
|
_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("contrastValue[" + std::to_string(i) + "]", solarImagery->getContrastValue());
|
||||||
_shader->setUniform("scale[" + std::to_string(i) + "]", solarImagery->getScale());
|
_shader->setUniform("scale[" + std::to_string(i) + "]", solarImagery->getScale());
|
||||||
_shader->setUniform("centerPixel[" + std::to_string(i) + "]", solarImagery->getCenterPixel());
|
_shader->setUniform("centerPixel[" + std::to_string(i) + "]", solarImagery->getCenterPixel());
|
||||||
|
|||||||
@@ -205,11 +205,16 @@ void SpacecraftCameraPlane::createFrustum() {
|
|||||||
void SpacecraftCameraPlane::render(const RenderData& data,
|
void SpacecraftCameraPlane::render(const RenderData& data,
|
||||||
ghoul::opengl::Texture& imageryTexture,
|
ghoul::opengl::Texture& imageryTexture,
|
||||||
TransferFunction* lut,
|
TransferFunction* lut,
|
||||||
const glm::dvec3& sunPositionWorld, float planeOpacity,
|
const glm::dvec3& sunPositionWorld,
|
||||||
float contrastValue, float gammaValue,
|
float planeOpacity,
|
||||||
bool enableBorder, bool enableFrustum,
|
float multiplierValue,
|
||||||
|
float contrastValue,
|
||||||
|
float gammaValue,
|
||||||
|
bool enableBorder,
|
||||||
|
bool enableFrustum,
|
||||||
const glm::vec2& currentCenterPixel,
|
const glm::vec2& currentCenterPixel,
|
||||||
float currentScale, float multipleImageryOffset,
|
float currentScale,
|
||||||
|
float multipleImageryOffset,
|
||||||
bool isCoronaGraph)
|
bool isCoronaGraph)
|
||||||
{
|
{
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
@@ -255,6 +260,7 @@ void SpacecraftCameraPlane::render(const RenderData& data,
|
|||||||
_planeShader->setUniform("centerPixel", currentCenterPixel);
|
_planeShader->setUniform("centerPixel", currentCenterPixel);
|
||||||
_planeShader->setUniform("imageryTexture", imageUnit);
|
_planeShader->setUniform("imageryTexture", imageUnit);
|
||||||
_planeShader->setUniform("planeOpacity", planeOpacity);
|
_planeShader->setUniform("planeOpacity", planeOpacity);
|
||||||
|
_planeShader->setUniform("multiplierValue", multiplierValue);
|
||||||
_planeShader->setUniform("gammaValue", gammaValue);
|
_planeShader->setUniform("gammaValue", gammaValue);
|
||||||
_planeShader->setUniform("contrastValue", contrastValue);
|
_planeShader->setUniform("contrastValue", contrastValue);
|
||||||
_planeShader->setUniform(
|
_planeShader->setUniform(
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public:
|
|||||||
|
|
||||||
void render(const RenderData& data, ghoul::opengl::Texture& imageryTexture,
|
void render(const RenderData& data, ghoul::opengl::Texture& imageryTexture,
|
||||||
TransferFunction* lut, const glm::dvec3& sunPositionWorld, float planeOpacity,
|
TransferFunction* lut, const glm::dvec3& sunPositionWorld, float planeOpacity,
|
||||||
float contrastValue, float gammaValue, bool enableBorder, bool enableFrustum,
|
float multiplierValue, float contrastValue, float gammaValue, bool enableBorder,
|
||||||
const glm::vec2& currentCenterPixel, float currentScale,
|
bool enableFrustum, const glm::vec2& currentCenterPixel, float currentScale,
|
||||||
float multipleImageryOffset, bool isCoronaGraph);
|
float multipleImageryOffset, bool isCoronaGraph);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ uniform sampler2D imageryTexture;
|
|||||||
uniform sampler1D lut;
|
uniform sampler1D lut;
|
||||||
uniform bool additiveBlending;
|
uniform bool additiveBlending;
|
||||||
|
|
||||||
|
uniform float multiplierValue;
|
||||||
uniform float contrastValue;
|
uniform float contrastValue;
|
||||||
uniform float gammaValue;
|
uniform float gammaValue;
|
||||||
uniform float planeOpacity;
|
uniform float planeOpacity;
|
||||||
@@ -42,7 +43,7 @@ float contrast(float intensity) {
|
|||||||
|
|
||||||
Fragment getFragment() {
|
Fragment getFragment() {
|
||||||
float intensityOrg = texture(imageryTexture, vec2(vs_st.x, 1 - vs_st.y)).r;
|
float intensityOrg = texture(imageryTexture, vec2(vs_st.x, 1 - vs_st.y)).r;
|
||||||
intensityOrg = contrast(intensityOrg);
|
intensityOrg = contrast(intensityOrg * multiplierValue);
|
||||||
|
|
||||||
vec4 outColor;
|
vec4 outColor;
|
||||||
if (hasLut) {
|
if (hasLut) {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ uniform bool isEnabled[MAX_SPACECRAFT_OBSERVATORY];
|
|||||||
uniform bool isCoronaGraph[MAX_SPACECRAFT_OBSERVATORY];
|
uniform bool isCoronaGraph[MAX_SPACECRAFT_OBSERVATORY];
|
||||||
uniform float scale[MAX_SPACECRAFT_OBSERVATORY];
|
uniform float scale[MAX_SPACECRAFT_OBSERVATORY];
|
||||||
uniform vec2 centerPixel[MAX_SPACECRAFT_OBSERVATORY];
|
uniform vec2 centerPixel[MAX_SPACECRAFT_OBSERVATORY];
|
||||||
|
uniform float multiplierValue[MAX_SPACECRAFT_OBSERVATORY];
|
||||||
|
|
||||||
const float SUN_RADIUS = 1391600000 * 0.5;
|
const float SUN_RADIUS = 1391600000 * 0.5;
|
||||||
|
|
||||||
@@ -68,7 +69,8 @@ Fragment getFragment() {
|
|||||||
uv.y -= ((centerPixel[i].y) / SUN_RADIUS) / 2.0;
|
uv.y -= ((centerPixel[i].y) / SUN_RADIUS) / 2.0;
|
||||||
|
|
||||||
float intensityOrg = texture(imageryTexture[i], vec2(uv.x, 1.0 - uv.y)).r;
|
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;
|
vec4 res;
|
||||||
if (hasLut[i]) {
|
if (hasLut[i]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user