Page 1 of 25 1 2 3 11 ... LastLast
Results 1 to 10 of 250

Thread: OpenSauce Post Processing

  1. #1
    Senior Member FireScythe's Avatar
    Join Date
    Sep 2006
    Location
    UK, England
    Posts
    321

    Code OpenSauce Post Processing

    OS1 Post Processing
    This OpenSauce extension uses some of the code from the DirectX SDK Post Processing sample to give Halo post processing abilities.

    It basically takes what Halo renders, applies whatever effects you define on it and presents that to the screen.

    To use simply extract the d3d9.dll and shaders folder into your Halo CE directory. The shaders folder contains a bunch of .FX shaders, the shader list file, and a template shader.

    The shader list tells Halo what shaders to apply and in what order, open it in a text editor and it should be pretty clear.

    I've also implemented a simple motion blur effect, seperate from other effects, which is why theres a motion blur FX file in the shaders folder. You can turn it on or off in the shader list file.

    There's no guarantees of this working mind you, i'm still new to C++ and DirectX so theres a chance it won't work for some of you, but iv'e tested it on an ATI 9600 AIW and an Nvidia 9600GT with no problems.

    I've included the files i've added/changed in OpenSauce for your viewing pleasure.

    UPDATE: I've made changes so the motion blur cache uses less video memory, so try the updated version of you've had trouble.
    UPDATE 2: Fixed SP crashing, better source code.
    UPDATE 3: Fixed incorrect build number. Added fake HDR effect. (Based on source from here).
    UPDATE 4: Added toggles, and a toggle menu. 2 extra shaders.
    OS Post Processing 18-07-09

    Pics:

    PP_Bloom

    PP_Sketchy

    PP_Sepia



    OS2 Post Processing Alpha
    Since this is taking a while to develop i've figured i'd put out an alpha build for you to look at.
    As such this comes with no guarantees of any kind, parts are unfinished, it might not run, exceptions may be had etc.

    >>Download Here<<

    Here's a rundown of what's going on. This project isn't exclusively about post processing anymore, it can be split into two projects. One is some major additions to the DxWrapper part of OS and a number of components it now relies upon, and the post processing system that relies upon the DxWrapper modifications.



    DxWrapper
    The DxWrapper now has the ability to create a screen space position texture, a screen space velocity texture and a screen space normals texture, which are all exposed to other components though a DxWrapper namespace (as well as some other things). These outputs are used by the PostProcessing component for special effects.

    I've added a hs_global "rasterizer_rt_display <short>" which allows you to see these outputs in action (which is handy for debugging too!). The values you can use are below.

    0 - Default. Just renders the scene as normal.

    1 - Shows you what is in the position output texture.

    2 - Shows you what is in the velocity output texture. You'll need to have something moving to see something, Warthog tires will glow!

    3 - Shows you what is in the normals output texture (between -1 and +1, so blackness will occur).

    4 - Shows you what is in the normals output texture (between 0 and +1, so blackness won't occur).

    -1 - All of the above, except 0.



    Post Processing
    The post processing system now has 4 sub sections.

    • Per pixel motion blur
    • Fake HDR
    • External global shaders, and
    • Internal map cache shaders.


    Per pixel motion blur
    Yes, i'm determined to get per pixel motion blur working. It uses the screen space velocity to blur the scene depending on how fast and in what direction an object is moving. This heavily relies on the DxWrapper velocity output so i'll discuss that instead. As far as the Velocity output goes, currently BSP velocity is fine, but object velocity isn't quite right. It will flicker everytime an object is added or removed from the object pool. Or at least I think that is what's happening. This is a bit annoying as the motion blur will distort the objects on screen when this happens, so i've disabled the velocity output for objects by default and added another HS global bool 'rasterizer_object_velocity' so that you can turn it on so see what progress has been made on it. The blur shader itself is pretty resource intensive so don't be suprised if you get a big droop in FPS when the shader is enabled. Regarding the motion blur effect, the shader isn't framerate independent so at the moment if you have a really high FPS you might not notice much. I test it at 30 FPS as my baseline so you'll get the full effect at that speed.

    Fake HDR

    Disable by default, enabled via the console. I don't like it much to be honest.

    External global shaders/Internal map cache shaders.
    These are together as their capabilities are be identical. External shaders work the same as in the OS1 version. They are defined in "shaders/PostProcessingSettings.txt" and loaded from the "shaders" directory. The variable names that are used in the shaders have changed so shaders from OS1 will need updating to work. Otherwise they are largely the same, but with a few additions. Shaders can now use up to 4 external textures to create more interesting effects, an example being a pencil sketch effect which is included in the download. They also have access to the textures DxWrapper now outputs. Which means that some interesting effects can be achieved such as depth of field (included), VISR-esque edge detection (included) and plausibly SSAO. Also, up to 8 animated floats are now available for whatever reason you deem fitting.

    So, on top of the effects that can be done purely with the rendered scene (Bloom, Sepia, etc.) more cool things are possible .

    A much needed addition is the ability to chose when an effect is applied, which can now be defined in the settings file. These are listed in order of application.

    0 - Pre blur Applied before the motion blur takes place.
    1 - Pre alpha blended Applied after the motion blur but before the alpha blended faces.
    2 - Pre HUD Default. Applied after the alpha blended faces but before the HUD.
    3 - Pre menu Applied after the HUD is rendered.
    4 - Post menu Applied after the menu is rendered.

    Motion blur is applied before alpha blended faces are rendered as it's nigh impossible to blur a pixel for both the transparent surface and the surface behind it at the same time.

    Internal map cache shaders are a completely new feature which is now possible thanks to the wonders of OS2. I have made two new tags (included in this release but used them at your own peril dun Dun DUNNN!!). "shader_post_process" and "shader_post_process_collection" which will allow map makers to create post process effects for their maps, giving them a completly unique look. They have the same capabilities as the external shaders with a few changes.

    • If I can ever figure out how to make functions with arguments work, they will be partially controllable with HScript.
    • They can be set to not be applied during cutscenes.
    • External bitmaps are currently available in the same way as external shaders, however, if I can find out how to load bitmaps from the cache, they will take their place. An interesting application of this would be to have a refractive effect behind the HUD ala Halo3/ODST.

    shader_post_process

    shader_post_process_collection


    I have included the current tag_groups.map file and the definition file for the new tags so you can give it a go, but while I think i'm done changing it, and i've left space to add things if I want to, there's no guarantee that no tag breaking changes will be made in future.

    The current post processing console commands are as follows:
    pp_load function Loads everything if not already loaded
    pp_unload function Unloads everything if not already loaded
    pp_fake_hdr_enabled bool Turns fake HDR on/off
    pp_fake_hdr_target_luminance real Adjust fake HDR target luminosity
    pp_post_processing_enabled bool Turns effects on/off
    pp_motion_blur_enabled bool Turns motion blur on/off
    pp_motion_blur_amount real Motion blur amount ~40 works well at 30FPS

    With regards to settings, all standard settings are stored in the OpenSauce settings file. They are changed by the console commands and save when you close the game. The shader and effect setup however is in the PostProcessingSettings file mentioned previously. You can change things in this file then unload-load the post processing system while the game is running to see your changes. The way the file is laid out is very specific so stick to it!

    So, I think thats covers everything added/changed, so onto the dreaded problems.

    Known problems:

    • Alpha blended faces such as tree leaves are a bit messed up in the Position/Velocity/Normals output. This therefore affects all post processing shaders that use them.
    • In the Velocity texture flickering occurs when you move and look around, and sometimes objects just look wrong.
    • Using the Yelo menu to disable and re-enable the HUD will permanently disable a number of features because it replaces a pointer that my code replaces, with the original Halo pointer. I need to find a way around this.
    • Sometimes using the flashlight or picking up active camo will make the screen go black for a split second.
    • For the first frame when you load a map or when the camera changes in SP motion blur will be crazy.


    UserTool
    Along with the internal shaders I am also working on a "usertool" which is a simple command line program that looks and operates in the same way as tool, but will allow developers to add their own commands so that they can compile data into their own tag formats. For instance currently the shader_post_process tag stores the shader in text format, but once the map maker is happy with the shader they will be able to use usertool to compile and replace it with a smaller binary format.

    Source
    Source is included in the download if your interested. I'm probably going to be re-writing DxWrapper once i've got a fully working velocity output and I need to add internal bitmap loading to the PostProcessing component but the other components should be pretty much done.


    Like I said at the beginning of the essay post this is an alpha build so any problems i'd like to know about but don't be expecting a rapid fire fix for anything. It would be handy to know your video card if you do have problems. Performance wise, this is a far more expensive system than previously so some FPS drops shouldn't be unexpected.

    Also, as this is built with the original OS2 source any problems with that initial release might be present here. You'll need the latest DirectX too.

    Any questions you have are obviously welcome .

    As far as credits go, obviously Kornman deserves his own cookie mountain for OS itself and the help he's given, complete with warm milk and honey.
    Skarma also needs a hearty mention for reversing the code that helped getting screen space normals and velocity working.
    Last edited by FireScythe; December 8th, 2009 at 07:43 AM.
    Reply With Quote

  2. #2
    a bit of the old in-out Roostervier's Avatar
    Join Date
    Jan 2007
    Posts
    3,379

    Re: OpenSauce Post Processing

    Looks great, downloading. : D
    Reply With Quote

  3. #3
    Glorious Beacon of Light Disaster's Avatar
    Join Date
    Nov 2007
    Posts
    2,022

    Re: OpenSauce Post Processing

    I thought it wasn't possible to do much graphics wise with OS? Would it be possible to add an ambient occlusion post processing effect?
    Reply With Quote

  4. #4
    a bit of the old in-out Roostervier's Avatar
    Join Date
    Jan 2007
    Posts
    3,379

    Re: OpenSauce Post Processing

    For anyone that has halo spit out that it needs d3dx9_41.dll (or whatever) you can simply download it from some place and it works.
    Reply With Quote

  5. #5
    Senior Member FireScythe's Avatar
    Join Date
    Sep 2006
    Location
    UK, England
    Posts
    321

    Re: OpenSauce Post Processing

    I doubt it, this only uses colour information which is easy enough to get. Something like ambient occlusion would require depth information and maybe normals, which would be difficult to get, if possible at all (as far as I know).

    Oh, and the missing DLL is because you need the latest DirectX release.
    Last edited by FireScythe; June 30th, 2009 at 06:45 PM.
    Reply With Quote

  6. #6

    Re: OpenSauce Post Processing

    not working here, halo window opens and does nothing... no loading at all.
    Reply With Quote

  7. #7
    Senior Member FireScythe's Avatar
    Join Date
    Sep 2006
    Location
    UK, England
    Posts
    321

    Re: OpenSauce Post Processing

    Is there any sound? And what do you actually see, the halo startup screen?
    Reply With Quote

  8. #8
    "Think Different" Masterz1337's Avatar
    Join Date
    Sep 2006
    Posts
    4,405

    Re: OpenSauce Post Processing

    This is pretty cool. Only complaint is that I think that it made my screen to bright and I can't run Xfire and this at the same time, but the second one isn't your fault.
    Reply With Quote

  9. #9

    Re: OpenSauce Post Processing

    No way!!!!
    Now I can make some HLSL shaders for halo CE. Thanks fire scythe!
    Edit: I get an exception when I start it up.
    Last edited by DEElekgolo; June 30th, 2009 at 07:27 PM.
    Reply With Quote

  10. #10
    "Think Different" Masterz1337's Avatar
    Join Date
    Sep 2006
    Posts
    4,405

    Re: OpenSauce Post Processing

    After using it, I only have a few suggestions.

    1. Can you make it so it doest effect HUD bitmaps?
    2. I got a weird white flash every once in a while, not even a flash, more like a white flicker.
    3. Can you make objects that have a dynamic light shined on them have an increased bloom?

    Great work on this.
    Reply With Quote

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •