A HLSL Shader Toolkit for SWBFII - WIP

Working on a new map? Have a new mod out for swbf2?! Post an announcement of the up-coming release here.

Moderator: Moderators

First Lance Corporal
Posts: 138
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby SleepKiller » Wed Nov 29, 2017 6:28 am

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!

Posts: 3
Joined: Sun Nov 26, 2017 6:22 am
Projects :: No Mod project currently.
Games I'm Playing :: BF2
xbox live or psn: No gamertag set

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby 0dium » Wed Nov 29, 2017 3:43 pm

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.

1st Lieutenant
User avatar
Posts: 428
Joined: Sun Sep 14, 2008 12:55 pm
Projects :: Currently Working on an Indie Game
Games I'm Playing :: Splatoon 2
xbox live or psn: Stm: Tight Verbage

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby The Nasal Abyss » Wed Nov 29, 2017 9:19 pm

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? :)

Sith
User avatar
Posts: 1446
Joined: Thu Jan 23, 2014 6:01 am
Location: Right behind you :)
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby thelegend » Fri Dec 01, 2017 5:07 am

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.

First Lance Corporal
Posts: 138
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby SleepKiller » Fri Dec 01, 2017 7:11 am

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?

Master of the Force
User avatar
Posts: 4753
Joined: Sat Sep 19, 2009 11:37 am
Location: Mos Espa (germany)
Projects :: Republic Commando Side Mod

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby Anakin » Fri Dec 01, 2017 8:03 am

:shock: Those normals

Can you make before after screenshots??

Resistance Leader
Online
User avatar
Posts: 5063
Joined: Tue Feb 09, 2010 8:43 pm
Location: Los Angeles, CA
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: BF4 + DEHR
xbox live or psn: Marth8880

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby Marth8880 » Fri Dec 01, 2017 1:47 pm

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.

First Lance Corporal
Posts: 138
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby SleepKiller » Fri Dec 01, 2017 9:45 pm

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.

Resistance Leader
Online
User avatar
Posts: 5063
Joined: Tue Feb 09, 2010 8:43 pm
Location: Los Angeles, CA
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: BF4 + DEHR
xbox live or psn: Marth8880

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby Marth8880 » Sat Dec 02, 2017 6:31 pm

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.

First Lance Corporal
Posts: 138
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby SleepKiller » Sat Dec 02, 2017 8:19 pm

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.

Resistance Leader
Online
User avatar
Posts: 5063
Joined: Tue Feb 09, 2010 8:43 pm
Location: Los Angeles, CA
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: BF4 + DEHR
xbox live or psn: Marth8880

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby Marth8880 » Sat Dec 02, 2017 8:21 pm

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! :)

Sith
User avatar
Posts: 1446
Joined: Thu Jan 23, 2014 6:01 am
Location: Right behind you :)
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby thelegend » Sat Dec 09, 2017 8:00 am

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.

Resistance Leader
Online
User avatar
Posts: 5063
Joined: Tue Feb 09, 2010 8:43 pm
Location: Los Angeles, CA
Projects :: EVERYWHERE + Zero Munge + TCW
Games I'm Playing :: BF4 + DEHR
xbox live or psn: Marth8880

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby Marth8880 » Sat Dec 09, 2017 4:25 pm

@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
}

First Lance Corporal
Posts: 138
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: A HLSL Shader Toolkit for SWBFII - WIP

Postby SleepKiller » Tue Dec 12, 2017 6:29 pm

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!

Previous

Return to SWBF2 Map/Mod Works In Progress

Who is online

Users browsing this forum: No registered users and 1 guest