[WIPz/RELz] Sun shaft rays

Post » Wed Nov 24, 2010 10:14 pm

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
Agnieszka Bak
 
Posts: 3540
Joined: Fri Jun 16, 2006 4:15 pm

Post » Thu Nov 25, 2010 5:04 am

so, this is some kind of god rays right?
User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Thu Nov 25, 2010 4:06 am

so, this is some kind of god rays right?

Yes, but it's a completely different algorithm than vtastek's godrays.
User avatar
Jose ordaz
 
Posts: 3552
Joined: Mon Aug 27, 2007 10:14 pm

Post » Thu Nov 25, 2010 11:26 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
Makenna Nomad
 
Posts: 3391
Joined: Tue Aug 29, 2006 10:05 pm

Post » Thu Nov 25, 2010 1:35 am

Oooh, subtle. Very nice. I might actually have to use MGE now. (I was avoiding it like the plague before...)
User avatar
Lil'.KiiDD
 
Posts: 3566
Joined: Mon Nov 26, 2007 11:41 am

Post » Thu Nov 25, 2010 7:14 am

:o
that looks amazing.
User avatar
lilmissparty
 
Posts: 3469
Joined: Sun Jul 23, 2006 7:51 pm

Post » Thu Nov 25, 2010 3:00 am

heh... and I thought crysis looked good back in the day :/
User avatar
Eileen Müller
 
Posts: 3366
Joined: Fri Apr 13, 2007 9:06 am

Post » Thu Nov 25, 2010 5:00 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
Britney Lopez
 
Posts: 3469
Joined: Fri Feb 09, 2007 5:22 pm

Post » Thu Nov 25, 2010 4:21 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
Cheville Thompson
 
Posts: 3404
Joined: Sun Mar 25, 2007 2:33 pm

Post » Thu Nov 25, 2010 12:36 am

Beautiful! :wub:

@vtastek: More choice is always a good thing, don't be discouraged and/or abandon your project. :hugs:
User avatar
Ownie Zuliana
 
Posts: 3375
Joined: Thu Jun 15, 2006 4:31 am

Post » Thu Nov 25, 2010 1:27 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
biiibi
 
Posts: 3384
Joined: Sun Apr 08, 2007 4:39 am

Post » Thu Nov 25, 2010 6:23 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.

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
tegan fiamengo
 
Posts: 3455
Joined: Mon Jan 29, 2007 9:53 am

Post » Thu Nov 25, 2010 6:33 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
Jessica Nash
 
Posts: 3424
Joined: Tue Dec 19, 2006 10:18 pm

Post » Thu Nov 25, 2010 1:34 am

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
Eibe Novy
 
Posts: 3510
Joined: Fri Apr 27, 2007 1:32 am

Post » Wed Nov 24, 2010 11:09 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
Dale Johnson
 
Posts: 3352
Joined: Fri Aug 10, 2007 5:24 am

Post » Thu Nov 25, 2010 3:30 pm

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
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm

Post » Thu Nov 25, 2010 8:22 am

I now use this without sunglare, and its awesome!
User avatar
Tikarma Vodicka-McPherson
 
Posts: 3426
Joined: Fri Feb 02, 2007 9:15 am

Post » Thu Nov 25, 2010 10:34 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
Jerry Jr. Ortiz
 
Posts: 3457
Joined: Fri Nov 23, 2007 12:39 pm

Post » Thu Nov 25, 2010 1:13 pm

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
Marta Wolko
 
Posts: 3383
Joined: Mon Aug 28, 2006 6:51 am

Post » Thu Nov 25, 2010 3:53 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
Annika Marziniak
 
Posts: 3416
Joined: Wed Apr 18, 2007 6:22 am

Post » Thu Nov 25, 2010 9:39 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
Alister Scott
 
Posts: 3441
Joined: Sun Jul 29, 2007 2:56 am

Post » Thu Nov 25, 2010 10:40 am

Hehe, creativity spawned. Glad you like it, but does anyone have an idea on the (for some of us =P ) issue?
User avatar
Hearts
 
Posts: 3306
Joined: Sat Oct 20, 2007 1:26 am

Post » Thu Nov 25, 2010 10:08 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
Jonathan Windmon
 
Posts: 3410
Joined: Wed Oct 10, 2007 12:23 pm

Post » Thu Nov 25, 2010 7:28 am

Beautiful stuff here. You dont even see these kinds of things in modern day games.
User avatar
Juan Cerda
 
Posts: 3426
Joined: Thu Jul 12, 2007 8:49 pm

Post » Thu Nov 25, 2010 10:26 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
Amy Gibson
 
Posts: 3540
Joined: Wed Oct 04, 2006 2:11 pm

Next

Return to III - Morrowind