MapImageModule: render through IMapTileTerrainRenderer, as stock does - #204
Open
azdesign-com wants to merge 1 commit into
Open
azdesign-com wants to merge 1 commit into
azdesign-com wants to merge 1 commit into
Conversation
The world map renders grey relief regardless of configuration. TextureOnMapTile has no effect because this module never reads it. CreateMapTile assigns `terrainRenderer = new TexturedMapTileRenderer()` and then never uses the field - written once, read nowhere in the file - and produces the tile from a hand-rolled greyscale loop over GetFloatsSerialised() instead. Neither Initialise() nor TerrainToBitmap() is ever called on it. Both TexturedMapTileRenderer and ShadedMapTileRenderer are present in the tree, already ported to SKBitmap, with IMapTileTerrainRenderer intact. They were orphaned by the SkiaSharp rewrite, not removed or left unfinished. Nothing calls them. Restores the stock selection: read TextureOnMapTile from [Map]/[Startup], pick the textured or shaded renderer accordingly, Initialise, TerrainToBitmap. Verified in-world on a 16-region 1024m varregion grid before submitting: all 16 sub-tiles regenerated per region previously 1 per region tile sizes 5.7-7.6 KB previously 1144 B distinct colours in a tile: 6098 previously 1 greyscale pixels: 0.5% previously 100% by construction dominant colours: water, sand, green The whole landmass now renders as coloured terrain at every zoom level. The greyscale loop emitted SKColor(shaded, shaded, shaded) for every pixel, so 100% greyscale was structural; 0.5% is incidental JPEG overlap on colour data. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The world map renders grey relief regardless of configuration, and
TextureOnMapTilehas no effect. Verified in-world on a 16-region varregion grid before submitting — details below.The defect
CreateMapTileassigns the renderer and then never uses it:That field is written once and read nowhere in the file. The tile is produced by a hand-rolled greyscale loop over
GetFloatsSerialised()instead, andTextureOnMapTileis not read at all — so the setting is inert and the map is grey relief whatever the configuration says.Neither
Initialise()norTerrainToBitmap()is ever called.Both renderers are present in the tree, already ported to
SKBitmap, withIMapTileTerrainRendererintact and correct signatures. They were orphaned by the SkiaSharp rewrite — not removed, not left unfinished. Nothing calls them.The fix
Restores the stock path: read
TextureOnMapTilefrom[Map]/[Startup], select textured or shaded,Initialise,TerrainToBitmap. 21 insertions, 48 deletions — it removes more than it adds, because the replacement is the code that already exists.Verified in-world, not only reasoned about
Deployed to two regions, then to all sixteen, on a 1024m varregion grid:
The old loop emitted
SKColor(shaded, shaded, shaded)for every pixel, so 100% greyscale was by construction; 0.5% is incidental JPEG overlap on colour data. Dominant colours after the fix are water, sand and green.The full landmass now resolves as coloured terrain at every zoom level, where previously it was grey and black squares.
Note on the sub-tile count
The jump from 1 to 16 uploads is a second-order effect of the region-size fix in #201, surfaced by this change.
MapImageServiceModuleuploads a single tile when the map is exactlyConstants.RegionSizeand splits into sub-tiles otherwise. Before #201, every varregion returned 256x256 and took the single-tile path, leaving the region's other cells without imagery. That branch had never executed on our grid.Relationship to #202
This supersedes my own PR #202 and I am closing that one. #202 added a NaN guard to the contrast stretch in this method, for the case where a perfectly flat region gives
heightRange == 0and(byte)(0f/0f)yields a pure black tile. That guard was correct for the hand-rolled loop — but this change removes the loop entirely, so the division it guarded no longer exists here.The flat-region case is still handled:
ShadedMapTileRendererworks from absolute height with its own NaN handling, andTexturedMapTileRenderersamples terrain textures. Neither divides by a height range. Confirmed on a flat region, which rendered pure black before and renders uniform terrain colour after.Builds clean:
OpenSim.Region.CoreModules, SDK 10.0.400, 0 errors, restored from public nuget only.