2025-09-02 13:52 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0005158Spring engineGeneralpublic2016-03-13 01:12
ReporterBeherith 
Assigned ToKloot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
Product Version101.0+git 
Target VersionFixed in Version 
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.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0016038

Beherith (reporter)

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

~0016041

Kloot (developer)

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

~0016048

Beherith (reporter)

Last edited: 2016-03-12 13:00

View 2 revisions

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.

~0016056

Kloot (developer)

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.
+Notes

-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 View Revisions
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
+Issue History