kirides / GD3D11

D3D11-Renderer for Gothic and Gothic 2
GNU General Public License v3.0
200 stars 18 forks source link

Normal Maps are not working (edit: they work.. sometimes) #164

Open vurt72 opened 4 weeks ago

vurt72 commented 4 weeks ago

i am running The Chronicles of Myrtana.

I have placed my normal maps (.dds files, no alpha) in

C:\Program Files (x86)\Steam\steamapps\common\TheChroniclesOfMyrtana\system\GD3D11\Textures\Replacements\Normalmaps_TheChroniclesOfMyrtana i have also tried C:\Program Files (x86)\Steam\steamapps\common\TheChroniclesOfMyrtana\system\GD3D11\Textures\Replacements\Normalmaps_ChroniclesOfMyrtana

I have no idea what it expects, where it finds this "mod name" which is required, and which of them is the correct one. It might even be the polish name.

If i turn on the normal maps in the renderer i can very vaguely see some black specks, if the lighting is allowing it. I can also see that characters gets a normal map. so its likely just a default normal map texture that applies to everything and not my normal map textures.

And yes i have my own texture pack for CoM that i created and now i created normals as well.

vurt72 commented 4 weeks ago

I am guessing that these packs must somehow be "approved" by the engine?

Because I know for my old texture pack it had to be named replacements_vurt. i just found the file on the internet so i checked how it was made (named).

Would be great if things like this could be explained on the page.

kirides commented 4 weeks ago

This should still hold true, maybe they broke with a recent version?

https://forum.worldofplayers.de/forum/threads/1546222-Yet-Another-D3D11-Renderer

Normalmaps gehören in ein Mod-Spezifisches Verzeichnis in dem Verzeichnis "Gothic\system\GD3D11\textures\replacements\"

Normalmaps für das normale Spiel, kommen in das Verzeichnis "Normalmaps_Original" (ggf. anlegen wenn nicht vorhanden)

Bei Modifikationen ist lautet der Name "Normalmaps_{MOD}". Für Atariar findet man den Namen so heraus:

In den "Gothic\System"-Ordner gehen
nach einer Datei mit dem Namen "Atariar" ausschau halten.
Die Datei die wir suchen heißt "Gothic2_Atariar.ini"
Von der Datei entfernen wir nun das ".ini" und es bleibt "Gothic2_Atariar".
Unser Verzeichnis lautet damit "Normalmaps_Gothic2_Atariar"

Diese Art der Normalmaps-Ablage ermöglicht Mod-Spezifische Normalmaps. Z.B. L'Hiver Normalmaps wenn man L'Hiver spielt und keine wenn man normales Gothic spielt.

vurt72 commented 3 weeks ago

This should still hold true, maybe they broke with a recent version?

yeah it's broken. I also let another person try it (he's a programmer + he's just better technically with G2/modding than i am). He says it just doesn't work.

vurt72 commented 3 weeks ago

edit: ok, it seems to be down to the format, dds must use BC1. it works for Chronicles of Myrtana if the folder is named normalmaps_thechroniclesofmyrtana

kirides commented 3 weeks ago

i'm glad you could figure this out.

i'll add a note for that sometime in the future (or maybe someone wants to open a PR to mention Normalmaps and their limitations in the readme? :) )

vurt72 commented 3 weeks ago

BC3/DXT5 also works (has Alpha).

I have seen many texture packs that uses the diffuse texture in the alpha channel. Very unsure if this really adds anything? I have mine without and it looks fine.

vurt72 commented 3 weeks ago

Ok so they've stopped working, and i have no idea why. i did mess around with Union, trying to get that to work when it suddenly didn't work any longer, after that it seems like the normals just decided to not work.

So I made a reinstall of the game and the latest nightly build of the renderer. Didn't install Union or anything else, just the normal maps and my texture mod. But no, no change any longer with normals on or off.

My other friend who's also testing this is experiencing the same, it's super easy to break the normals from functioning at all, and impossible to know what even broke it or how to get it to work again.

Edit: yeah, second day of this, not working in Chronicles of Myrtana, tried a bunch of stuff. It's so strange, they worked perfectly once (i made sure to make the default normal maps dds blank to not get tricked by them). Not the slightest clue what made them kick-in.

vurt72 commented 3 weeks ago

I have my texture pack with normal maps here if you want to test it out in Chronicles of Myrtana, or G2.

Can you get the normal maps to work in CoM?

https://www.nexusmods.com/gothic2/mods/91

The normal maps is a separate download, under Optional files. Also read the FAQ or there's a chance my textures won't show up due to how it works with mods and the date set for the mod.

kirides commented 3 weeks ago

i'll try to find some time looking at it.

maybe/hopefully it's something simple to fix.

kirides commented 3 weeks ago

@vurt72 can you tell me what is not working? i tried the normalmaps and atleast something is happening.

https://github.com/user-attachments/assets/6d99872f-0494-4b4a-b931-fb6c97e2ae41 https://github.com/user-attachments/assets/d6a43231-951b-4c34-8a10-3493520ce6d4

some normal maps were broken though, as they used RGBA32 textures instead of BC1 or BGRA

you can convert all normal maps using something like this

> mkdir converted
> texconv.exe -o converted -f B8G8R8A8_UNORM *.dds

for compression use BC1 (or appropriate)

> mkdir converted
> texconv.exe -o converted -f BC1_UNORM *.dds

EDIT: i also just updated the renderer so that it will output the name of the failing normal/fx map in the log

Error: [D:\git\github\GD3D11\D3D11Engine\D3D11Texture.cpp(59), enum XRESULT __thiscall D3D11Texture::Init(const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)]: failed with code: -2147024846!
Warning: [D:\git\github\GD3D11\D3D11Engine\D3D7\MyDirectDrawSurface7.cpp(134), void __thiscall MyDirectDrawSurface7::LoadAdditionalResources(class zCTexture *)]: Failed to load normalmap: system\GD3D11\textures\replacements\Normalmaps_DIECHRONIKENVONMYRTANA\KM_CITY_BODENDIELEN_02_normal.dds
vurt72 commented 2 weeks ago

Yeah i know, i forgot to resave some of the later ones i did in Photoshop. I have an AI that makes them + saves in .dds, but in the wrong format.

For some reason it works again now.. i don't know, i reinstalled the entire thing. Maybe it was just me all along that messed up something, they always worked in Gothic 2.

Great to have that in the log though! Much appreciated!