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: 25 Jul 2019
Location: Odessa
Discord: Счастливая трубка
Operating System: Other OS Not Listed Here
Graphics Processor: Not Listed

Previous

Return to Shaders

Who is online

Users browsing this forum: No registered users and 0 guests