[WIPzRELz] Sun shaft rays

Post » Tue May 08, 2012 11:31 am

This is a shader adding sun rays to the sun, as seen in Far Cry 2, Crisis etc.

First of all, you need MGE SVN rev118.

The shader is available http://www.speedyshare.com/586255660.html. (v0.02a)

Edit:
If you have changed your Field of View (FOV) via MW FPS Enhancer or any other tool, you will need to open the shader fx file with a text editor and find the line '#define fov 75'. Change the 75 to the exact FOV setting you use. Otherwise the sun movement on the screen will not fit to the rest of the screen.

Screens:
http://img228.imageshack.us/img228/4300/85156292.jpg http://img196.imageshack.us/img196/3271/27026476.jpg http://img228.imageshack.us/img228/1847/70229522.jpg http://img205.imageshack.us/img205/2743/25510631.jpg http://img205.imageshack.us/img205/782/51944443.jpg http://img215.imageshack.us/img215/9639/65128684.jpg

Personally, I think this shader makes MW's sunglare obsolete, so I have included a completely transparent sunglare texture in the zip file to get rid of it. It will still work if you keep the sunglare, though it may look too bright and kinda strange when MW's sunglare keeps popping in.
This shader should be placed before bloom in the active shader list, to make bloom work on the sun rays. I have included some tweakable values at the top of the shader file, so you can adjust the shader parameters to your likings. I've also tried to describe what each parameter does. I have found that the strength of the bloom shader you use has a great effect on sunray brightness, so you may need to adjust the 'raystrength' variable to prevent overblooming.

Edit:
Updated to v0.02a
User avatar
x a million...
 
Posts: 3464
Joined: Tue Jun 13, 2006 2:59 pm

Post » Tue May 08, 2012 10:35 am

so, this is some kind of god rays right?
User avatar
kiss my weasel
 
Posts: 3221
Joined: Tue Feb 20, 2007 9:08 am

Post » Tue May 08, 2012 7:14 am

so, this is some kind of god rays right?
Yes, but it's a completely different algorithm than vtastek's godrays.
User avatar
Mylizards Dot com
 
Posts: 3379
Joined: Fri May 04, 2007 1:59 pm

Post » Tue May 08, 2012 4:54 am

great, I'll be sure to try this out, but does this replace the sun glare completely so that no sun replacer is required?
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Tue May 08, 2012 11:23 am

Oooh, subtle. Very nice. I might actually have to use MGE now. (I was avoiding it like the plague before...)
User avatar
Andy durkan
 
Posts: 3459
Joined: Fri Aug 03, 2007 3:05 pm

Post » Tue May 08, 2012 9:05 am

:o
that looks amazing.
User avatar
xxLindsAffec
 
Posts: 3604
Joined: Sun Jan 14, 2007 10:39 pm

Post » Tue May 08, 2012 7:05 am

heh... and I thought crysis looked good back in the day :/
User avatar
Paula Rose
 
Posts: 3305
Joined: Fri Feb 16, 2007 8:12 am

Post » Tue May 08, 2012 10:55 am

This makes mine obsolete. <_< I like this because I don't like the original sun. Finally a sun with actual colors.

I noticed a couple of things. It is a little slow in my end, and sunglare seems to be still there somehow. I will edit the ini to completely disable it. I saw the original sun around sunset hours. It was a little shifted to left-bottom corner. But it is not important, I guess we can paint the sun texture to transparent too.

I was leeching your sunposition codes, I think I should be updating mine with your codes again, so if anyone left using mine could benefit it..
User avatar
nath
 
Posts: 3463
Joined: Mon Jan 22, 2007 5:34 am

Post » Tue May 08, 2012 5:37 am

Very nice Phal, I like it, subtle, speedy, and just good! :P

Don't worry Vtastek, I liked yours too, I'm only using this one because of the strange blue hue I get at certain angles from the sun with yours.

Besides, 2 months ago this seemed like an impossible dream, now there are not one, but 2 options that make it a reality!
User avatar
Bitter End
 
Posts: 3418
Joined: Fri Sep 08, 2006 11:40 am

Post » Tue May 08, 2012 10:26 am

Beautiful! :wub:

@vtastek: More choice is always a good thing, don't be discouraged and/or abandon your project. :hugs:
User avatar
Nicole Coucopoulos
 
Posts: 3484
Joined: Fri Feb 23, 2007 4:09 am

Post » Tue May 08, 2012 6:05 am

Hi!

I took some screenshots with this wonderful shader. Here there are*:

http://img142.imageshack.us/i/mgescreenshot2.jpg/
http://img168.imageshack.us/i/mgescreenshot10.jpg/
http://img186.imageshack.us/i/mgescreenshot11.jpg/
http://img137.imageshack.us/i/mgescreenshot17.jpg/
http://img186.imageshack.us/i/mgescreenshot19.jpg/ (I also use Linora's Mystical Underwater Effects shader)

I also saw some problems:

http://img168.imageshack.us/i/mgescreenshot5.jpg/ (It's always like this at 7 P.M. Maybe it was intentional but the sun seems too whitish)
http://img261.imageshack.us/i/mgescreenshot18.jpg/ (Actually, I'm not sure whether this is a problem or not. If you position the sun in center top of the screen, and in some other specific angles, the screen gets greyed out a little. It's also realistic, though; in real world, when you look at the sun, and then turn your eyes to somewhere else, the colors seem to fade for a while.)

This is definitely a must-have. I expected some more critical bugs as it's still a WIP, but it seems flawless except for the white sun issue; and I can more than take it for the overall beauty :)

*I used an edited version (bloomscale set to 8 instead of 2) of HLSL HDR 2 shader together with this shader (the order is 1)sun shaft 2) HDR). I also deleted my previous sunglare textures before using this (I was using the sunglare textures from SWG's Skies v.2) and used the texture provided with this shader.
User avatar
Floor Punch
 
Posts: 3568
Joined: Tue May 29, 2007 7:18 am

Post » Tue May 08, 2012 2:31 pm

Hi!

I took some screenshots with this wonderful shader. Here there are*:

http://img142.imageshack.us/i/mgescreenshot2.jpg/
http://img168.imageshack.us/i/mgescreenshot10.jpg/
http://img186.imageshack.us/i/mgescreenshot11.jpg/
http://img137.imageshack.us/i/mgescreenshot17.jpg/
http://img186.imageshack.us/i/mgescreenshot19.jpg/ (I also use Linora's Mystical Underwater Effects shader)

I also saw some problems:

http://img168.imageshack.us/i/mgescreenshot5.jpg/ (It's always like this at 7 P.M. Maybe it was intentional but the sun seems too whitish)
http://img261.imageshack.us/i/mgescreenshot18.jpg/ (Actually, I'm not sure whether this is a problem or not. If you position the sun in center top of the screen, and in some other specific angles, the screen gets greyed out a little. It's also realistic, though; in real world, when you look at the sun, and then turn your eyes to somewhere else, the colors seem to fade for a while.)

This is definitely a must-have. I expected some more critical bugs as it's still a WIP, but it seems flawless except for the white sun issue; and I can more than take it for the overall beauty :)

*I used an edited version (bloomscale set to 8 instead of 2) of HLSL HDR 2 shader together with this shader (the order is 1)sun shaft 2) HDR). I also deleted my previous sunglare textures before using this (I was using the sunglare textures from SWG's Skies v.2) and used the texture provided with this shader.
The greying could be an effect of the HDR shader, that decreases overall brightness when screen gets very bright. Maybe you could try and see if this still occurs without or with another HDR shader.
But you're right with sun being too whitish at late evening. This could be fixed by making sun disappear earlier at evening, before sun colour changes to its night value, which is blueish. You could easily do that by replacing
static const float light = (1-pow(1-saturate(sunvis*2),2));
with
static const float light = sunvis;
But this will make sunrays less strong at evening. Gotta find a good balance there.
User avatar
Mashystar
 
Posts: 3460
Joined: Mon Jul 16, 2007 6:35 am

Post » Tue May 08, 2012 8:06 am

The greying could be an effect of the HDR shader, that decreases overall brightness when screen gets very bright. Maybe you could try and see if this still occurs without or with another HDR shader.
But you're right with sun being too whitish at late evening. This could be fixed by making sun disappear earlier at evening, before sun colour changes to its night value, which is blueish. You could easily do that by replacing
static const float light = (1-pow(1-saturate(sunvis*2),2));
with
static const float light = sunvis;
But this will make sunrays less strong at evening. Gotta find a good balance there.

I think I'll keep it that way. I'll just imagine that Vvardenfell turns into Silent Hill for an hour each day, at 7 P.M. :P

I'll edit this post after I try your shader with/without other shaders.
Edit: Weird, but the greying issue didn't happen again, neither with other shaders, nor with HDR 2 shader. It was a discrete issue, I think; nothing general.
User avatar
Erich Lendermon
 
Posts: 3322
Joined: Sat Nov 03, 2007 4:20 pm

Post » Tue May 08, 2012 5:04 pm

Wow, fantastic work, looks gorgeous!

http://i11.photobucket.com/albums/a156/MojoBox/pretty-1.jpg

Using it along with DoF and a tweaked TruBloom g6 :D
User avatar
Amanda savory
 
Posts: 3332
Joined: Mon Nov 27, 2006 10:37 am

Post » Tue May 08, 2012 1:20 pm

Small update. I have simplified the iteration code, which should improve performance a bit. I also changed it so that the sun disc will not be drawn when underwater, which always looked a bit strange because sun colour then changes to light blue. I also modified the tweakable variables a bit, so feel free to modify them to your wishes ;)

Newest (0.01a) version: http://www.speedyshare.com/990377680.html
User avatar
kasia
 
Posts: 3427
Joined: Sun Jun 18, 2006 10:46 pm

Post » Tue May 08, 2012 4:03 am

http://img405.imageshack.us/img405/1186/mgescreenshot34.png

Granted I have the black sun issue (the above is a better alternative nontheless), but would that interfere?

Edit: I loaded a different character of mine which is just off the boat (the month of last seed ) and the http://img268.imageshack.us/img268/3218/mgescreenshot33.pngshines http://img33.imageshack.us/img33/2549/mgescreenshot35.png.

This is however not true for my main character (in the month of frost fall, some 50 days ahead) - see the sun in the first link and http://img5.imageshack.us/img5/2148/mgescreenshot32.png.

I found this pretty weird.

On a side note. I first discovered this when I wondered why my main had no moons at night anymore. The moons actually have phases then:

Jonric: What are the main elements of the weather system in Morrowind that you are supporting in the game engine?

Todd Howard: The major elements are the clouds, sun, and moons. I guess that sounds obvious. The cloud layer has levels of transparency, and areas the sun can shine through, as well as the ability to transform between more clouds, less, overcast, rainy, etc. The sun lights the world and has the ability to shine through the cloud layer, so you get very realistic light levels and shadows. Lastly the moons have phases and times they are in the sky to complete the effect.

Funny to see the season actually affecting the brightness of the sun though (assuming everything's working correctly).

Edit 2: My above assumption regarding the sun is wrong. Actually my other characters has the same (blinded by sun) effect http://img195.imageshack.us/img195/4661/mgescreenshot36.png (and season).

Why this don't hold true for my main character I wouldn't know. However I'd appreciate a reply if anyone have an idea on the issue.

(yes, I'm using this mod - without sunglare)
User avatar
Channing
 
Posts: 3393
Joined: Thu Nov 30, 2006 4:05 pm

Post » Tue May 08, 2012 12:23 pm

I now use this without sunglare, and its awesome!
User avatar
Kristina Campbell
 
Posts: 3512
Joined: Sun Oct 15, 2006 7:08 am

Post » Tue May 08, 2012 3:18 am

snip
These problems don't seem to be related to the shader. But I have experienced that certain clothing meshes seem to disable the sun glare (maybe even moons). You could try unequipping everything and see if the sun glare re-appears.

The black sun issue should not have any effect on the shader though, as it is a texture issue, while the shader does not use any textures at all.
However, your pictures look like the shader is not used at all. Have you installed the custom d3d8.dll file (see first post)? You also need to add the shader to your active shader list (MGEgui.exe -> Tools -> Shader editor -> Edit active -> double-click on sunshaft_v001a -> Save).

I'm not sure what causes the screen brightening to be visible even with cloudy weather, but a possible fix could be editing your Morrowind.ini file and changing the 'Sun Glare Fader Max' value to 0. This will however completely disable the screen brightening.
User avatar
Steven Hardman
 
Posts: 3323
Joined: Sun Jun 10, 2007 5:12 pm

Post » Tue May 08, 2012 7:15 am

Snip

Thanks for the reply. I tried your suggestion regarding the sun glare, and you're right. Undressing the enchanted "Magickguard robe" enabled the sun glare for my main (pretty weird).

I'm new to shaders, and I was just about to say that I did follow this http://sourceforge.net/apps/mediawiki/morrgraphext/index.php?title=Activating_shaders (as well as installing the mod correctly). Seems I forgot to tick "update shader variables" in MGE (HDR were already ticked, unnecessarily so I suppose) which gave me a markedly http://img178.imageshack.us/img178/8373/mgescreenshot38.png than http://img156.imageshack.us/img156/2548/mgescreenshot39.png.

It seems to be working correctly then. http://img178.imageshack.us/img178/1320/mgescreenshot46.png by the way :D

Edit: Oops I spoke too soon, now the sun is present in all types of weather - from http://img269.imageshack.us/img269/6007/mgescreenshot50.png to rain and lightning.

I did download and (clean) install the latest MGE (mge3.8-SVN_rev-0117) though strangely enough the version number in its gui shows "mge3.8.0-SVN_rev-116" :blink:

I also replaced the d3d8.dll with the one provided in this thread.

Edit 2: Yes, present even after undressing :shrug:

Btw, this is the only shader currently in the active shader list.


To summarize. With everything (seemingly) installed correctly the sun shader only works with "update shader variables" activated, however this enables the sun at all times regardless of weather.
User avatar
Amy Siebenhaar
 
Posts: 3426
Joined: Fri Aug 10, 2007 1:51 am

Post » Tue May 08, 2012 3:45 pm

Edit: Oops I spoke too soon, now the sun is present in all types of weather - from http://img269.imageshack.us/img269/6007/mgescreenshot50.png to rain and lightning.
That's actually a pretty interesting effect on the ash storm. Makes it look like the ash in the air is like a light fog. The bright sun gets through, but nothing else.
User avatar
rebecca moody
 
Posts: 3430
Joined: Mon Mar 05, 2007 3:01 pm

Post » Tue May 08, 2012 10:02 am

Edit: Oops I spoke too soon, now the sun is present in all types of weather - from http://img269.imageshack.us/img269/6007/mgescreenshot50.png to rain and lightning.
:bolt: OH MY GOODNESS! That's awesome! And it gives me a fantastic idea too, time to go mess with my INI some more. :D
User avatar
Ezekiel Macallister
 
Posts: 3493
Joined: Fri Jun 22, 2007 12:08 pm

Post » Tue May 08, 2012 5:47 am

Hehe, creativity spawned. Glad you like it, but does anyone have an idea on the (for some of us =P ) issue?
User avatar
mishionary
 
Posts: 3414
Joined: Tue Feb 20, 2007 6:19 am

Post » Tue May 08, 2012 4:04 am

Thanks for the reply. I tried your suggestion regarding the sun glare, and you're right. Undressing the enchanted "Magickguard robe" enabled the sun glare for my main (pretty weird).

I'm new to shaders, and I was just about to say that I did follow this http://sourceforge.net/apps/mediawiki/morrgraphext/index.php?title=Activating_shaders (as well as installing the mod correctly). Seems I forgot to tick "update shader variables" in MGE (HDR were already ticked, unnecessarily so I suppose) which gave me a markedly http://img178.imageshack.us/img178/8373/mgescreenshot38.png than http://img156.imageshack.us/img156/2548/mgescreenshot39.png.

It seems to be working correctly then. http://img178.imageshack.us/img178/1320/mgescreenshot46.png by the way :D

What type of hardware are you running to get those frame rates. I have a Q6600 and a GT8800 1GB and only get ~ 17FPS in the same area. Enabling hardware shader gives my machine a big hit even if I have not shaders active. Any idea on what causes this hit. It it the passing of shader variables?
User avatar
Hairul Hafis
 
Posts: 3516
Joined: Mon Oct 29, 2007 12:22 am

Post » Tue May 08, 2012 10:13 am

Beautiful stuff here. You dont even see these kinds of things in modern day games.
User avatar
Wayne Cole
 
Posts: 3369
Joined: Sat May 26, 2007 5:22 am

Post » Tue May 08, 2012 10:47 am

What type of hardware are you running to get those frame rates. I have a Q6600 and a GT8800 1GB and only get ~ 17FPS in the same area. Enabling hardware shader gives my machine a big hit even if I have not shaders active. Any idea on what causes this hit. It it the passing of shader variables?

E8500/4GB ram/ Radeon HD 4870 (512MB)

To quote myself:
To summarize. With everything (seemingly) installed correctly the sun shader only works with "update shader variables" activated, however this enables the sun at all times regardless of weather.

Any ideas on the issue?
User avatar
Brad Johnson
 
Posts: 3361
Joined: Thu May 24, 2007 7:19 pm

Next

Return to III - Morrowind