SimSun Shader - Simulated directional light for models

Re: SimSun Shader - Simulated directional light for models

Postby Graf Zahl » Wed Mar 18, 2020 12:50 am

dpJudas wrote:2) The physical correct falloff is actually not to convert it to an angle. Light level should be "float lightLevel = clamp(dot(l,n), 0.0, 1.0);".


For a case like this, where it's only supposed to improve contrast, wouldn't it make sense to keep a certain amount of ambient light?, e.g.

float lightLevel = 0.4 + 0.6 * clamp(dot(l,n), 0.0, 1.0);

?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: SimSun Shader - Simulated directional light for models

Postby Cherno » Wed Mar 18, 2020 5:37 am

Thanks for the suggestions and help. If the shader is improved in any way by it, I am more than willing to change the code :)
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: SimSun Shader - Simulated directional light for models

Postby dpJudas » Wed Mar 18, 2020 7:33 am

Graf Zahl wrote:For a case like this, where it's only supposed to improve contrast, wouldn't it make sense to keep a certain amount of ambient light?, e.g.

float lightLevel = 0.4 + 0.6 * clamp(dot(l,n), 0.0, 1.0);

?

Yes, it would.

Overall doing this in the material shader is problematic anyway as it changes the base color that then in turn is used by dynamic lights. I created a lightlevelcontrast branch that does it at right point in the fragment shader. Currently it is applying it to everything (so walls and flats, too), but both contrast strength and which object types we want to apply it to could be configurable by changing the strength variable to an uniform. Or the uniform could be controlled by the texture, like the SimSun Shader is doing.
dpJudas
 
 
 
Joined: 28 May 2016

Re: SimSun Shader - Simulated directional light for models

Postby Cherno » Sat Mar 28, 2020 4:22 pm

Update:
SimSun 1.1
Corrected the lightdir shader variable so it now doesn't need an inverted z value.
Shifted the light level by 0.25 to lessen the amount of extremely dark areas.
Added a cube model to the TESTMAP.

See first post for the latest version.
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: SimSun Shader - Simulated directional light for models

Postby 3336655445 » Mon Mar 30, 2020 9:26 pm

stupid question: is this mod (?) working fine with LZDoom?
edit answer: yes it works with LZDoom
3336655445
 
Joined: 24 Jul 2019
Location: Odessa
Discord: Счастливая трубка
Operating System: Other OS Not Listed Here
Graphics Processor: Not Listed

Re: SimSun Shader - Simulated directional light for models

Postby Kizoky » Sat Aug 14, 2021 3:08 am

I finally got tired of .bat files, so I wrote a program in C# for use with this shader:
https://github.com/Kizoky/simsun_output_gen
User avatar
Kizoky
I smell like gravity
 
Joined: 14 Nov 2011
Location: Around weirdos, I'm the biggest weirdo among them
Discord: Kizoky#0375
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: SimSun Shader - Simulated directional light for models

Postby Enjay » Sat Aug 14, 2021 5:27 am

I tried this by the drag-drop method and there was no output (in fact, Windows Explorer hung the first time that I tried and I had to reboot). After restarting, several tries with several different files didn't seem to be generating anything.

So I went to the command prompt and typed simsungen and got:

Code: Select allExpand view
A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:\Users\[username]\AppData\Local\Temp\.net\SimSunGen\c23qeulz.eur\].
If this is a framework-dependent application, install the runtime in the global location [C:\Program Files (x86)\dotnet] or use the DOTNET_ROOT(x86) environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation].

The .NET Core runtime can be found at:
  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x86&rid=win10-x86
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: SimSun Shader - Simulated directional light for models

Postby Kizoky » Sat Aug 14, 2021 6:25 am

Enjay wrote:I tried this by the drag-drop method and there was no output (in fact, Windows Explorer hung the first time that I tried and I had to reboot). After restarting, several tries with several different files didn't seem to be generating anything.

So I went to the command prompt and typed simsungen and got:

Code: Select allExpand view
A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:\Users\[username]\AppData\Local\Temp\.net\SimSunGen\c23qeulz.eur\].
If this is a framework-dependent application, install the runtime in the global location [C:\Program Files (x86)\dotnet] or use the DOTNET_ROOT(x86) environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation].

The .NET Core runtime can be found at:
  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x86&rid=win10-x86


Uh oh
Do you use Windows 10 or some earlier OS?

edit: nevermind, I know what's the issue here :(
Last edited by Kizoky on Sat Aug 14, 2021 6:34 am, edited 1 time in total.
User avatar
Kizoky
I smell like gravity
 
Joined: 14 Nov 2011
Location: Around weirdos, I'm the biggest weirdo among them
Discord: Kizoky#0375
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: SimSun Shader - Simulated directional light for models

Postby Enjay » Sat Aug 14, 2021 6:31 am

Windows 10 Pro 64-bit - fully updated.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: SimSun Shader - Simulated directional light for models

Postby Kizoky » Sat Aug 14, 2021 7:00 am

Enjay wrote:Windows 10 Pro 64-bit - fully updated.


Could you please go here (https://github.com/Kizoky/simsun_output ... es/tag/1.1) and download SimSunGen_L.exe ?
It seems I totally forgot how .NET apps work, with that app it should now work fine, ofc with the downside that it's file size is now much bigger :shock:

edit:
Above link is dead, use this: https://github.com/Kizoky/GLDEFGenerato ... s/tag/v1.0
Last edited by Kizoky on Sun Aug 15, 2021 2:40 pm, edited 1 time in total.
User avatar
Kizoky
I smell like gravity
 
Joined: 14 Nov 2011
Location: Around weirdos, I'm the biggest weirdo among them
Discord: Kizoky#0375
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: SimSun Shader - Simulated directional light for models

Postby Enjay » Sat Aug 14, 2021 11:44 am

That works, thank you kindly. :)
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Previous

Return to Shaders

Who is online

Users browsing this forum: No registered users and 1 guest