View Issue Details

IDProjectCategoryView StatusLast Update
0005828The Dark ModGraphicspublic03.12.2022 22:07
Reporterstgatilov Assigned Tostgatilov  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product VersionTDM 2.09 
Target VersionTDM 2.11Fixed in VersionTDM 2.11 
Summary0005828: Try to reduce duplication among shader code.
DescriptionBack in ARB assembly days, every shader was written from scratch and hand-optimized.
This is no longer the problem today: it is perfectly OK to have large shaders and rely on branching (or compile-time dead code elimination).
Having many separate shaders today causes code duplication, making it harder to maintain.

Some idea for shader unification:
1) Ordinary interaction and ambient interaction shaders can be unified into single shader with a flag.
2) Perhaps cubic lights can be unified back into frustum-based ones, just add "spherical falloff" flag.
Additional InformationOriginally discussed here:
  https://forums.thedarkmod.com/index.php?/topic/21138-projected-lights-falloff/&do=findComment&comment=466904
But surely needs more thinking and discussion...
TagsNo tags attached.

Relationships

has duplicate 0005834 closedstgatilov Refactor: merge interaction and ambient shaders 
related to 0005285 closedcabalistic Remove old backend's depth/interaction/stencil stages 
related to 0006090 resolvedstgatilov Restore ambientCubicMap 

Activities

stgatilov

stgatilov

22.08.2022 17:39

administrator   ~0015205

Last edited: 22.08.2022 20:37

First I extracted all the math for interaction/ambient lighting into separate pure functions (see frob.fs):
  r10066 Removed "simple interaction" support from C++ code.
  r10067 Refactored interaction math into reusable pure functions.
  r10068 Renamed some shader files.
  r10069 Renamed tdm_lighting to tdm_interaction.
  r10070 Exposed transformPosition --- pure version of tdm_transform.
  r10071 Added missing license header.
  r10074 Ambient interaction converted to functions + cleanup.
  r10086 Minor renames.

Then I changed some weird things in the math:
  r10087 Removed "default" specular texture value in case specular color is zero.
  r10088 Now specular term is modulated by specular color instead of diffuse color in ambient shader.
  r10089 Specular term of interaction shader no longer depends on diffuse texture contents.
  r10090 Don't modulate directional component of diffuse term by (1 - specularTexColor) in ambient.
  r10094 Don't modulate ambient specular term by diffuse texture color.

These commits are rather dangerous, since that change how things look slightly).
Let's hope it won't break to much stuff.

In process, I deleted ambientCubeMap.
Need to restore them in near future.
stgatilov

stgatilov

03.09.2022 08:08

administrator   ~0015220

Restoring ambientCubeMap extracted into 0006090.

Issue History

Date Modified Username Field Change
29.11.2021 16:45 stgatilov New Issue
29.11.2021 16:45 stgatilov Status new => assigned
29.11.2021 16:45 stgatilov Assigned To => stgatilov
27.12.2021 03:49 stgatilov Relationship added related to 0005285
22.08.2022 17:16 stgatilov Relationship added related to 0005834
22.08.2022 17:16 stgatilov Relationship deleted related to 0005834
22.08.2022 17:16 stgatilov Relationship added has duplicate 0005834
22.08.2022 17:39 stgatilov Note Added: 0015205
22.08.2022 20:37 stgatilov Note Edited: 0015205
03.09.2022 08:07 stgatilov Relationship added related to 0006090
03.09.2022 08:08 stgatilov Note Added: 0015220
15.11.2022 02:17 nbohr1more Status assigned => feedback
03.12.2022 22:07 nbohr1more Status feedback => resolved
03.12.2022 22:07 nbohr1more Resolution open => fixed
03.12.2022 22:07 nbohr1more Fixed in Version => TDM 2.11