Light bleeding through custom model

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

Light bleeding through custom model

Post by Phitt »

On some of my custom models light bleeds through in a strange way. As can be seen here the wall has some lighting issues. The part that is close to the party works fine, a bit farther away there is a small stripe on the lower part as if the roof would cause shading/lighting issues and even farther away the whole wall has strange interlaced shadows on it. At first I thought this is just to save performance since it is quite clear that the shadows look worse the farther away they are from the player, but then I tried with the forest_ruins_wall and this is the result - no shadow bugs at all. I made sure that there is absolutely no way light could shine through the model, all vertices are welded, it's a solid mesh.

Also, on the pagoda in the distance the same 'interlace' shadow effect can be seen (it vanishes if you get closer), I can't remember that from the original game. Any ideas?

EDIT: After testing the models in a dungeon environment (without sky light source) I realized there is something fundamentally wrong with them. The lighting is completely messed up with a stronger light source. I assume it's either the wrong normal map settings I use or a weird export issue. I guess it's time for trial and error. :(
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

Re: Light bleeding through custom model

Post by Phitt »

Nevermind, I exported as 3ds, which was causing errors. If exported as ASE the models work fine. However, there are two other problems now:

1. Normal maps - again - don't work as expected. I remember that in Grimrock the green channel had to be inverted (invert Y when saving as normal map) for the normal map to work properly. But this doesn't do the trick anymore. I tried with and without inverting all possible channels, I tried with Leki's custom method and by saving as DXT5_nm. But the lighting is always off and not as it should be. Does anyone have settings that give a 100% correctly working normal map?

2. There seem to be small bumps in the surface when there is a heightmap present. As can be seen (if you look very closely) the walls have tiny height differences, causing them to not match each other 100%. It's not noise, I made sure there is no noise. I also made sure that the next height difference (heightmap height) is at least 1 full tile away from the wall. So it stands on completely flat ground with no noise, yet there are tiny height differences (I estimate about 0.03 units maybe). Why does this happen?

EDIT: And nevermind again, seems like the normal map problem was related to the wrong export settings somehow. But there is still the problem with the small bumps I don't understand (easily visible on the new screenshot).

EDIT2: Aaaand...seems like the heightmap elevation is lowered over 2 full tiles so the next heightmap difference needs to be 2 full tiles away for a 100% even ground. That's why there were those tiny gaps.
User avatar
Jouki
Posts: 127
Joined: Fri Oct 24, 2014 12:57 pm

Re: Light bleeding through custom model

Post by Jouki »

OT: wow it looks amazing these models. I guess there's no chance you would share them :lol:
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Light bleeding through custom model

Post by Batty »

Very impressive scene! Really like the bamboo and the decay on the wall, already looking forward to playing this! :D I guess this means we are traveling to the Eastern Realms? :o

I was playing with height maps indoors and yes, you get an initial, barely noticeable bump-up in height next to even the lowest height adjustments. I had to walk on it many times because it's so low, I didn't know what was happening.
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

Re: Light bleeding through custom model

Post by Phitt »

@Jouki: Yes, of course I will share the models when I'm done with them (which will take quite a bit of time though since there are a lot of models and things I have in mind for my mod).

@Batty: I had several things in mind (like a Steampunk Ratling environment or an Arabian Nights style mod), but in the end after playing Shadow Warrior I decided to do a Far Eastern themed mod. Now I only need Ninja Ratlings...and possibly Ninja turtles?

And a general information regarding normal maps: To get a correct result you need to do the following steps if you create normal maps with the nVidia Photoshop plugin. There may be an easier way (I assume there are settings that allow you to skip steps 2+3 somehow), but this is how it works for me:

1. Do the usual 'create tangent space normal map' export. Either export the normal with Y set to inverted or

1a. Invert the green channel after reloading the normal map.

2. Copy the green channel into the alpha channel (if you have no alpha channel simply create it by duplicating the green channel).

3. Copy the red channel into the green channel.

4. Courtesy of Leki: Fill the red and blue channels with black color to improve the quality of the channels that matter.

5. Save the normal map as DXT5 (ARGB), obviously without the 'create tangent space normal' setting ticked.
Post Reply