Author Topic: NWShader  (Read 9320 times)

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« on: July 15, 2010, 02:32:20 am »


               I guess this would count as a plugin for NWN... I'll probably put a topic in general too, just in case.

Anywho, thread for NWShader at these here shiny new forums.

Latest info from the old thread:

Posted 07/13/10 18:58 (GMT) by pkpeachykeen

Just uploaded a package for 0.2.2.3. After working with a few testers and fixing some bugs in my code, then some of nVidia's people to work on a bug in their code, I think/hope all the bugs are out of this version.

Quite a few new features (as in, an absolutely massive amount).

Main things:
 - Soft focus: as you look around, your "eyes" will slowly adjust. No more instantly focusing on anything you see. There is a setting to speed this up or slow it down.

 - HDR: if you use this, the average brightness is calculated. Allows your "eyes" to adapt to how bright things are. Requires HDR enabled in the GUI and an HDR shader running. Outside during the day, you'll lose some detail in dark areas but bright areas will become more average-brightness. At night, bright areas will be very bright, but details in darker areas will be more visible.

 - Flexible shaders: As shown in my checkerboard texture demo, shaders can create textures. Shaders can specify the size, resolution and format of their textures. Textures can also be shared between shaders, and shaders can both write to and read from textures. Every pass of a shader can have a "render target", where all results from that pass will go. The render target can be the backbuffer ("lastpass" is equivalent to the buffer) or any named (loaded or shader-created) texture.

 - Link to NWN's textures: Shaders, both fullscreen and material, can now access any textures loaded by NWN itself. This is especially useful for environment maps. Shaders can, in theory, write to NWN's textures. This is a relatively dangerous thing, so don't abuse it. You can modify textures on-the-fly using this feature.

 - Whisper commands: you can whisper script commands to yourself. Other players should not be able to hear these (alpha feature, not well tested yet). You can tweak your shaders, turn them on/off, or load new ones from in-game using this.

 - Extended script commands: Scripts can now modify shader parameters, assigning values and even textures during the game. Special keywords are recognized, particularly: now, the current internal timer and rand, which will generate a random number and use that.

 - Configurable screenshot format and directory: Pick where your screens go and how they end up there. You can take screenshots in PNG or JPEG format and post them straight onto your favorite forum or Photobucket. (screenshots occasionally don't save, apparently Windows thinks the file already exists when it doesn't, I'm not sure why this is happening. Will be fixing it soon. If the screen doesn't save, try taking it again. It usually works, though)

 - Optimized shader management: shaders get loaded once (for materials) and settings are overlayed. Saves on memory and speed.

 - Dynamic linking for materials: material shaders are defined in material XML snippets along with settings. Textures can be bound at runtime (eg, you can script what textures should be used). Certain variables are also linked in materials, particularly time and focus (you can have objects fade out in the distance or animate the textures (or even the vertices) based on time).

 - Dynamic texture loading: script commands that tell a shader to use a texture that isn't loaded will automatically find and load the texture, or use an error texture if it can't be found. This allows for dynamic texture-sets. If used with the NWPython plugin, this can (theoretically) allow you to download and use textures while the game is running. Textures need not exist when the game starts, only when they are first loaded by NWshader.

 - Packaged with 5 languages for the GUI: English (written by myself), Espanol, Deutsch, Italiano and Francais (translated by Google). Localization is a work-in-progress and some labels may be too long to comfortably fit on the GUI. I'll be trying to account for this soon.

A bunch of other features. I need to do a big update of the Wiki docs and a few other spots, but hopefully this will all work. Downloads up on SourceForge:
http://sourceforge.n...nwshader/files/

Should come with everything you need. Any problems, let me know and I'll fix them ASAP.


Ran into a wee bitty problem with the GUI, which could occasionally crash the game if it misinterpreted the screenshot path. Experimental GUI fix available here:
http://www.mediafire...hgzdw1ly0t01t2x

Let me know of any further issues. I'll be filling up this thread with more info soon. '<img'>
               
               

               
            

Legacy_Lord Sullivan

  • Hero Member
  • *****
  • Posts: 671
  • Karma: +0/-0
NWShader
« Reply #1 on: July 15, 2010, 06:39:38 am »


               Well will start following the project here. I didn't try the latest yet, will let you know how it goes.
               
               

               
            

Legacy_theMusez

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
NWShader
« Reply #2 on: July 15, 2010, 07:53:59 am »


               Alright so, new version seems to run great. Using the shaders I used in the last version (bloom, depth, and ssao), everything seems to run just as well. Trying to use the HDR shader, though, makes things start to flicker a lot and go kinda wonky (mostly things are waaay to dark).

Also, the error on exit is still there.
               
               

               


                     Modifié par theMusez, 15 juillet 2010 - 07:05 .
                     
                  


            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #3 on: July 15, 2010, 07:14:16 pm »


               Do you have HDR calculation turned on in the main tab?

As for flickering, on the advanced tab, what's the HDR smoothing interval set to? I think it shipped at 0, which is faster but will flicker. Set it up to 2 or 3 (seconds), and it should smooth out nicely.

The HDR shader itself is still a work-in-progress, I'm trying to adapt a few algorithms to create a reverse tonemapping shader that looks good in NWN. It's a very dark game with a limited color palette, at least for the original content, so I'm playing with the numbers.
               
               

               
            

Legacy_theMusez

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
NWShader
« Reply #4 on: July 17, 2010, 05:20:21 am »


               Ah, yes it was the timing. Now it seems HDR just makes things far too dark, but otherwise it works fine.

Also I'd like to mention that this version seems to be a lot more stable in terms of alt-tabbing.
               
               

               


                     Modifié par theMusez, 17 juillet 2010 - 04:21 .
                     
                  


            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #5 on: July 17, 2010, 05:35:41 am »


               You can thank Misters Scott and Nigel at the nVidia developer boards forum for that. They were able to help find a workaround for the bug that would crash on alt+tab. I'm still working with them to fix it completely, though.



Also, for anyone with crash after using the GUI:

It seems the GUI is spitting out bad XML for the screenshot format or folder. If you open it up, you should see:

<ScreenFormat />
<ScreenFolder />

If either of those lines come up, that's Bad. I'm fixing it and preventing any future happenings, but until I build and update, please just replace either of those lines with one of these:

<ScreenFormat>PNG</ScreenFormat>
<ScreenFolder>./screenshots</ScreenFolder>

Obviously you can change the internal part, so you can set the format to JPG/JPEG, or the folder to C:\\My Games\\NWN Shots if you'd like. I'm working to fix those, though.
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
NWShader
« Reply #6 on: July 17, 2010, 02:50:05 pm »


               Peachy - Disaster. You remember I said that your latest version finally worked for me? Well it now doesn't work at all and I've changed nothing with nwn. I try to start nwn and it refuses to load. In the log file it just says nwnshader loading and stops. I have to admit I didn't try any of your suggestions for settings that you gave me in your reply on the old boards. I just hadn't got round to it yet, too busy on my own projects. In fact I have removed nwnshader just so I can keep testing my stuff. If you think it might help I can easily re-install it and set the debug level at super-paranoid to get you more detailed info.



Sorry to be a pain but as I say it worked when it was first installed. I left it for a few days and now it doesn't work at all.



TR
               
               

               
            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #7 on: July 18, 2010, 12:39:48 am »


               If you wouldn't mind, a log would help me diagnose the issue quite a bit. With some of the oddities I've noticed with the GUI (I hardly even changed it, no idea why it's so broken now), if you wouldn't mind sending your NWShader.xml as well, I should be able to give you a rough idea of what's going on. Just setting the debug level to 2 or 3 and running the game, then you can disable NWShader until I read up and find a fix for ya. '<img'>
               
               

               
            

Legacy_Via Con Diablos

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
NWShader
« Reply #8 on: July 18, 2010, 07:17:10 am »


                Running into weirdness with a few of the shaders.  Both the default DOF and the knx DOF cause me get super blurry across the whole screen.

Motion blur gives me a backwords giant error texture.

I've deleted the nwshader dir completely and installed the most recent, but same thing happens
               
               

               
            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #9 on: July 18, 2010, 06:39:51 pm »


               I'm not sure what's wrong with the default DoF. It works fine for me and in the tests, but apparently doesn't work on some systems now. There is a work-around, but I'm looking into why it's broken. Everything I've seen has provided no help, though, everything seems to be setup right.

The Knx DoF is a shader I pulled from another game and isn't quite right. It's supposed to be physically correct, but the formula isn't matched to NWN's coordinate system.



As for motion blur, I guess I missed one shader in the update. Oops. I'll get that fixed ASAP.
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
NWShader
« Reply #10 on: July 20, 2010, 01:12:14 am »


               Peachy I've sent you the inf you wanted via the email address in the log file. I put both files into a tiny 7z attachment.
               
               

               
            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #11 on: July 20, 2010, 09:54:47 pm »


               Yep, got the email and read the info.



The problem is in your config file, it's documented, just not fixed yet.

The line that says ScreenFolder, if you change it to match all the other lines but put a folder (either C:\\Games\\NWNScreens or .\\screenshots or ..\\nwnshots, any legal folder name), it'll work. I can't post the exact way here, it'll cut out the less-than greater-than, but you should see a definite pattern.
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
NWShader
« Reply #12 on: July 21, 2010, 12:24:02 am »


               Thanks. That fixed it. What I don't understand though is why it worked when I first installed it. You would thought that, that problem would have shown itself from the start.
               
               

               
            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #13 on: July 21, 2010, 12:39:07 am »


               Something strange is going on where the GUI isn't properly saving the strings, all the time. I've had people report errors on save, issues where it will save format or folder, and a few other things. I have yet to figure out exactly what it's going on, after a full code review, but I do know a few alternate methods that seem to prevent it. I'm also adding error-correction code into the actual DLL, which will fill in the default values and give you an error message if it runs into a broken config.
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
NWShader
« Reply #14 on: July 21, 2010, 02:22:30 am »


               Please make sure that you don't set a default drive of C. Because of the way that XP works and because I've got memory card readers, My hard drive just happens to be H!