[SKYRIM] Modular Shader Library, updated to V5

share shaders here
  • Author
  • Message
Offline
User avatar
*blah-blah-blah maniac*
Posts: 1938
Joined: 05 Mar 2012, 02:08

Re: [HLSL CODE] Modular Shader Library, updated to V2

Updated the shader library, see change log at the bottom of the first comment.

Offline
User avatar
Posts: 27
Joined: 02 Jan 2015, 17:58

Re: [HLSL CODE] Modular Shader Library, updated to V2

Thank you for your PM. Couldn't reply since I haven't been registered long enough. ;)

Been using this reference from Microsoft, but it's good to have an alternative.

Your link pointed to the smoothstep function. Do you think it would be beneficial to use that instead of lerp, for night/day interpolation? As I understand it, lerp is linear, where smoothstep can interpolate along a curve. This might be useful for configuring the sunset and sunrise transition. This isn't something I've spent a lot of time on yet, so I don't know if that is even necessary, but I would imagine it might have some benefits.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1938
Joined: 05 Mar 2012, 02:08

Re: [HLSL CODE] Modular Shader Library, updated to V2

You're welcome :)
The Nvidia site offers, on some references, a more detailed explanation and examples than what Microsoft does.

I was just refreshing my memory to see if it would serve a better function than lerp for my Interior Dungeon seperation code, the implementation of it still needs work to behave as I want it to.
I haven't personally dable with it and I have yet to find the need for a shader sunset and sunrise control split.
To be honest I haven't worked much with the smoothstep so I can't really suggest the one over the other.

Offline
*sensei*
Posts: 373
Joined: 07 Mar 2013, 10:14

Re: [HLSL CODE] Modular Shader Library, updated to V2

Edit: Was thinking of something else... this made no sense what so ever! Lerp and smoothstep are not the same function.
Last edited by Aiyen on 15 Jan 2015, 23:35, edited 1 time in total.

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: [HLSL CODE] Modular Shader Library, updated to V2

or you can use WeatherAndTime to create a custom curve for day/night value, or even add more time nodes.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1938
Joined: 05 Mar 2012, 02:08

Re: [HLSL CODE] Modular Shader Library, updated to V2

Day, Dusk, Sunset, Night, Dawn, Sunrise for both exterior and interior :lol:

Offline
*sensei*
Posts: 373
Joined: 07 Mar 2013, 10:14

Re: [HLSL CODE] Modular Shader Library, updated to V2

Oh dear... did that once, the extra customization is just not worth the massive extra amount of entries. Also it depends entirely on the ToD settings, as well as any mods that might alter it.
Finally you can get a much nicer result simply making an .esp with altered dawn and dusk gradients. But again having the correct base colors is always better then trying to use post processing to force different hues.

But I do look forward to looking at the massive addition jawz! I am sure it will be glorious! :D

Offline
*sensei*
Posts: 372
Joined: 28 Jul 2013, 23:26

Re: [HLSL CODE] Modular Shader Library, updated to V2

functionality of smoothstep and lerp are entirely different?

lerp(x, y, s)
interpolate between x and y based on s

smoothstep(x, y, s)
output 0 when s<=x and 1 when s>=y, and between an interpolation between x and y

so essentially the power lays in using them combined

lerp(x, y, smoothstep(z, w, inputfactor))

Jawz, for your dungeon separation I'd suggest you look into step() function..
http://msdn.microsoft.com/en-us/library ... s.85).aspx

ie...

variable=lerp(lerp(var_night, var_day, ENightDayFactor), lerp(var_city, var_dungeon, step(dungeon_value, imagespace_trigger), EInteriorFactor);

Not sure how it would co-exist next to AGCC. Unless you just don't use that, or not use all of it and reserve a value for the dungeon triggers. Otherwise you get some if block to set dungeon on start of shader like

float set_dungeon=0;
if(imagespace_value>1.000045 && imagespace_value<1.000055) set_dungeon=1;

and use a lerp function in rest of shader to process that. Which is likely more efficient than doing a check in each lerp function using step() (which is basically an if statement)

Offline
*sensei*
Posts: 373
Joined: 07 Mar 2013, 10:14

Re: [HLSL CODE] Modular Shader Library, updated to V2

You are ofc. right prod! What the hell was I then thinking about earlier.... hmmm
I know at one point I was dabbling with some sort of function to replace lerp functionality, and found nothing that was as efficient. Or perhaps it was between the intristic smoothstep and a custom one... I know we did discuss that at some point!

Too long ago! But any way the above post is just wrong and I guess I will just edit it out to avoid any confusion.

Thanks for clearing it up and interesting suggestion!

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1938
Joined: 05 Mar 2012, 02:08

Re: [HLSL CODE] Modular Shader Library, updated to V2

Well until I have come up with the function I want, this works just fine;

Code: Select all

lerp(lerp(NIGHTEXT, DAYEXT, ENightDayFactor), lerp(INTERIOR, DUNGEON, inReg.z == 1.000001), EInteriorFactor);
And as for as I can see, the end results between this and your example is similar.
Post Reply