mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 11:09:37 -06:00
More tweaks on milky way galaxy volume rendering.
This commit is contained in:
@@ -8,9 +8,9 @@ local MilkyWayVolumeGalaxy = {
|
||||
Parent = transforms.SolarSystemBarycenter.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableGalaxy",
|
||||
StepSize = 0.015,
|
||||
AbsorptionMultiply = 100,
|
||||
EmissionMultiply = 500,
|
||||
StepSize = 0.01,
|
||||
AbsorptionMultiply = 10,
|
||||
EmissionMultiply = 100,
|
||||
Translation = {0.17, 0, 0},
|
||||
Volume = {
|
||||
Type = "Volume",
|
||||
|
||||
@@ -104,8 +104,8 @@ namespace openspace {
|
||||
RenderableGalaxy::RenderableGalaxy(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _stepSize(StepSizeInfo, 0.01f, 0.0005f, 0.05f, 0.001f)
|
||||
, _absorptionMultiply(AbsorptionMultiplyInfo, 50.f, 0.0f, 500.0f)
|
||||
, _emissionMultiply(EmissionMultiplyInfo, 1500.f, 0.0f, 3000.0f)
|
||||
, _absorptionMultiply(AbsorptionMultiplyInfo, 40.f, 0.0f, 100.0f)
|
||||
, _emissionMultiply(EmissionMultiplyInfo, 400.f, 0.0f, 1000.0f)
|
||||
//, _pointStepSize(PointStepSizeInfo, 0.01f, 0.01f, 0.1f)
|
||||
//, _enabledPointsRatio(EnabledPointsRatioInfo, 0.2f, 0.f, 1.f)
|
||||
, _translation(TranslationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
|
||||
@@ -41,7 +41,8 @@ void sample#{id}(vec3 samplePos,
|
||||
|
||||
vec4 sampledColor = texture(galaxyTexture#{id}, samplePos.xyz);
|
||||
|
||||
float STEP_SIZE = maxStepSize#{id};
|
||||
//float STEP_SIZE = maxStepSize#{id}*0.5;
|
||||
float STEP_SIZE = 1 / 256.0;
|
||||
|
||||
vec3 alphaTint = vec3(0.3, 0.54, 0.85);
|
||||
|
||||
@@ -50,28 +51,23 @@ void sample#{id}(vec3 samplePos,
|
||||
sampledColor = sampledColor*sampledColor;
|
||||
|
||||
// fudge for the dust "spreading"
|
||||
sampledColor.a = clamp(sampledColor.a, 0.0, 1.0) * opacityCoefficient#{id};
|
||||
sampledColor.a = pow(sampledColor.a, 0.7);
|
||||
|
||||
// absorption probability
|
||||
float scaled_density = sampledColor.a * STEP_SIZE * absorptionMultiply#{id} * 10;
|
||||
float scaled_density = sampledColor.a * STEP_SIZE * absorptionMultiply#{id};
|
||||
vec3 absorption = alphaTint * scaled_density;
|
||||
|
||||
// extinction
|
||||
vec3 extinction = exp(-absorption);
|
||||
sampledColor.rgb = sampledColor.rgb * extinction;
|
||||
accumulatedColor.rgb *= extinction;
|
||||
|
||||
// emission
|
||||
sampledColor.rgb += sampledColor.rgb * STEP_SIZE * emissionMultiply#{id};
|
||||
|
||||
//sampledColor.a = sampledColor.a * 50; //1.0;
|
||||
|
||||
vec3 backAlpha = sampledColor.aaa * 10.0;
|
||||
sampledColor.rgb = sampledColor.rgb * backAlpha;
|
||||
accumulatedColor.rgb += sampledColor.rgb * STEP_SIZE * emissionMultiply#{id};
|
||||
|
||||
sampledColor.a = clamp(sampledColor.a, 0.0, 1.0) * opacityCoefficient#{id};
|
||||
vec3 oneMinusFrontAlpha = vec3(1.0) - accumulatedAlpha;
|
||||
accumulatedColor += oneMinusFrontAlpha * sampledColor.rgb;
|
||||
accumulatedAlpha += oneMinusFrontAlpha * sampledColor.a;
|
||||
//accumulatedColor += oneMinusFrontAlpha * sampledColor.rgb;
|
||||
accumulatedAlpha += oneMinusFrontAlpha * sampledColor.rgb;
|
||||
}
|
||||
|
||||
float stepSize#{id}(vec3 samplePos, vec3 dir) {
|
||||
|
||||
Reference in New Issue
Block a user