paysages : Fixed bruneton aerial perspective.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@512 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2013-01-30 22:06:29 +00:00 committed by ThunderK
parent c0f945fb27
commit e1514fae78
3 changed files with 27 additions and 5 deletions

2
TODO
View file

@ -6,7 +6,7 @@ Technology Preview 2 :
=> Allow camera move and zoom.
- Get rid of noise dialogs, for simpler settings.
- Finalize Bruneton's model
=> Fix artifacts on aerial perspective
=> Fix artifacts on aerial perspective (mostly when sun is near horizon)
=> Fix blue appearance at night
- Finalize lighting refactoring
=> Restore water filtering

View file

@ -1144,6 +1144,7 @@ Color brunetonGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3
{
UNUSED(definition);
/* TODO Water height ? */
Vector3 x = {0.0, Rg + (max(eye.y, 0.0) + GROUND_OFFSET) * WORLD_SCALING, 0.0};
Vector3 v = v3Normalize(direction);
Vector3 s = v3Normalize(v3Sub(sun_position, x));
@ -1166,10 +1167,22 @@ Color brunetonGetSkyColor(AtmosphereDefinition* definition, Vector3 eye, Vector3
Color brunetonApplyAerialPerspective(Renderer* renderer, Vector3 location, Color base)
{
Vector3 eye = renderer->camera_location;
Vector3 direction = v3Scale(v3Sub(location, eye), WORLD_SCALING);
Vector3 sun_position = v3Scale(renderer->atmosphere->getSunDirection(renderer), SUN_DISTANCE);
Vector3 x = {0.0, Rg + (max(eye.y, 0.0) + GROUND_OFFSET) * WORLD_SCALING, 0.0};
double yoffset = GROUND_OFFSET - renderer->getWaterHeightInfo(renderer).base_height;
eye.y += yoffset;
location.y += yoffset;
if (eye.y < 0.0)
{
eye.y = 0.0;
}
if (location.y < 0.0)
{
location.y = 0.0;
}
Vector3 direction = v3Scale(v3Sub(location, eye), WORLD_SCALING);
Vector3 x = {0.0, Rg + eye.y * WORLD_SCALING, 0.0};
Vector3 v = v3Normalize(direction);
Vector3 s = v3Normalize(v3Sub(sun_position, x));
@ -1197,7 +1210,16 @@ void brunetonGetLightingStatus(Renderer* renderer, LightStatus* status, Vector3
LightDefinition sun, irradiance;
double muS;
double r0 = Rg + (max(lightingGetStatusLocation(status).y, 0.0) + GROUND_OFFSET) * WORLD_SCALING;
double altitude = lightingGetStatusLocation(status).y;
double yoffset = GROUND_OFFSET - renderer->getWaterHeightInfo(renderer).base_height;
altitude += yoffset;
if (altitude < 0.0)
{
altitude = 0.0;
}
double r0 = Rg + altitude * WORLD_SCALING;
Vector3 up = {0.0, 1.0, 0.0};
Vector3 sun_position = v3Scale(renderer->atmosphere->getSunDirection(renderer), SUN_DISTANCE);
Vector3 x = {0.0, r0, 0.0};

View file

@ -6,7 +6,7 @@
#include "scenery.h"
RayCastingResult _RAYCASTING_NULL = {0};
HeightInfo _WATER_HEIGHT_INFO = {-1000000.0, -1000000.0, -1000000.0};
HeightInfo _WATER_HEIGHT_INFO = {0.0, 0.0, 0.0};
static void* _renderFirstPass(void* data)
{