Experimental Sunsprite Shaders

share shaders here
  • Author
  • Message
Offline
User avatar
*blah-blah-blah maniac*
Posts: 17447
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Experimental Sunsprite Shaders

When time of the day enabled, time readed from sun direction on sky (most interior scenes don't have this, so from sky horizon color of background color). Shader variable ENightDayFactor use time of the day if it's available and properly interpolate values between night, sunrise, day, sunset by intensity equal to dot product of sun direction and ground plane with offsets to dusk and dawn and zero for entire night. ENightDayFactor in enbsunsprite.fx shader can't work because dusk and dawn time don't have sun at all and it's sprites also, so the only interpolation left is sunset->day->sunrise. Intensity for sunset/day/night or/and color is taken from SamplerColor in enbeffect.fx, basically it's sun, if the sun is the source of lenz fx, then only it affect them, right? Why then to bother with time of the day parameters in shader if sun must be modified? I don't see logic. Switching different lenz fx is much more useful feature, but i'm out of ideas what the trigger for this.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: Experimental Sunsprite Shaders

ENBSeries wrote:When time of the day enabled, time readed from sun direction on sky (most interior scenes don't have this, so from sky horizon color of background color). Shader variable ENightDayFactor use time of the day if it's available and properly interpolate values between night, sunrise, day, sunset by intensity equal to dot product of sun direction and ground plane with offsets to dusk and dawn and zero for entire night. ENightDayFactor in enbsunsprite.fx shader can't work because dusk and dawn time don't have sun at all and it's sprites also, so the only interpolation left is sunset->day->sunrise. Intensity for sunset/day/night or/and color is taken from SamplerColor in enbeffect.fx, basically it's sun, if the sun is the source of lenz fx, then only it affect them, right? Why then to bother with time of the day parameters in shader if sun must be modified? I don't see logic. Switching different lenz fx is much more useful feature, but i'm out of ideas what the trigger for this.
Agreed about the DNI interpolation.
What would be a good feature could be being able to sample from several different .tga..
_________________
Lian Li PC011 Dynamic, Corsair AX 1500i PSU, i9 10850K @5.0 Ghz, Aorus Z490 Ultra, RTX3090 MSI Gaming X Trio, 32GB Corsair Vengeance Pro RGB RAM@3600, Corsair MP600 1TB NVME System Drive, 10 TB Storage, W10 Pro 64, Custom Hard Tubing Watercooling Loop

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17447
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Experimental Sunsprite Shaders

Why? It's just extra coding for me and anyone may ask: "2 bitmaps not enough, i want 100". Create one huge bitmap and apply uv offset in vertex shader to each one, you can even make animated with this.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: Experimental Sunsprite Shaders

:lol:
That's true ! Personnally, I want 200 ! (just kidding...)

BTW, started to implement Timer... possibilities are endless, displacements, intensities... I'm amazed at how the enbsunsprite hasn't been worked enough before... :shock:
One question, though, how can I implement correctly Sun Intensity in it ?
_________________
Lian Li PC011 Dynamic, Corsair AX 1500i PSU, i9 10850K @5.0 Ghz, Aorus Z490 Ultra, RTX3090 MSI Gaming X Trio, 32GB Corsair Vengeance Pro RGB RAM@3600, Corsair MP600 1TB NVME System Drive, 10 TB Storage, W10 Pro 64, Custom Hard Tubing Watercooling Loop

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17447
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Experimental Sunsprite Shaders

SamplerMask is sun covered by clouds, blurred a little, so it's color of sun and it's intensity. In version i'll release today will be hdr texture data, if enabled by new parameter.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17447
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Experimental Sunsprite Shaders

Done, colored hdr texture. But decided not to make new variable to turn on hdr SamplerMask texture, not many users changing this shader file, so nobody will notice difference.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: Experimental Sunsprite Shaders

ENBSeries wrote:... not many users changing this shader file, so nobody will notice difference.
This will CHANGE ! ;) Many experimented users are now looking into it.
And thank you !
Implemented Timer for visibility and position of each draw technique ;)
Reorganized the file with #define for each var and defines for enable/disable with classic #ifdef / #else / #endif toggles in code of each pass. (Timer usage or not, some may prefer fixed lines of flares... but it's a TON better with some move, you get some LIFE !)
This shader will become something good I think.
The plus is : NO performance loss.
Waiting for new version to publish.

Oh.... last question : is it possible to implement some kind of blur on lenzes to avoid sharp edges of texture ? Is there an uniform var for this, or do I have to set some piece of precise code in PS ?

EDIT : speaking about users interest... The file reached Hot Files on Nexus in 2 days... :shock:
And it's a beta-staged sunsprite shader... :shock: :shock:
_________________
Lian Li PC011 Dynamic, Corsair AX 1500i PSU, i9 10850K @5.0 Ghz, Aorus Z490 Ultra, RTX3090 MSI Gaming X Trio, 32GB Corsair Vengeance Pro RGB RAM@3600, Corsair MP600 1TB NVME System Drive, 10 TB Storage, W10 Pro 64, Custom Hard Tubing Watercooling Loop

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17447
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Experimental Sunsprite Shaders

I don't know what do you mean by sharp edge of texture. Bilinear filtering makes part of image visible on quad edges? Then only modifying texture file, nothing else. Btw, i recommend to move most math to vertex shader, even sampling mask and pow it (in my code as example). Texture read in vertex shader must be tex2Dlod with 4 components vector of uv coordinates and .w=0.0; otherwise it will fail to compile.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: Experimental Sunsprite Shaders

Go it about maths ;)
I'll edit some offsets and move some operations right here.

What do I mean by sharp edges ?...
Sometimes it's nice to have DEFINED sprites, sometimes I'd wish some remain defined while others on the same Draw passes could be blurred.
I'll do simpler, in my rookie's language ;) : is it possible to apply and especially control blur via the shader itself ?

Or maybe apply some gaussian blur via offsets themselves ?...
_________________
Lian Li PC011 Dynamic, Corsair AX 1500i PSU, i9 10850K @5.0 Ghz, Aorus Z490 Ultra, RTX3090 MSI Gaming X Trio, 32GB Corsair Vengeance Pro RGB RAM@3600, Corsair MP600 1TB NVME System Drive, 10 TB Storage, W10 Pro 64, Custom Hard Tubing Watercooling Loop

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17447
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Experimental Sunsprite Shaders

Not sure that understood what you want. You can blur sprite before drawing it by sampling several pixels (at cost of performance). Simpler will be to modify texture itself, the atlas of images may have several sizes and you just need to blend two of them (and compute which one). Also you can make not pixel perfect sampling and interpolate sampled pixels by cubic filter, if texture is simple, then it's not buggy and fast. At last you can make procedural lenzes, especially many of them in single pass, texture can be factor of functions.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7
Post Reply