General Purpose Shader Script

Post » Tue May 25, 2010 8:26 pm

General Purpose Shader Script v1.4

Inspired by Fliggerty's Fade to Black mod, the General Purpose Shader (GPS) Script will pass your current Health, Fatigue, and Magicka to any shader you can make or edit.

Features:
-Shaders can now be made which change in real time as your status changes.
-Scripted, hotkey-able amulet allows you to start and stop the scripts at the press of a button.
-It's a hit at parties.


The GPS script will pass your stats as three percentages to three separate shaders. It will also pass the reverse percentages as well. More info in the readmes. Videos on the PES page.

NEW in v1.4, the scripts have been re-done and are much more accurate. Also, the amulet is now hotkey-able, so the shaders can be disabled/enabled instantly at the press of a key.

Download via http://planetelderscrolls.gamespy.com/View.php?view=Mods.Detail&id=472775&id=8314
User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm

Post » Tue May 25, 2010 3:15 pm

Oh, thanks for this. I have this shader based hud idea for a long time. Glad I can work on this now. :)
http://i51.photobucket.com/albums/f386/vtastek/morrowind/Morrowind2009/new%20UI/New-UI-1.jpg
http://i51.photobucket.com/albums/f386/vtastek/morrowind/Morrowind2009/new%20UI/New-UI-2.jpg


But those drawbacks are nasty. I always find a need to disable hardware shaders. Does this problem exist for Fade to black mod too? I know Linora's underwater mod doesn't have a problem like this.
User avatar
gary lee
 
Posts: 3436
Joined: Tue Jul 03, 2007 7:49 pm

Post » Tue May 25, 2010 12:30 pm

I noticed you're using shader fragments of mine. That enbparam texture is not needed for desaturation. Here is a shader just for that effect. Clean and simple.

/**************************************************//*Parameters*/float rmagickaratio= 1.0f;/**************************************************/texture lastshader;sampler s0 = sampler_state { texture=; magfilter=linear; AddressU=Clamp; AddressV=Clamp;};float4 desaturatees(float2 tex : TEXCOORD0) : COLOR{	float4 InputColor = tex2D(s0,tex);	float3 Color0 = InputColor.rgb;	float3 Color1 = 0.3*InputColor.r + 0.59 * InputColor.g + 0.11*InputColor.b;	float3 OutputColor = Color0 * (1 - rmagickaratio) + Color1 * rmagickaratio;	float4 output; 	output.rgb = OutputColor;	output.a = 1;	return output;}technique T0{  	pass p0 { PixelShader = compile ps_2_0 desaturatees(); }}

User avatar
Tom
 
Posts: 3463
Joined: Sun Aug 05, 2007 7:39 pm

Post » Wed May 26, 2010 2:16 am

Thank you very much. The crash problem also exists in FtB, but the effect doesn't kick in until your health has dropped below a certain amount, so as long as it was above that, it wouldn't crash. Below that, and BOOM! insta-crash. Stopping the script also seems to have no effect for some reason. I might need a secondary script to free the effect.

Also, cool HUD, it reminds me of Goldeneye64. Which is always a plus.
User avatar
Kill Bill
 
Posts: 3355
Joined: Wed Aug 30, 2006 2:22 am

Post » Tue May 25, 2010 12:13 pm

New version with some script improvements as well as a new amulet to turn the script on or off at will. This will help with crashes. The game will not crash if you disable HW shaders after disabling the script from the amulet.
User avatar
Iain Lamb
 
Posts: 3453
Joined: Sat May 19, 2007 4:47 am

Post » Tue May 25, 2010 5:49 pm

Like the look of these, skaeps.mp3, videos are well worth a look :thumbsup:
User avatar
M!KkI
 
Posts: 3401
Joined: Sun Jul 16, 2006 7:50 am

Post » Tue May 25, 2010 3:25 pm

I finally finished the UI shader.

But when I tested it with your script, I noticed only one variable is passing to the shader. In my case, I need all three. So I downloaded MWedit and found this file:
http://www.fliggerty.com/phpBB3/viewtopic.php?style=1&f=53&t=1379&p=27667

And installed it. Then I changed this part in zgps
; send values to shadersMGESetEffectVarFloat "gpsh.fx" "healthratio" healthRatioMGESetEffectVarFloat "gpsf.fx" "fatigueratio" fatRatioMGESetEffectVarFloat "gpsm.fx" "magickaratio" magRatio



to this:
; send values to shadersMGESetEffectVarFloat "gpsf.fx" "rhealthratio" rhealthRatioMGESetEffectVarFloat "gpsf.fx" "rfatigueratio" rfatRatioMGESetEffectVarFloat "gpsf.fx" "rmagickaratio" rmagRatio


In game, only health and fatigue work, but not magicka. What am I doing wrong?


PS. To make sure, I used rfatigueratio for magicka inside the shader, it worked. So it is the third variable. Maybe there is a limit, only 2 variables per shader?
PPS. I read there is a limitation getting max magicka. Maybe it wasn't a number I was expecting.
User avatar
asako
 
Posts: 3296
Joined: Wed Oct 04, 2006 7:16 am

Post » Tue May 25, 2010 7:07 pm

I finally finished the UI shader.

But when I tested it with your script, I noticed only one variable is passing to the shader. In my case, I need all three. So I downloaded MWedit and found this file:
http://www.fliggerty.com/phpBB3/viewtopic.php?style=1&f=53&t=1379&p=27667

And installed it. Then I changed this part in zgps
; send values to shadersMGESetEffectVarFloat "gpsh.fx" "healthratio" healthRatioMGESetEffectVarFloat "gpsf.fx" "fatigueratio" fatRatioMGESetEffectVarFloat "gpsm.fx" "magickaratio" magRatio



to this:
; send values to shadersMGESetEffectVarFloat "gpsf.fx" "rhealthratio" rhealthRatioMGESetEffectVarFloat "gpsf.fx" "rfatigueratio" rfatRatioMGESetEffectVarFloat "gpsf.fx" "rmagickaratio" rmagRatio


In game, only health and fatigue work, but not magicka. What am I doing wrong?


PS. To make sure, I used rfatigueratio for magicka inside the shader, it worked. So it is the third variable. Maybe there is a limit, only 2 variables per shader?
PPS. I read there is a limitation getting max magicka. Maybe it wasn't a number I was expecting.



That is very strange. I'm not sure why that would happen either. You are right about the magicka, I couldn't check magicka ratio like health, so it's based off of the http://www.uesp.net/wiki/Morrowind:Magicka (Intelligence) So if you have any magicka multipliers active or other mods affecting your magicka, the shader can behave strangely. I'll look into this, too, and see if I can't update this better. And also I'll be updating this mod with the improvements from my shader chain scripts when I have the time. (End-of-the-year school crunch! :read: ) AND whenever I fix the bugs in it. :(

And, congratulations!
User avatar
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm

Post » Tue May 25, 2010 6:00 pm

That is very strange. I'm not sure why that would happen either. You are right about the magicka, I couldn't check magicka ratio like health, so it's based off of the http://www.uesp.net/wiki/Morrowind:Magicka (Intelligence) So if you have any magicka multipliers active or other mods affecting your magicka, the shader can behave strangely. I'll look into this, too, and see if I can't update this better. And also I'll be updating this mod with the improvements from my shader chain scripts when I have the time. (End-of-the-year school crunch! :read: ) AND whenever I fix the bugs in it. :(

And, congratulations!

Thanks.

proof of concept:
http://i51.photobucket.com/albums/f386/vtastek/morrowind/Morrowind2009/new%20UI/New-UI-1.jpg
http://i51.photobucket.com/albums/f386/vtastek/morrowind/Morrowind2009/new%20UI/New-UI-2.jpg

Those above are concepts based on some screens of mine. I didn't have the shader or script to make it happen at that time. And on top of that my HDD died... And I have "I can't do what I did in a second attempt as good as my first time" curse. :P

I was working on the shader time to time, there were problems I had to solve. The overall system wasn't that hard to make. I thought replicating layer system as is would be enough. Real problems were dealing with different aspect ratios and resolutions, animating the transition, dealing with 3 different image files at the same time and their alphas in shaders...

It was something to work on, it looked like fun. (not too hard but not so easy either) But I couldn't find the motivation until your work really. I went ahead and finished the shader, which was easier than I thought.(I was lucky, my assumptions all worked out OK)

In game:
http://i51.photobucket.com/albums/f386/vtastek/morrowind/Morrowind2009/new%20UI/New-UI-11.jpg
http://i51.photobucket.com/albums/f386/vtastek/morrowind/Morrowind2009/new%20UI/new-ui-33.jpg
(positions and colors are all alpha!) :P

I think it could be nice to add effects for fortify health and such. (glows and beats...)
User avatar
lolli
 
Posts: 3485
Joined: Mon Jan 01, 2007 10:42 am

Post » Wed May 26, 2010 2:05 am

:drool: That looks fantastic! I didn't think anything like that was possible, honestly. Really amazing stuff. I'm glad I was able to help! And I know what you mean by "second-time" curse. Video production class + constant computer failures = absolute frustration and lots of lost ideas.

Are you having any more problems with the values? I might have some time the next two days to look through my stuff. For the fortification-effects, I think Health is the only value that doesn't go over 1.0. You could check for a fatigue or magicka value greater than 1, I'll see what Health would need to do this.
User avatar
Gemma Archer
 
Posts: 3492
Joined: Sun Jul 16, 2006 12:02 am

Post » Tue May 25, 2010 3:47 pm

:drool: That looks fantastic! I didn't think anything like that was possible, honestly. Really amazing stuff. I'm glad I was able to help!
...

Anything is possible with Morrowind. Haven't you figure that out yet? ;)

Now what about a transparent crosshair that shows enemy's health? Or Oblivion style lock picking? If you can capture mouse movements and add some random thresholds and send some values to shaders, I can animate lock pieces in the shader with those easily. :deal:
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Tue May 25, 2010 5:51 pm

Anything is possible with Morrowind. Haven't you figure that out yet? ;)

Now what about a transparent crosshair that shows enemy's health?


I actually had this somewhat working at one point. Now that I know the mechanics a little better, I might get this working!

If you can capture mouse movements and add some random thresholds and send some values to shaders, I can animate lock pieces in the shader with those easily.


Looking through MWSE docs, I don't immediately see anything about this. :( But I can get keyboard input semi-easily. Make some security/sneak/luck modifiers... :user:
User avatar
celebrity
 
Posts: 3522
Joined: Mon Jul 02, 2007 12:53 pm

Post » Tue May 25, 2010 9:17 pm

IIRC someone added a MGE specific function to get the current mouse position.


What's the problem with hardware shaders being enabled? Is that something I need to address/fix in Fade to Black?
User avatar
Susan Elizabeth
 
Posts: 3420
Joined: Sat Oct 21, 2006 4:35 pm

Post » Tue May 25, 2010 11:32 pm

IIRC someone added a MGE specific function to get the current mouse position.


What's the problem with hardware shaders being enabled? Is that something I need to address/fix in Fade to Black?


The problem was that disabling HW shaders via hotkey after the shader had kicked in would crash the game. It did this to my mods, too. But new revisions seem to have fixed this, and you can toggle HW shaders without worry. I'll check your mod again, just to be sure.

Thanks, I'll take a look at the SourceForge docs and see if I can find those mouse functions.


[edit] I checked, your mod is fine. As long as you're using a new revision, toggling HW shaders with Fade to Black active is not a problem.

I looked in the SourceForge pages and found some functions for moving the mouse, but none for getting its position. I'll check the MGE thread.
User avatar
Marcus Jordan
 
Posts: 3474
Joined: Fri Jun 29, 2007 1:16 am

Post » Tue May 25, 2010 1:38 pm

*bump*
New version up. Big improvement. Fun all around! See first post.
User avatar
BrEezy Baby
 
Posts: 3478
Joined: Sun Mar 11, 2007 4:22 am

Post » Tue May 25, 2010 10:21 pm

:thumbsup:

Invaluable.
Especially as a basis for other similar scripts (you know what I refer too ;)). Shader scripting is one of those things in MGE that's insanely useful but horribly under-used. Hopefully this will demystify the art and let people other than Fligg (and Linora) do it. :P
User avatar
brian adkins
 
Posts: 3452
Joined: Mon Oct 01, 2007 8:51 am


Return to III - Morrowind