Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

everything gets much darker the more you zoom away making it look like there is damage to the buildings #4375

Closed
wzdev-ci opened this issue May 10, 2016 · 20 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_patch (an actual patch, not a request for one) | by klasskill


normal undamaged buildings are a bright color and the more damage they get they turn darker
when you zoom out the color gets darker instead of staying the normal color when they are undamaged


Issue migrated from trac:4375 at 2022-04-16 11:56:04 -0700

@wzdev-ci
Copy link
Contributor Author

Alistair_Findlay commented


I am experiencing a similar issue. the buildings will become fully dark at far zoom levels and at certain angles. I can provide video and/or logs if wanted.

AMDGPU ARCH

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jan 27, 2019

Forgon commented


Replying to Warzone2100/old-trac-import#4375 (comment:1):

I am experiencing a similar issue. the buildings will become fully dark at far zoom levels and at certain angles. I can provide video and/or logs if wanted.

AMDGPU ARCH
Berg has already made a video (you can watch it here).

@wzdev-ci
Copy link
Contributor Author

Forgon changed blocking which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

Forgon changed blockedby which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

Alistair_Findlay commented


Ah yes, that seems like the same bug.

@wzdev-ci
Copy link
Contributor Author

Forgon changed type from bug to patch (an actual patch, not a request for one)

@wzdev-ci
Copy link
Contributor Author

Forgon commented


The problem exists since at least version 3.1.0.
Its cause is diffuse lighting, which simulates light direction:
The larger the angle at which light hits the surface of an object, the darker
it will appear.

The light source in our game is called the sun.
Its position is initialized in src/display3d.cpp:

bool init3DView()
{
	/* Arbitrary choice - from direct read! */
	const Vector3f theSun(225.0f, -600.0f, 450.0f);

Lighting is calculated based on a simple model, which combines ambient lighting
(a background light), diffuse lighting (light reflection based on surface angle)
and specular lighting (which depends on the shininess of objects).
A practical introduction to the topic can be found
here.

When diffuse lighting is disabled, the map zoom distance does not influence the
brightness of objects.
To compensate for its absence, ambient lighting should be as bright as possible.
As a result, the terrain will appears brighter overall.

The sun's lighting intensities are initialized in lib/ivis_opengl/piedraw.cpp:

void pie_InitLighting()
{
	// set scene color, ambient, diffuse and specular light intensities of sun
	// diffuse lighting is turned off because players dislike it
	const gfx_api::gfxFloat defaultLight[LIGHT_MAX][4] = [0.0f, 0.0f, 0.0f, 1.0f},  {1.0f, 1.0f, 1.0f, 1.0f},  {0.0f, 0.0f, 0.0f, 1.0f},  {1.0f, 1.0f, 1.0f, 1.0f];
	memcpy(lighting0, defaultLight, sizeof(lighting0));
}

Two script functions allow changing the sun's position and lighting intensities:

## setSunPosition(x, y, z)

Move the position of the Sun, which in turn moves where shadows are cast. (3.2+ only)

## setSunIntensity(ambient r, g, b, diffuse r, g, b, specular r, g, b)

Set the ambient, diffuse and specular colour intensities of the Sun lighting source. (3.2+ only)

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting.patch (1.3 KiB)

patch file based on revision 400191c9c47a4e39aeb12240283f355a57e30290

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting_distance_2500_old.png (543.0 KiB)

screenshot of Sk-Rush at distance 2500 before applying the patch
diffuse_lighting_distance_2500_old.png

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting_distance_5000_old.png (460.1 KiB)

screenshot of Sk-Rush at distance 5000 before applying the patch
diffuse_lighting_distance_5000_old.png

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting_old.mkv (3062.5 KiB)

video of lighting with increasing map zoom distances before applying this patch

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting_distance_2500_new.png (548.8 KiB)

screenshot of Sk-Rush at distance 2500 after applying the patch
diffuse_lighting_distance_2500_new.png

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting_distance_5000_new.png (470.8 KiB)

screenshot of Sk-Rush at distance 5000 after applying the patch
diffuse_lighting_distance_5000_new.png

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting_new.mkv (3122.6 KiB)

video of lighting with increasing map zoom distances after applying this patch

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting_recording (1.8 KiB)

shell script to record video and take screenshots for documentation of this bug

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file diffuse_lighting_savegame.wz (66.0 KiB)

savegame with damaged buildings for shell script diffuse_lighting_recording

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed owner from `` to Forgon2100 <forgon2100@protonmail.com>

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> committed [456]


In Warzone2100/warzone2100@456a74e:

#CommitTicketReference repository="" revision="456a74edb1fa76e66bf8e0e2c888b54c0b5c6299"
Change lighting of sun to avoid objects darkening

* turn off diffuse lighting because players dislike objects darkening
  when zooming out, making them look as though they were damaged
* increase ambient lighting to compensate for resulting darkness
* overall increase in brightness of terrain

Fixes #4375

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant