paysages : Fixed artifacts of bruneton near horizon line.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@537 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
7fe0f04128
commit
1dc8917a4b
4 changed files with 14 additions and 12 deletions
3
TODO
3
TODO
|
@ -5,8 +5,6 @@ Technology Preview 2 :
|
|||
=> Add map preview with editor area.
|
||||
=> Allow camera move and zoom.
|
||||
- Get rid of noise dialogs, for simpler settings.
|
||||
- Finalize Bruneton's model
|
||||
=> Fix artifacts on aerial perspective (mostly when sun is near horizon)
|
||||
- Finalize lighting refactoring
|
||||
=> Restore cloud lighting
|
||||
- Hide Preetham's model.
|
||||
|
@ -16,6 +14,7 @@ Technology Preview 2 :
|
|||
=> Covering texture height should inpact terrain height.
|
||||
=> Add texture shadowing.
|
||||
- Clouds should keep distance to ground.
|
||||
- Apply depth filtering to water preview.
|
||||
- Fix rendering when inside a cloud layer, with other upper or lower layers.
|
||||
- Improve cloud rendering precision (and beware of precision discontinuity when rendering clouds in front of ground (shorter distance)).
|
||||
- Translations.
|
||||
|
|
|
@ -26,7 +26,7 @@ static const double exposure = 0.4;
|
|||
static const double ISun = 100.0;
|
||||
static const double AVERAGE_GROUND_REFLECTANCE = 0.1;
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
#define RES_MU 128
|
||||
#define RES_MU_S 32
|
||||
#define RES_R 32
|
||||
|
@ -863,14 +863,14 @@ static Color _getInscatterColor(Vector3* _x, double* _t, Vector3 v, Vector3 s, d
|
|||
double muS0 = v3Dot(x0, s) / r0;
|
||||
/* avoids imprecision problems in transmittance computations based on textures */
|
||||
*attenuation = _analyticTransmittance(r, mu, t);
|
||||
if (r0 > Rg + 0.01)
|
||||
if (r0 > Rg + 0.001)
|
||||
{
|
||||
/* computes S[L]-T(x,x0)S[L]|x0 */
|
||||
Color attmod = {attenuation->x, attenuation->y, attenuation->z, attenuation->x};
|
||||
Color samp = _texture4D(_inscatterTexture, r0, mu0, muS0, nu);
|
||||
inscatter = _applyInscatter(inscatter, attmod, samp);
|
||||
/* avoids imprecision problems near horizon by interpolating between two points above and below horizon */
|
||||
const double EPS = 0.004;
|
||||
const double EPS = 0.02;
|
||||
double muHoriz = -sqrt(1.0 - (Rg / r) * (Rg / r));
|
||||
if (fabs(mu - muHoriz) < EPS)
|
||||
{
|
||||
|
@ -1151,12 +1151,15 @@ void brunetonInit()
|
|||
texture4DDelete(_deltaJTexture);
|
||||
}
|
||||
|
||||
Color brunetonGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3 direction, Vector3 sun_position)
|
||||
Color brunetonGetSkyColor(Renderer* renderer, Vector3 eye, Vector3 direction, Vector3 sun_position)
|
||||
{
|
||||
UNUSED(definition);
|
||||
|
||||
/* TODO Water height ? */
|
||||
Vector3 x = {0.0, Rg + (max(eye.y, 0.0) + GROUND_OFFSET) * WORLD_SCALING, 0.0};
|
||||
double yoffset = GROUND_OFFSET - renderer->water->getHeightInfo(renderer).base_height;
|
||||
eye.y += yoffset;
|
||||
if (eye.y < 0.0)
|
||||
{
|
||||
eye.y = 0.0;
|
||||
}
|
||||
Vector3 x = {0.0, Rg + eye.y * WORLD_SCALING, 0.0};
|
||||
Vector3 v = v3Normalize(direction);
|
||||
Vector3 s = v3Normalize(v3Sub(sun_position, x));
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ static Color _getSkyColor(Renderer* renderer, Vector3 direction)
|
|||
switch (definition->model)
|
||||
{
|
||||
case ATMOSPHERE_MODEL_BRUNETON:
|
||||
sky_color = brunetonGetSkyColor(definition, camera_location, direction, sun_position);
|
||||
sky_color = brunetonGetSkyColor(renderer, camera_location, direction, sun_position);
|
||||
break;
|
||||
case ATMOSPHERE_MODEL_PREETHAM:
|
||||
sky_color = preethamGetSkyColor(definition, camera_location, direction, sun_position);
|
||||
|
|
|
@ -16,7 +16,7 @@ Color basicApplyAerialPerspective(Renderer* renderer, Vector3 location, Color ba
|
|||
void basicGetLightingStatus(Renderer* renderer, LightStatus* status, Vector3 normal, int opaque);
|
||||
|
||||
void brunetonInit();
|
||||
Color brunetonGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3 direction, Vector3 sun_position);
|
||||
Color brunetonGetSkyColor(Renderer* renderer, Vector3 eye, Vector3 direction, Vector3 sun_position);
|
||||
Color brunetonApplyAerialPerspective(Renderer* renderer, Vector3 location, Color base);
|
||||
void brunetonGetLightingStatus(Renderer* renderer, LightStatus* status, Vector3 normal, int opaque);
|
||||
|
||||
|
|
Loading…
Reference in a new issue