Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Habitat Lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
Meta Research
Habitat Lab
Commits
3565df54
Commit
3565df54
authored
5 years ago
by
Erik Wijmans
Committed by
Oleksandr
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make fog-of-war darker and make that value changeable (#166)
* Make fog-of-war darker and make that value changeable
parent
d3d6a5eb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
habitat/utils/visualizations/maps.py
+8
-5
8 additions, 5 deletions
habitat/utils/visualizations/maps.py
with
8 additions
and
5 deletions
habitat/utils/visualizations/maps.py
+
8
−
5
View file @
3565df54
...
...
@@ -327,11 +327,10 @@ def get_topdown_map(
return
top_down_map
FOG_OF_WAR_COLOR_DESAT
=
np
.
array
([[
0.7
],
[
1.0
]])
def
colorize_topdown_map
(
top_down_map
:
np
.
ndarray
,
fog_of_war_mask
:
Optional
[
np
.
ndarray
]
=
None
top_down_map
:
np
.
ndarray
,
fog_of_war_mask
:
Optional
[
np
.
ndarray
]
=
None
,
fog_of_war_desat_amount
:
float
=
0.5
,
)
->
np
.
ndarray
:
r
"""
Convert the top down map to RGB based on the indicator values.
Args:
...
...
@@ -339,17 +338,21 @@ def colorize_topdown_map(
fog_of_war_mask: A mask used to determine which parts of the
top_down_map are visible
Non-visible parts will be desaturated
fog_of_war_desat_amount: Amount to desaturate the color of unexplored areas
Decreasing this value will make unexplored areas darker
Default: 0.5
Returns:
A colored version of the top-down map.
"""
_map
=
TOP_DOWN_MAP_COLORS
[
top_down_map
]
if
fog_of_war_mask
is
not
None
:
fog_of_war_desat_values
=
np
.
array
([[
fog_of_war_desat_amount
],
[
1.0
]])
# Only desaturate things that are valid points as only valid points get revealed
desat_mask
=
top_down_map
!=
MAP_INVALID_POINT
_map
[
desat_mask
]
=
(
_map
*
FOG_OF_WAR_COLOR_DESAT
[
fog_of_war_mask
]
_map
*
fog_of_war_desat_values
[
fog_of_war_mask
]
).
astype
(
np
.
uint8
)[
desat_mask
]
return
_map
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment