View Issue Details

IDProjectCategoryView StatusLast Update
0005158Spring engineGeneralpublic2016-03-13 01:12
ReporterBeherith Assigned ToKloot  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version101.0+git 
Summary0005158: Toggling customunitshader off and on (or a /luarules reload) breaks unit self shadowing.
DescriptionUnit self shadows seem wildly offset based on camera position if CUS is toggled.
Steps To ReproduceBAR /give all, /luarules reload, have a look at the self-shadows.
TagsNo tags attached.
Attached Files
screen00156.jpg (Attachment missing)
mantis5158.diff (Attachment missing)
Checked infolog.txt for Errors

Activities

Beherith

2016-03-10 10:20

reporter   ~0016038

It seems like the angle the shadows are rendered from is not updated with normal camera, and the shadows are 'offset'. See the screenshot.

Kloot

2016-03-10 13:03

developer   ~0016041

caused by the "#define use_perspective_correct_shadows" material definition in 1_normalmapping.lua

Beherith

2016-03-12 12:44

reporter   ~0016048

Last edited: 2016-03-12 13:00

I removed the "#define use_perspective_correct_shadows", and cleaned up the shader code to make it as close to engine code as possible.

Now the unit self shadowing (and recieving shadows from terrain) doesnt even work from the start.

If I /luarules reload, then the shadows are correct until I move the camera.

The best unit to test this is corlab, as it has a large overhanging box above its yard.

EDIT: It is probably an error on my side, as the shadows on trees are correct before the game starts, even if I move the camera around. After game start they are gone though. Try a map like folsomdamdeluxe which has plenty of trees.

Kloot

2016-03-13 01:11

developer   ~0016056

You need to remove the "#if (deferred_mode == 0) ... #endif" guard around "outColor.rgb = outColor.rgb * reflection + specular;", otherwise the shader compiler will generate wrong code. See the attached diff.

Also note the other changes.

Issue History

Date Modified Username Field Change
2016-03-10 09:36 Beherith New Issue
2016-03-10 10:19 Beherith File Added: screen00156.jpg
2016-03-10 10:20 Beherith Note Added: 0016038
2016-03-10 13:03 Kloot Note Added: 0016041
2016-03-10 13:03 Kloot Status new => closed
2016-03-10 13:03 Kloot Assigned To => Kloot
2016-03-10 13:03 Kloot Resolution open => no change required
2016-03-12 12:44 Beherith Note Added: 0016048
2016-03-12 12:44 Beherith Status closed => feedback
2016-03-12 12:44 Beherith Resolution no change required => reopened
2016-03-12 13:00 Beherith Note Edited: 0016048
2016-03-12 13:33 Kloot Status feedback => closed
2016-03-12 13:33 Kloot Resolution reopened => no change required
2016-03-12 13:35 Kloot Status closed => feedback
2016-03-12 13:35 Kloot Resolution no change required => reopened
2016-03-13 01:11 Kloot Note Added: 0016056
2016-03-13 01:12 Kloot File Added: mantis5158.diff
2016-03-13 01:12 Kloot Status feedback => closed
2016-03-13 01:12 Kloot Resolution reopened => no change required