mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-28 15:37:14 +00:00
fix(dashboard): flair tints and Basic lighting as the client computes them
- Flair tints are the terrain file's color bytes over 255, times the flair model's own vertex colors (FlairAssets::AppendRenderBuffer divides by 255.0). The manifests said 63, so in the game shaders' sRGB maths tints of up to 4 turned the flairs white (Battle Against Frakjaw's leaves). Conversion format 6, so flair manifests kept by browsers are fetched again. - BasicShaders, AlphaAsAlpha and Flair.fx multiply the light by the vertex color and only then clamp, as the COLOR0 output; the views clamped the light first, so a light brighter than 1 no longer lifted darker vertex colors. - Docs: the flair tint, the clamp, and that AlphaAsAlpha cards show their backs (Cullmode none) from outside a playable area. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -278,9 +278,10 @@ namespace {
|
||||
* which must follow this; SceneryCoreJs checks), so a manifest a browser kept for a day from an older server
|
||||
* isn't drawn with newer code. 2: meshes carry their multishader tag; conversions without it drew glom parts with
|
||||
* the LEGO shader. 3: dark textures and the UV set each texture names. 4: the game's shaders draw the models
|
||||
* (manifest "techniques"), vertex colors go to them as stored. 5: an animated material alpha is its highest key.
|
||||
* (manifest "techniques"), vertex colors go to them as stored. 5: an animated material alpha is its highest key. 6: flair tints are bytes over
|
||||
* 255 (they were over 63).
|
||||
*/
|
||||
constexpr uint32_t FORMAT_VERSION = 5;
|
||||
constexpr uint32_t FORMAT_VERSION = 6;
|
||||
|
||||
// A zone's lighting (WorldScene::Lighting) for the viewers' shaders
|
||||
nlohmann::json LightingJson(const WorldScene::Lighting& lighting) {
|
||||
@@ -442,7 +443,7 @@ namespace {
|
||||
|
||||
/**
|
||||
* The flairs' manifest (as the scenery's, plus a tint per flair), from the zone's terrain file. A flair's color
|
||||
* tints its model; 63 is full strength (the files use 0 to 63 for most flairs, a little more for brighter ones).
|
||||
* tints its model as a byte over 255, times the model's own vertex colors (FlairAssets::AppendRenderBuffer).
|
||||
*/
|
||||
std::optional<std::string> BuildFlairs(uint32_t zoneId, ZoneScenery& scenery) {
|
||||
const auto raw = ZoneRawShared(zoneId);
|
||||
@@ -477,7 +478,7 @@ namespace {
|
||||
assets = scenery.assets;
|
||||
}
|
||||
return nlohmann::json{
|
||||
{"zone", zoneId}, {"sky", -1}, {"assets", assets}, {"distance", FLAIR_DISTANCE}, {"colorScale", 1.0 / 63.0}, {"lighting", scenery.lighting}, {"format", FORMAT_VERSION},
|
||||
{"zone", zoneId}, {"sky", -1}, {"assets", assets}, {"distance", FLAIR_DISTANCE}, {"colorScale", 1.0 / 255.0}, {"lighting", scenery.lighting}, {"format", FORMAT_VERSION},
|
||||
// Flair.fx for all of them: (0.85 * sun + ambient) * the flair's tint, whatever their facing
|
||||
{"technique", { {"family", "flair"}, {"look", 0}, {"alpha", "opacity"}, {"flags", 0} }},
|
||||
{"objects", { {"asset", assetOf}, {"pos", positions}, {"rot", rotations}, {"scale", scales}, {"color", colors} }}
|
||||
@@ -488,7 +489,7 @@ namespace {
|
||||
|
||||
/**
|
||||
* The flairs' manifest (as the scenery's, plus a tint per flair), from the zone's terrain file. A flair's color
|
||||
* tints its model; 63 is full strength (the files use 0 to 63 for most flairs, a little more for brighter ones).
|
||||
* tints its model as a byte over 255, times the model's own vertex colors (FlairAssets::AppendRenderBuffer).
|
||||
* Built when first asked for (any thread).
|
||||
*/
|
||||
const std::optional<std::string>& Flairs(uint32_t zoneId, ZoneScenery& scenery) {
|
||||
|
||||
Reference in New Issue
Block a user