OBLIVION
Night Eye Shader Switcher by scanti
Oblivion » Visuals and Graphics
Added: 29/08/2008 - 02:22PM
Updated: 02/09/2009 - 01:24AM

75 Endorsements

5.0 Latest version

3,292 Unique D/Ls

4,404 Total D/Ls

32,433 Total Views

Uploaded by scanti

Description

Last updated at 1:24, 2 Sep 2009 Uploaded at 14:22, 29 Aug 2008

Name: SwitchNightEyeShaders
Version: 5.0
Date: 13 September 2008
Category: Modders Resource
Requirements: Oblivion Script Extender (OBSE) version 13 or greater, Oblivion version 1.2.0.416
Author(s): scanti
Source:

Description
===========

This is an OBSE plug-in that allows you to add your own nighteye shaders and swap them at will during the game.

Any shaders you create must be in the pso file format and be placed in the data\shaders\nighteye folder and the data\shaders\hdr.nighteye folder. Each shader must have 2 versions. One normal shader in the data\shaders\nighteye folder and another for when the game is using HDR in the data\shaders\hdr.nighteye folder.
(If you miss out the hdr version of the shader and the player is using hdr then the screen will black-out or white-out while night eye is active).

To create the shader files you can use the Oblivion shader editor utility by Timeslip. http://timeslip.chorrol.com/

I've also added a HLSL shader development system. Write your shader in HLSL, name it .hlsl and place it in the data\shaders\dev.nighteye folder.

When you next start the game the game will compile your hlsl shader and place it in either the data\shaders\dev.nighteye folder or the data\shaders\hdr.dev.nighteye folder depending on whether you have hdr enabled or not. This shader will get added to the game's shader list you can get it's enumeration by using the AddNightEyeShader ".hlsl" command. Note you must end the filename with hlsl, not pso for it to find the shader.

Once you are happy with your shader you can copy the compiled pso file into both the data\shaders\nighteye and the data\shaders\hdr.nighteye folders.

The plug-in adds 2 new commands:

AddNightEyeShader and SetNightEyeShader.

To try out the plug-in I've included some shaders that were created by Timeslip. To switch between them go into the command console and type in SetNightEyeShader followed by a value between 0 and 16 and then activate night eye. You can switch between shaders while night eye is still active.

From version 5 of the plug-in you can have multiple nighteye effects active.


Commands
========

EnumNightEyeShader

Will find the shader associated with the shader filename and return a value you can use with SetNightEyeShader to switch to that shader. The filename must have the .pso extension. The filename must not exceed 100 characters or you will cause Oblivion to crash. (Was previously AddNightEyeShader, although you can still use that command as an alias).


SetNightEyeShader

This allows you to deactivate, activate a shader or add a night eye shader to the night eye effect list. Shader number 0 is always the default Oblivion shader.

The Active Type is a number from 0 to 3:

0 - Set the shader to always be deactivated.
1 - Set the shader to always be active regardless of whether the nighteye effect is active or not.
2 - Adds the shader to the nighteye shader list. Whenever the nighteye effect is active then the shader will become active.
3 - (Default) Sets the shader to be the only one activated by the nighteye effect. This is the behaviour of the shaders before version 5 of the plug-in.

Writing HLSL shaders
====================

There are a couple of guidelines to follow in writing a HLSL shader for the nighteye effect.

The screen texture is passed into the shader as Src0 and you must use the line:

samper2D Src0

The main function that gets called by the pixel shader must be called main i.e.

float4 main( float2 Tex : TEXCOORD0 ) : COLOR0

I've set the compiler target to pixel shader version 2.0. If you need to compile to a later version then let me know and I'll add an option to allow you to set what version the shader compiler compiles to but ps 2.0 should be good enough for most people.

Install
=======

1. Extract the files to a temporary location.
2. Examine the folder structure and make corrections where necessary.
3. Copy files in the data folder to (install folder)\Oblivion\Data\
4. You need to start Oblivion with the OBSE laucher for the plug-in to work.

(The files in the src folder contain the source code for the plug-in. If you aren't interested in it or don't
know what source code is then just ignore it).

Uninstall
=========

1. Delete the files/folders associated with the mod.

Oblivion\Data\Shaders\NightEye
Oblivion\Data\Shaders\hdr.NightEye
Oblivion\Data\Shaders\dev.nighteye
Oblivion\Data\Shaders\hdr.dev.nighteye
Oblivion\Data\obse\plugins\SwitchNightEyeShader.dll


Upgrade
=======

1. Delete any files that begin with "hdr." in the Oblivion\Data\Shaders\Nighteye folder.
2. Copy the newer files into the oblivion folders as normal. If windows asks if you want to replace a file then answer yes.


History
=======

5.0, 13 September 2008 - You can now have multiple night eye shaders active.
4.0, 05 September 2008 - Fixed bug that caused HLSL shaders not to compile when an older pso existed.
Changed the compilation target from ps 1.3 to ps 2.0.
Added some example HLSL shaders.
3.0, 01 September 2008 - Fixed bug with shaders showing up white in hdr mode.
Added a HLSL shader development mode.
2.0, 30 August 2008 - Fixed bug that stop commands being registered in the construction set.
1.0, 29 August 2008 - Initial release.

Contact
=======

You can find me on the official Elder Scrolls forums as 'scanti'
You can find me on TESNexus as 'scanti'

Credits
=======

Thanks to the OBSE team for creating such a wonderful program and adding plugin support.
Thanks to Bethesda for creating Oblivion.
Thanks to TESNexus.com for the a one-stop-shop resource for authors and players.
Thanks to LHammonds for the Readme Generator this file was based on.
Thanks to Timeslip for letting me use his replacement night eye shaders as an example.

Licensing/Legal
===============

As with all my mods you can do whatever you want with this mod. If you do use it then a mention would be nice.