paysages : Fixed atmosphere changing clouds alpha (causing ghosting when clouds where over ground).

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@352 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-06-17 16:27:01 +00:00 committed by ThunderK
parent 1fecbf414e
commit 40a0d576bc
4 changed files with 15 additions and 5 deletions

1
TODO
View file

@ -1,6 +1,5 @@
Technology Preview 2 :
- InputInt doesn't honor small_step.
- Fix the fog impression when cloud layer overlaps with ground range.
- Remove color gradations (replace with automatic boolean and simple colors).
- Replace zone ranges with curves (with curve input and curve dialog).
- Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges).

View file

@ -87,6 +87,7 @@ Color atmosphereApply(AtmosphereDefinition* definition, Renderer* renderer, Vect
Color mask = definition->color;
double distance = v3Norm(v3Sub(renderer->camera_location, location));
double value;
double alpha;
if (distance < definition->distance_near)
{
@ -97,10 +98,15 @@ Color atmosphereApply(AtmosphereDefinition* definition, Renderer* renderer, Vect
distance = definition->distance_far;
}
alpha = base.a;
base.a = 1.0;
value = definition->full_mask * (distance - definition->distance_near) / (definition->distance_far - definition->distance_near);
mask.a = value;
colorMask(&base, &mask);
base.a = alpha;
return base;
}

View file

@ -169,7 +169,7 @@ CloudsLayerDefinition cloudsLayerCreateDefinition()
result.base_coverage = 0.35;
result.shape_noise = noiseCreateGenerator();
noiseGenerateBaseNoise(result.shape_noise, 200000);
noiseAddLevelsSimple(result.shape_noise, 4, 1.0, 1.0);
noiseAddLevelsSimple(result.shape_noise, 5, 1.0, 1.0);
result.edge_noise = noiseCreateGenerator();
noiseGenerateBaseNoise(result.edge_noise, 800000);
noiseAddLevelsSimple(result.edge_noise, 8, 1.0, 1.0);
@ -575,7 +575,10 @@ Color cloudsGetLayerColor(CloudsLayerDefinition* definition, Renderer* renderer,
col.a = 1.0;
}
result = renderer->applyAtmosphere(renderer, start, result);
if (result.a > 0.000001)
{
result = renderer->applyAtmosphere(renderer, start, result);
}
return result;
}
@ -602,7 +605,7 @@ Color cloudsGetColor(CloudsDefinition* definition, Renderer* renderer, Vector3 s
for (i = 0; i < definition->nblayers; i++)
{
layer_color = cloudsGetLayerColor(layers + i, renderer, start, end);
if (layer_color.a > 0.0)
if (layer_color.a > 0.000001)
{
colorMask(&result, &layer_color);
}

View file

@ -1,6 +1,8 @@
#include "system.h"
#include <unistd.h>
/*#define DEBUG_ONETHREAD 1*/
#ifdef WIN32
#include <windows.h>
#endif