Page 2 of 2

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Wed Nov 29, 2017 6:28 am
by SleepKiller
Well it's done find the fancy release thread here.
0dium wrote:[*]Tried to munge a map with one bumpmap replaced with a proper normalmap and it worked just fine. Well there is no point in converting heightmap to normalmap by yourself if it happens automatically in munging process.
[*]Sometimes lighting looks weird on surfaces but it's not a big problem.
[*]One problem is that a lot of surfaces still look flat and relief can only be seen when dynamic light sources are nearby (rifle shots, explosions). Sometimes relief can be seen under a sunlight but only in rare occasions. And that is not a very realistic behavior. Looks like sunlight must be dropping from a very specific angle or IDK.
I think I know what you're talking about. So much so that I very recently made some changes to the normal mapping implementation and I believe it has improved it. If you try out the release versions of the shaders be sure to tell me if it has!

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Wed Nov 29, 2017 3:43 pm
by 0dium
That's definitely an improvement. Looks great. Looks like it's time to try retexturing a map.
Diet Dr. Pepper Zeroeditor doesn't want to run.

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Wed Nov 29, 2017 9:19 pm
by The Nasal Abyss
0dium wrote:That's definitely an improvement. Looks great. Looks like it's time to try retexturing a map.
Diet Dr. Pepper Zeroeditor doesn't want to run.
Care to upload some quick screenshots for those of us who are curious and don't have the modtools any longer? :)

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Fri Dec 01, 2017 5:07 am
by thelegend
I really like this. The new normal maps do have some difference in a good direction as clearly seen here:
Hidden/Spoiler:
Image
Also something I noticed is the render distance of light sources (such as omni-lights and/or cone-lights):
Hidden/Spoiler:
Image
The yellow and purple light are not supposed to be visible there because they are farer away.

The same thing also happens to command posts as their light is clearly seen on the ground even behind multiple walls:
Hidden/Spoiler:
Image

Maybe it's because of my over-increased distance settings for my maps. I usually (for legacy at least) have set them to a maximum. Maybe this explains why some of my lights are seen from a distance out of any boundary (whether its light size (scale of a room for example) or behind multiple walls).

Otherwise They look fantastic ingame and gives this old game a new, fancy feel. I am really excited what else might be possible by rewriting shaders for this game. There are for sure some people with a better understanding of HLSL and they will indeed surprise us with more new stuff. Thank you for making this, Sleepkiller.

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Fri Dec 01, 2017 7:11 am
by SleepKiller
Ahh, interesting, definitely seems as though it is a problem with the shaders. I look forward to learning what I did wrong. Are you able to post/point me to/send me the map that is happening on? (A minimalistic example with source files would obviously be preferred but I can get by just fine off a full munged map.)

Also, am I correct that it is the specular highlights being rendered when they shouldn't be? And it's being caused by lights that aren't directional?

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Fri Dec 01, 2017 8:03 am
by Anakin
:shock: Those normals

Can you make before after screenshots??

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Fri Dec 01, 2017 1:47 pm
by Marth8880
SleepKiller wrote:Also, am I correct that it is the specular highlights being rendered when they shouldn't be? And it's being caused by lights that aren't directional?
That appears to be the case, yeah. To put it slightly more technically, seems that light sources aren't being occluded in the specular pass with lights that have a 3D position in world-space.

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Fri Dec 01, 2017 9:45 pm
by SleepKiller
Marth8880 wrote:That appears to be the case, yeah. To put it slightly more technically, seems that light sources aren't being occluded in the specular pass with lights that have a 3D position in world-space.
Thanks for confirming it, it helped let me know what to focus on.

I've tracked down and fixed the problem. I was normalizing the direction between the light and surface being lit before taking it's length. The resulting effect was the shader thought each light was about only one metre away. The repository contains the fix and I've also updated the prebuilt core.lvl on the release page.

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Sat Dec 02, 2017 6:31 pm
by Marth8880
SleepKiller wrote:I've also updated the prebuilt core.lvl on the release page.
Having trouble finding this. I downloaded the latest release from here: https://github.com/SleepKiller/swbfii_s ... t/releases
but the ZIP file doesn't contain any LVL files.

It's also hard to find any of the links in this thread since the forum's dark theme (which I use because the Artodia theme is kinda garbo tbh) doesn't automatically make links white.

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Sat Dec 02, 2017 8:19 pm
by SleepKiller
Marth8880 wrote:
SleepKiller wrote:I've also updated the prebuilt core.lvl on the release page.
Having trouble finding this. I downloaded the latest release from here: https://github.com/SleepKiller/swbfii_s ... t/releases
but the ZIP file doesn't contain any LVL files.

It's also hard to find any of the links in this thread since the forum's dark theme (which I use because the Artodia theme is kinda garbo tbh) doesn't automatically make links white.
Ah, sorry, I didn't realize that. If I manually make links bold and underlined does that help their visibility? For instance this is a link to the Release Thread.

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Sat Dec 02, 2017 8:21 pm
by Marth8880
SleepKiller wrote:Ah, sorry, I didn't realize that. If I manually make links bold and underlined does that help their visibility? For instance this is a link to the Release Thread.
Yes! Much better, thanks! :)

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Sat Dec 09, 2017 8:00 am
by thelegend
There is one bug that sometimes bother me a bit. I am not sure f it's the new munged core.lvl or maybe just my shadows on my maps. Sometimes when I turn into another direction the shadow (which is now darker and I really like it) sometimes glicthes back to the old bf2 shadow and when I turn again it goes back to the new shadow. It doesn't seem to happen on the stock maps. Maybe it's because I have to huge shadow volumes or they might have bugs like cut edges etc. I still think it's on my end since it doesn't seem to happen for the default maps at all.
Hidden/Spoiler:
Image
Hidden/Spoiler:
Image
Another thing I noticed: Sometimes the shadow-volumes on a character seem to become visible. But only at certain places and mostly randomly:
Hidden/Spoiler:
Image
Otherwise I didn't find any other bugs and really love the fact that Normal maps look so much better now as well as the much "stronger" shadows.

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Sat Dec 09, 2017 4:25 pm
by Marth8880
@SleepKiller: On the topic of shadows, would you mind keeping the same shadow darkness that the default shaders have? Reason why is because you can actually set the shadow intensity via a map's ENVFX file with the "Shadow" effect like so:

Code: Select all

Effect("Shadow")
{
	Enable(1);				// whether or not shadows should be enabled
	BlurEnable(0);			// whether or not to blur the shadows (doesn't seem to work)
	Intensity(0.82);			// intensity of the shadow - higher value means less intense shadows
}

Re: A HLSL Shader Toolkit for SWBFII - WIP

Posted: Tue Dec 12, 2017 6:29 pm
by SleepKiller
Marth8880 wrote:@SleepKiller: On the topic of shadows, would you mind keeping the same shadow darkness that the default shaders have? Reason why is because you can actually set the shadow intensity via a map's ENVFX file with the "Shadow" effect like so:

Code: Select all

Effect("Shadow")
{
	Enable(1);				// whether or not shadows should be enabled
	BlurEnable(0);			// whether or not to blur the shadows (doesn't seem to work)
	Intensity(0.82);			// intensity of the shadow - higher value means less intense shadows
}
It should already be respected. However I did notice that terrain shadows were far darker than they should have been, the repository contains the fix. If I get the time I'll setup a test map and investigate more thoroughly to make sure the shadows are correct though. If you do spot conditions that cause shadows (or anything really) to be rendered incorrectly be sure to let me know, it could easily save me a lot of time.

I'll update the prebuilt core.lvl once I've fixed an issue with projected textures that aren't going through the per-pixel shader and (hopefully) the issue with shadows showing up on models. I thought the latter was related to the stencilshadow shader extruding them incorrectly but this doesn't actually seem to be the case.

EDIT:
I've fixed the projected texture issue which also seems to have been causing the shadow volumes to show up unextruded on models.

The issue was with the compiler and both the prebuilt compiler and core.lvl in the release thread have been updated with the fix. (And obviously the repository has it as well.) If anyone discovers more problems with the shaders/toolkit be sure to let me know!