Quantcast Is it possible to change ingame Map colors? - ESOUI
Thread Tools Display Modes
06/11/19, 04:50 AM   #1
LordBob
Join Date: May 2019
Posts: 8
Arrow Is it possible to change ingame Map colors?

Hi,

is there a way to change the way colors are displayed for the Tamriel map?
I am using reshade and everything is awesome except the looks of the map.
So I thought I could adjust some dds textures with photoshop and install it as a mod.
Any ideas?

Thank you


...everything is awesooome...
  Reply With Quote
06/11/19, 05:25 AM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,259
You can use the RedirectTexture function to exchange a texture globally. Each map uses several tiles, so you would need to find the path and count for them and then redirect each one to use the files in your addon:
Lua Code:
  1. local function ReplaceMapTextures(mapId, customTilePathTemplate)
  2.     local numX, numY = GetMapNumTilesForMapId(mapId)
  3.     local totalTiles = numX * numY
  4.     for i = 1, totalTiles do
  5.         RedirectTexture(GetMapTileTextureForMapId(mapId, i), customTilePathTemplate:format(i))
  6.     end
  7. end

You can find the map id with "/script d(GetCurrentMapId())" while looking at the map you wish to replace.
The customTilePathTemplate should look like something like that: "MyAddon/path/to/map/maptile_%d.dds".
Then you'd just store the edited tiles in the specified subfolder with names starting from maptile_1.dds.

The hardest part is to get the map textures out of the game files. You can use esoextract for that.
__________________
Like what I do? Support me on Patreon!
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
  Reply With Quote
06/12/19, 12:51 PM   #3
LordBob
Join Date: May 2019
Posts: 8
Thank you for the quick reply

I managed to extract all map files and used XnConvert to batch-edit the city Balmora map for testing.
Now I got the .dds files in ReshadeMap\art\maps\vvardenfell\balmora_base_0.dds...balmora_base_24.dds.
Then I renamed them to balmora_base_0_reshademap.dds...balmora_base_24_reshademap.dds in case it makes a difference?

After setting up a .txt and .lua file according to Writing your first addon, I inserted your suggested code so it looks like the following for now:

Lua Code:
  1. ReshadeMap = {}
  2. ReshadeMap.appName = ReshadeMap
  3.  
  4. local ADDON_VERSION = 1.0
  5.  
  6. local function ReplaceMapTextures(mapId, ReshadeMap/art/maps/vvardenfell/balmora_base_%d_reshademap.dds)
  7.     local numX, numY = GetMapNumTilesForMapId(1290)
  8.     local totalTiles = numX * numY
  9.     for i = 1, totalTiles do
  10.         RedirectTexture(GetMapTileTextureForMapId(1290, i), ReshadeMap/art/maps/vvardenfell/balmora_base_%d_reshademap.dds:format(i))
  11.     end
  12. end
  13.  
  14. EVENT_MANAGER:RegisterForEvent(ReshadeMap.appName, EVENT_ADD_ON_LOADED, ReshadeMap.OnAddOnLoaded)

Balmoras map Id=1290

It still does not work but I have no idea what I am doing wrong.
ESO complains as well: user:/AddOns/ReshadeMap/ReshadeMap.lua:6: ) expected near '/'

I guess there is no other method of exchanging the maps without having to get each map-Id?
  Reply With Quote
06/12/19, 12:58 PM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,259
Your code contains some mistakes. It should look like this:
Lua Code:
  1. ReshadeMap = {}
  2. ReshadeMap.appName = "ReshadeMap"
  3.  
  4. local function ReplaceMapTextures(mapId, customTilePathTemplate)
  5.     local numX, numY = GetMapNumTilesForMapId(mapId)
  6.     local totalTiles = numX * numY
  7.     for i = 1, totalTiles do
  8.         RedirectTexture(GetMapTileTextureForMapId(mapId, i), customTilePathTemplate:format(i))
  9.     end
  10. end
  11.  
  12. function ReshadeMap.OnAddOnLoaded(_, addOnName)
  13.     if addOnName ~= ReshadeMap.appName then return end
  14.     ReplaceMapTextures(1290, "ReshadeMap/art/maps/vvardenfell/balmora_base_%d_reshademap.dds")
  15. end
  16.      
  17. EVENT_MANAGER:RegisterForEvent(ReshadeMap.appName, EVENT_ADD_ON_LOADED, ReshadeMap.OnAddOnLoaded)
__________________
Like what I do? Support me on Patreon!
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
  Reply With Quote
06/13/19, 01:01 PM   #5
LordBob
Join Date: May 2019
Posts: 8
Thank you sirinsidiator

Your code worked well (except the tiles were not in order).
Changing the looks of all maps somehow has to work with some kind of mass production method.
Otherwise it would take years to put together.

I found a list of all ESO textures which could be useful.
Having a look at "OblivionStyleHUD" by Half-Dead, I saw that the RedirectTexture method might also work by writing down the name of textures.
So hopefully an Excel script could put all of the map-paths in order.

In short: do you guys have any idea if something like this could work?

Lua Code:
  1. ReshadeMap = {}
  2. ReshadeMap.appName = "ReshadeMap"
  3.  
  4. local function ReplaceMapTextures()
  5.     RedirectTexture("art/maps/vvardenfell/balmora_base_0.dds", "ReshadeMap/vvardenfell/balmora_base_0.dds")
  6.     end
  7. end
  8.  
  9. function ReshadeMap.OnAddOnLoaded(_, addOnName)
  10.     if addOnName ~= ReshadeMap.appName then return end
  11.     ReplaceMapTextures()
  12. end
  13.      
  14. EVENT_MANAGER:RegisterForEvent(ReshadeMap.appName, EVENT_ADD_ON_LOADED, ReshadeMap.OnAddOnLoaded)
  Reply With Quote
06/14/19, 05:01 AM   #6
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,205
You are able to get the texture paths from your link and put them into an excel, then use excel formulas to build a lua table from it. It should look like this:

Lua Code:
  1. local mapTexturesOrig = {
  2. [1] = "/art/maps/map1.dds",
  3. [2] =...
  4.  
  5. }

And built another one with the replacement textures, or use the same folder structure in your addon's folder, inside a subfolder "textures" e.g.,so you can dynamically use it for a replacement from your addon folder.
ReshadeMap/textures/art/maps/vvardenfell...

With a loop over the table you can do the replacement then.

Lua Code:
  1. for index, textureNameOrig in ipairs(mapTexturesOrig) do
  2.    RedirectTexture(textureNameOrig, ReshadeMap.appName.. "/textures".. textureNameOrig)
  3. end

Last edited by Baertram : 06/14/19 at 05:07 AM.
  Reply With Quote
06/14/19, 12:13 PM   #7
LordBob
Join Date: May 2019
Posts: 8
Smile

It worked
Thank you so much.

The code looks like this:

Lua Code:
  1. ReshadeMap = {}
  2. ReshadeMap.appName = "ReshadeMap"
  3.  
  4. local mapTexturesOrig = {
  5.  
  6.     [1] = "/art/maps/vvardenfell/balmora_base_0.dds",
  7.     [2] = "/art/maps/vvardenfell/balmora_base_1.dds",
  8.     [3] = "/art/maps/vvardenfell/balmora_base_2.dds",
  9.     [4] = "/art/maps/vvardenfell/balmora_base_3.dds",
  10.     [5] = "/art/maps/vvardenfell/balmora_base_4.dds",
  11.  
  12. }
  13.  
  14. for index, textureNameOrig in ipairs(mapTexturesOrig) do
  15.    RedirectTexture(textureNameOrig, ReshadeMap.appName.. "/textures".. textureNameOrig)
  16. end
  17.      
  18. EVENT_MANAGER:RegisterForEvent(ReshadeMap.appName, EVENT_ADD_ON_LOADED, ReshadeMap.OnAddOnLoaded)

The following error message gets displayed:
Checking type on argument callback failed in ScriptEventManagerRegisterForEventLua
stack traceback:
[C]: in function 'RegisterForEvent'
user:/AddOns/ReshadeMap/ReshadeMap.lua:18: in function '(main chunk)'
|caaaaaa<Locals> mapTexturesOrig = tbl </Locals>|r
Somehow I don't manage to fix it. What kind of cookie would the event_manager like to have?
  Reply With Quote
06/14/19, 12:37 PM   #8
Wheels
AddOn Author - Click to view addons
Join Date: Feb 2017
Posts: 40
Does the function ReshadeMap.OnAddOnLoaded actually exist? That would appear to be the problem.
  Reply With Quote
06/14/19, 01:00 PM   #9
LordBob
Join Date: May 2019
Posts: 8
Originally Posted by Wheels View Post
Does the function ReshadeMap.OnAddOnLoaded actually exist? That would appear to be the problem.
Of course, thank you.

Is there anything else that I should add, so it doesn't cause any issues?

Lua Code:
  1. ReshadeMap = {}
  2. ReshadeMap.appName = "ReshadeMap"
  3.  
  4. local mapTexturesOrig = {
  5.  
  6.     [1] = "/art/maps/vvardenfell/balmora_base_0.dds",
  7.     [2] = "/art/maps/vvardenfell/balmora_base_1.dds",
  8.     [3] = "/art/maps/vvardenfell/balmora_base_2.dds",
  9.     [4] = "/art/maps/vvardenfell/balmora_base_3.dds",
  10.     [5] = "/art/maps/vvardenfell/balmora_base_4.dds",
  11.     [6] = "/art/maps/vvardenfell/balmora_base_5.dds",
  12.     [7] = "/art/maps/vvardenfell/other_map_1.dds",
  13.     [8] = "/art/maps/vvardenfell/other_map_2.dds"
  14.  
  15. }
  16.  
  17. for index, textureNameOrig in ipairs(mapTexturesOrig) do
  18.    RedirectTexture(textureNameOrig, ReshadeMap.appName.. "/textures".. textureNameOrig)
  19. end
  20.      
  21. EVENT_MANAGER:RegisterForEvent(ReshadeMap.appName)

Edit: The ESO textures List is incomplete. Does anyone know a good tool I could use to copy the texture paths myself?

Edit2: As soon as I add a second map, the added map does not show anymore. Sorry for asking so many questions. Do I have to split the "local mapTexturesOrig" function?

Last edited by LordBob : 06/14/19 at 03:16 PM.
  Reply With Quote
06/14/19, 03:52 PM   #10
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,205
Lua Code:
  1. ReshadeMap = {}
  2. ReshadeMap.appName = "ReshadeMap"
  3.  
  4. function ReshadeMap.OnAddOnLoaded()
  5. local mapTexturesOrig = {
  6.  
  7.     [1] = "/art/maps/vvardenfell/balmora_base_0.dds",
  8.     [2] = "/art/maps/vvardenfell/balmora_base_1.dds",
  9.     [3] = "/art/maps/vvardenfell/balmora_base_2.dds",
  10.     [4] = "/art/maps/vvardenfell/balmora_base_3.dds",
  11.     [5] = "/art/maps/vvardenfell/balmora_base_4.dds",
  12.  
  13. }
  14.  
  15. for index, textureNameOrig in ipairs(mapTexturesOrig) do
  16.    RedirectTexture(textureNameOrig, ReshadeMap.appName.. "/textures".. textureNameOrig)
  17. end
  18. end
  19.      
  20. EVENT_MANAGER:RegisterForEvent(ReshadeMap.appName, EVENT_ADD_ON_LOADED, ReshadeMap.OnAddOnLoaded)

The addon loads the code from top to bottom as soon as the lua file is loaded so make sure it will be at event_add_on_liaded first or the maps might not be ingane loaded properly if you try to do it before.
You can even try to load all at event_player_activated if the game tries to replace the Textures again after a zone change.

Last edited by Baertram : 06/14/19 at 03:57 PM.
  Reply With Quote
06/15/19, 04:17 AM   #11
LordBob
Join Date: May 2019
Posts: 8
A big thank you to all of you. It is fully working now.

The maps not being visible was due a missing / in the Excel formula.

...now I only need to manage to convince XnConvert to not double the .dds size...

Edit:
For anyone trying to do something similar:

TexConv got used to compress .dds files.
(use Max Compress and BT1_UNIFORM)

To get the full filepath list I used DirPrintOK, exported a .txt and used Notepad++ to fix the list so it could get used in Excel (LibreCalc).

The mod is now fully functional and including all available maps. Behavior: When you first open up a large map you notice it load (very quickly). There is no visible loading time when reopening a map.

The maps got optimized for "Yet Another ReShade Preset" (which is great btw) after changing the following settings:

[FakeHDR.fx]
HDRPower=1.035000
radius1=0.906000
radius2=0.880000

[Colourfulness.fx]
colourfulness=0.067000
lim_luma=0.702000
enable_dither=0
col_noise=1
backbuffer_bits=8.000000

[Tonemap.fx] fog color to FogColor=0.027451,0.027451,0.027451


Thanks again for all the help

Last edited by LordBob : 06/15/19 at 02:43 PM.
  Reply With Quote
06/16/19, 03:16 PM   #12
LordBob
Join Date: May 2019
Posts: 8
Post

ReshadeMap can be found on NexusMods
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Is it possible to change ingame Map colors?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off