Add shader stage options for height scale and height offset #1282
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our engine already supports scaling and offsetting an height map, but it currently only supports the shader-wide DarkPlaces'
dpoffsetmapping
syntax, which is not enabled by default, and unlike the DarkPlaces engine, the Dæmon engine truly supports stages and stage blending (and then multiple height maps), so we better set this option per stage, per height maps.The reason why
dpoffsetmapping
has been implemented first because at the time I was debugging the height map code, we did not shipped any height map yet, and I used Xonotic assets as test bench.Because of the engine not supporting per-stage scale/offset yet, our height maps are not straight copies of Xonotic ones, but pre-scaled, pre-offsetted copies, which loses a lot of precision (the difference is obviously visible) and also are truncated to the floor level (no bumps).
Having native Dæmon keywords and proper per-stage height scale and offset and supporting the exact same kind of height offset operations as Xonotic would allow us to ship stock copies of Xonotic heightmaps and benefit for more precision and more details.
This would also allow us to use Xonotic's
fft-normalmap-to-heightmap
tool on more normal maps to produce more height maps.