-
-
Notifications
You must be signed in to change notification settings - Fork 257
Option to use compressed color map #842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
stan4dbunny
wants to merge
7
commits into
TokisanGames:main
Choose a base branch
from
stan4dbunny:baking_color_map
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5a9fa20
Option to set compression mode of the color map that will be used in …
stan4dbunny 4010d1f
Documentation for compressed color map feature.
stan4dbunny 113e392
Update color map compression (wip)
TokisanGames 865865f
Reorganize, confirm maps freeing
TokisanGames 7dac17a
update docs
TokisanGames b80f011
Add option to disable color map, separately in material and data
TokisanGames 8cb54e6
Setup Framework for color map mode
TokisanGames File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Copyright © 2025 Cory Petkovsek, Roope Palmroos, and Contributors. | ||
| # Editor Export Plugin for Terrain3D | ||
| @tool | ||
| extends EditorExportPlugin | ||
|
|
||
|
|
||
| var _hash: String | ||
| var _free_uncompressed_color_maps: bool | ||
| var _color_compress_mode: Image.CompressMode | ||
|
|
||
|
|
||
| func _get_name() -> String: | ||
| return "Terrain3DExportPlugin" | ||
|
|
||
|
|
||
| func _begin_customize_scenes(platform: EditorExportPlatform, features: PackedStringArray) -> bool: | ||
| return true | ||
|
|
||
|
|
||
| func _customize_scene(scene: Node, path: String) -> Node: | ||
| var terrain: Terrain3D = scene.find_child("Terrain3D", true) | ||
| if terrain: | ||
| _free_uncompressed_color_maps = terrain.get_free_uncompressed_color_maps() | ||
| _color_compress_mode = terrain.get_color_image_compress_mode() | ||
| return null | ||
|
|
||
|
|
||
| func _begin_customize_resources(platform: EditorExportPlatform, features: PackedStringArray) -> bool: | ||
| _hash = "" | ||
| for feat: String in features: | ||
| _hash += feat | ||
| _hash += platform.to_string() | ||
| return true | ||
|
|
||
|
|
||
| func _customize_resource(resource: Resource, path: String) -> Resource: | ||
| if resource is Terrain3DRegion: | ||
| var region: Terrain3DRegion = resource | ||
| if _color_compress_mode != Image.COMPRESS_MAX and _free_uncompressed_color_maps and region.compressed_color_map != null: | ||
| region.free_uncompressed_color_map() | ||
| return region | ||
| return null | ||
|
|
||
|
|
||
| func _get_customization_configuration_hash() -> int: | ||
| return hash(_hash) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://bfl6jfwv15i0f |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Copyright © 2025 Cory Petkovsek, Roope Palmroos, and Contributors. | ||
|
|
||
| R"( | ||
| //INSERT: COLOR_MAP_BASE | ||
| color_map = region_uv.z > -1.0 ? textureLod(_color_maps, region_uv, region_mip) : COLOR_MAP_DEF; | ||
|
|
||
| //INSERT: COLOR_MAP_BILERP | ||
| // 4 lookups if linear filtering, else 1 lookup. | ||
| vec4 col_map[4]; | ||
| col_map[3] = index[3].z > -1 ? texelFetch(_color_maps, index[3], 0) : COLOR_MAP_DEF; | ||
| #ifdef FILTER_LINEAR | ||
| col_map[0] = index[0].z > -1 ? texelFetch(_color_maps, index[0], 0) : COLOR_MAP_DEF; | ||
| col_map[1] = index[1].z > -1 ? texelFetch(_color_maps, index[1], 0) : COLOR_MAP_DEF; | ||
| col_map[2] = index[2].z > -1 ? texelFetch(_color_maps, index[2], 0) : COLOR_MAP_DEF; | ||
|
|
||
| color_map = | ||
| col_map[0] * weights[0] + | ||
| col_map[1] * weights[1] + | ||
| col_map[2] * weights[2] + | ||
| col_map[3] * weights[3] ; | ||
| #else | ||
| color_map = col_map[3]; | ||
| #endif | ||
| )" |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.