Author Topic: NWShader  (Read 9328 times)

Legacy_Nostrebor

  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
NWShader
« Reply #75 on: October 03, 2010, 04:04:01 pm »


               I looked in your source code (very nice that you make it public, by the way) and found this in class_nwshader_settings.


  •             const char * index = level->Attribute("index");
  •             const char * shadername = level->Attribute("file");
So I changed the config file to:

  •     <Shader index="1" file="shaders\\bloom.cgfx" />
  •     <Shader index="2" file="shaders\\depthoffield.cgfx" />
  •     <Shader index="3" file="shaders\\avatar.cgfx" />


The config file seems to be read ok, but now I get the following in the log file (and no differences to what is on the screen):


  • 0:3:6 ::   NWShader: Compiling per-pixel lighting shader...
  • 0:3:6 ::   Per-pixel lighting is suffering an overhaul and has been disabled.
  • 0:3:6 ::   NWShader: Compiling shaders...
  • 0:3:6 ::   Shader Manager FS: Some shaders failed to load.

               
               

               
            

Legacy_Nostrebor

  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
NWShader
« Reply #76 on: October 03, 2010, 04:07:15 pm »


               Note: The double backslashs in "file="shaders\\\\..." seem to be an artifact of appending to this forum.  There is only one backslash in the actual config file.

               
               

               
            

Legacy_Jez_fr

  • Sr. Member
  • ****
  • Posts: 460
  • Karma: +0/-0
NWShader
« Reply #77 on: October 03, 2010, 05:16:21 pm »


               

Jez_fr: Well, my biggest goal was a success if it doesn't crash. '<img'>
To test if it's running, delete the file nwshader.log and run the game. If the log is recreated, NWShader ran. you can see the settings and what exactly happened in the log file.

As for no shaders, again, I'll take a look at it. Not sure why, I based the code very closely after the last version (223).

As far as requiring the camera hack, no, NWShader does not require the camera hack. In fact, if you use NWShader, there's no need to use the camera hack: NWShader includes an improved version as an option.


First, thanks for your time =)

I deleted the log file, ran the game, and a new log was created. here it is:

17:46:58 ::    Logger created.
17:46:58 ::    NWShader: Starting...
17:46:58 ::    NWShader Chronepsis (v0.2.2.2)
17:46:58 ::            Copyright © 2010 Sean Sube
        http://nwshader.sourceforge.net
   
    All original elements of the NWShader project are licensed under
    the terms of the GNU General Public License. Under no circumstances
    may any element of NWShader be used in any proprietary project.

    Please refer to the copy of the GPL distributed with NWShader for
    further information, or, if you did not receive a copy, write to
    the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
    Boston, MA  02110-1301 USA.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    For help, support, questions, comments, or complaints, please
    send emails to Sean Sube (pkpeachykeen) at cx029a@live.com, or
    use the message boards on the NWShader SourceForge page.



17:46:58 ::    Config: Config file read.
17:46:58 ::    Config: Reading shaders list.
17:46:58 ::    Config: Done parsing config file.
17:46:58 ::    NWShader was unable to load the language file for e.
17:46:58 ::    NWShader: Started by process E:\\\\NeverwinterNights\\\\NWN\\\\nwmain.exe.
17:46:58 ::    NWShader: Attached to NWMain. NWShader will hook itself.
17:46:58 ::    NWShader: Hooking into OpenGL...
17:46:58 ::    NWShader: Hooked compressed texture creation.
17:46:58 ::    NWShader: OpenGL hooked.
17:46:58 ::    NWShader: Starting to load plugins...
17:46:58 ::    NWShader: Error searching for plugins.
17:46:58 ::    Set up DirectInput interface.
17:46:59 ::    NWShader: Creating sys check context. Not cached.
17:47:0 ::    NWShader: Making syscheck context current.
17:47:0 ::    NWShader: Deleting syscheck context.
17:47:0 ::    NWShader: Creating context.
17:47:0 ::    NWShader: does not have cached device/context. Grabbing...
17:47:0 ::    NWShader: Initializing system...
17:47:0 ::    NWShader: Hooking into engine...
17:47:1 ::    NWShader: Hooked engine functions.
17:47:1 ::    Viewport info: 0; 0; 1680; 1050
17:47:1 ::    GLEW: Started successfully.
17:47:1 ::    DevIL: Started successfully.
17:47:1 ::    Shader Factory: Starting Cg...
17:47:1 ::    Cg: Using version 2.2.0010
17:47:1 ::    Cg: Profile VP20 is not supported.
17:47:1 ::    Cg: Profile FP20 is not supported.
17:47:1 ::    Cg: Profile VP30 is not supported.
17:47:1 ::    Cg: Profile FP30 is not supported.
17:47:1 ::    Cg: Profile VP40 is not supported.
17:47:1 ::    Cg: Profile FP40 is not supported.
17:47:1 ::    Cg: Profile GPU_VP is not supported.
17:47:1 ::    Cg: Profile GPU_FP is not supported.
17:47:1 ::    Cg: Profile GP4VP is not supported.
17:47:1 ::    Cg: Profile GP4FP is not supported.
17:47:1 ::    NWShader: Creating textures...
17:47:1 ::    NWShader: Framebuffers disabled in config.
17:47:1 ::    Shader Factory: Texture format accepted.
17:47:1 ::    Shader Factory: Created texture thisframe on 1.
17:47:1 ::    Shader Factory: Texture format accepted.
17:47:1 ::    Shader Factory: Created texture lastframe on 2.
17:47:1 ::    Shader Factory: Texture format accepted.
17:47:1 ::    Shader Factory: Created texture lastshader on 3.
17:47:1 ::    Shader Factory: Texture format accepted.
17:47:1 ::    Shader Factory: Created texture lastpass on 4.
17:47:1 ::    Shader Factory: Texture format accepted.
17:47:1 ::    Shader Factory: Created texture error.png on 5.
17:47:1 ::    Shader Factory: Loaded texture error.png on 07A27FD8.
17:47:1 ::    Shader Factory: Setup complete.
17:47:1 ::    NWShader: Compiling shaders...
17:47:1 ::    Shader Manager FS: Loaded shaders.
17:47:1 ::    Set up DirectInput interface.
17:47:4 ::    NWShader: Making null context current.
17:47:4 ::    NWShader: Process deleting cached context.
17:47:4 ::    NWShader: Creating context.
17:47:4 ::    NWShader: does not have cached device/context. Grabbing...
17:47:4 ::    NWShader: Initializing system...
17:47:4 ::    NWShader: The double-start bug has struck. Attempting to reinit...
17:47:4 ::    Config: Config file read.
17:47:4 ::    Config: Reading shaders list.
17:47:4 ::    Config: Done parsing config file.
17:47:4 ::    NWShader was unable to load the language file for e.
17:47:4 ::    NWShader: Hooking into engine...
17:47:4 ::    NWShader: Hooked engine functions.
17:47:4 ::    Viewport info: 0; 0; 1680; 1050
17:47:4 ::    GLEW: Started successfully.
17:47:4 ::    DevIL: Started successfully.
17:47:4 ::    Shader Factory: Starting Cg...
17:47:4 ::    Cg: Using version 2.2.0010
17:47:4 ::    Cg: Profile VP20 is not supported.
17:47:4 ::    Cg: Profile FP20 is not supported.
17:47:4 ::    Cg: Profile VP30 is not supported.
17:47:4 ::    Cg: Profile FP30 is not supported.
17:47:4 ::    Cg: Profile VP40 is not supported.
17:47:4 ::    Cg: Profile FP40 is not supported.
17:47:4 ::    Cg: Profile GPU_VP is not supported.
17:47:4 ::    Cg: Profile GPU_FP is not supported.
17:47:4 ::    Cg: Profile GP4VP is not supported.
17:47:4 ::    Cg: Profile GP4FP is not supported.
17:47:4 ::    NWShader: Creating textures...
17:47:4 ::    NWShader: Framebuffers disabled in config.
17:47:4 ::    Shader Factory: Texture format accepted.
17:47:4 ::    Shader Factory: Created texture thisframe on 1.
17:47:4 ::    Shader Factory: Texture format accepted.
17:47:4 ::    Shader Factory: Created texture lastframe on 2.
17:47:4 ::    Shader Factory: Texture format accepted.
17:47:4 ::    Shader Factory: Created texture lastshader on 3.
17:47:4 ::    Shader Factory: Texture format accepted.
17:47:4 ::    Shader Factory: Created texture lastpass on 4.
17:47:4 ::    Shader Factory: Texture format accepted.
17:47:4 ::    Shader Factory: Created texture error.png on 5.
17:47:4 ::    Shader Factory: Loaded texture error.png on 07A2E5E0.
17:47:4 ::    Shader Factory: Setup complete.
17:47:4 ::    NWShader: Compiling shaders...
17:47:4 ::    Shader Manager FS: Loaded shaders.
17:47:4 ::    Set up DirectInput interface.
18:7:43 ::    NWShader: Making null context current.
18:7:43 ::    NWShader: Process deleting cached context.
18:7:43 ::    NWShader: Stopping...
- Closing log file (dtor)


Does it look right?
I have no clue about what it says, but there's several errors indicated, so i'm wondering XD

Thanks for helping!
               
               

               


                     Modifié par Jez_fr, 03 octobre 2010 - 04:16 .
                     
                  


            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #78 on: October 03, 2010, 07:57:57 pm »


               Nostrebor: I'm not entirely sure yet why the shaders wouldn't be loading. I'll be watching it in a debugger later and see what I can see there. The XML settings you added are in the correct format. I have a few ideas what I broke, but watching it run will let me know for sure. '<img'>



Jez_fr: There are no problems with that log. The "Profile xx is not supported." just report what shader profiles are available and which aren't, which helps me diagnose if its a hardware or software issue. Your system doesn't support many profiles (what card are you running, by the way?), but it was able to detect at least one vertex and fragment profile, so things should work.
               
               

               
            

Legacy_Nostrebor

  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
NWShader
« Reply #79 on: October 03, 2010, 10:38:21 pm »


               When I checkout you code from sourceforge I noticed that ConfigWriter.cs is missing.
 
Is there another Forum that you would prefer these "guts of the system" posts to go?
               
               

               


                     Modifié par Nostrebor, 03 octobre 2010 - 09:44 .
                     
                  


            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #80 on: October 04, 2010, 10:16:00 pm »


               Oops, missed that file. It's uploaded in the SVN now, rev41 should have it included. It's a very basic wrapper for an XmlWriter that simplifies <Setting name="" value="" /> tags.



As for this forum vs another, feel free to post here or the official NWShader forums. I get email notifications on this thread and should on the other forums, so I'll try to reply ASAP. There's some info on the other forum that might interest you, if you've been looking into the code. Any suggestions for bug-fixes and such I'll try to implement, or you can submit patches (so long as any contribution is under the GPL).
               
               

               
            

Legacy_Jez_fr

  • Sr. Member
  • ****
  • Posts: 460
  • Karma: +0/-0
NWShader
« Reply #81 on: October 05, 2010, 08:20:21 am »


               

pkpeachykeen wrote...
Jez_fr: There are no problems with that log. The "Profile xx is not supported." just report what shader profiles are available and which aren't, which helps me diagnose if its a hardware or software issue. Your system doesn't support many profiles (what card are you running, by the way?), but it was able to detect at least one vertex and fragment profile, so things should work.


I have an ATI Radeon HD5770.

Maybe that's just the setting I'm not choosing correctly. When I launch the config tool, everything is unchecked. Is there a recommended setting? I must admit most are totally obscure to me XD

Thanks!
               
               

               
            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #82 on: October 06, 2010, 08:17:28 pm »


               If you check off a box (any random box), close the config tool and open it again, is anything checked? Does it lose the check-marks, or is it just blank?



The new config tool will not work with old config files, so they will appear blank. I'll distribute a default config file with the next patch. The usual ones to check are "fullscreen shaders", "calculate depth/focus" (if you want SSAO or depth of field), the script interface if you want that, and the camera hack if you want to use that.
               
               

               
            

Legacy_nwn_martin

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
NWShader
« Reply #83 on: October 07, 2010, 07:50:53 pm »


               the problem lies somewhere in the logic of saving the shader section to the xml. it saves only the last selected shader (regardless if its checked or unchecked, selecting the item in the list is enough to decide it as the option to be saved) to the config.xml, but the particular shader does not seem to be active in game anyway. it looks like it is saving current selection or last item selected and does not add up any checkboxed items in the output.



ps: tooltips in the lower bar of the gui window dont show up for me anymore when hovering over the gui items, on the other hand the description text shows just fine.
               
               

               
            

Legacy_Nostrebor

  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
NWShader
« Reply #84 on: October 09, 2010, 11:08:48 pm »


               

Nostrebor wrote...

I looked in your source code (very nice that you make it public, by the way) and found this in class_nwshader_settings.


  •             const char * index = level->Attribute("index");
  •             const char * shadername = level->Attribute("file");
So I changed the config file to:

  •   
  •   
  •     


The config file seems to be read ok, but now I get the following in the log file (and no differences to what is on the screen):


  • 0:3:6 ::   NWShader: Compiling per-pixel lighting shader...
  • 0:3:6 ::   Per-pixel lighting is suffering an overhaul and has been disabled.
  • 0:3:6 ::   NWShader: Compiling shaders...
  • 0:3:6 ::   Shader Manager FS: Some shaders failed to load.


I compile your code and got it running on a 64 bit windows 7 machine (in case you are keeping track).  I can start the dll in the debugger (after pointing the debug executable to nwmain.exe).  If I run in fullscreen mode nwmain.exe starts throwing exceptions that I cannot seem to ignore, but if I run it in window mode everything works fine.  (The exceptions are only when the debugger is attached, if I run nwmain by itself everything works fine).

Anyway I found why the shaders were not working.  My config file said:

<Shader index="1" file="shaders/bloom.cgfx" />

but your code put the shaders qualifier on the filename for me.  When I made it

<Shader index="1" file="bloom.cgfx" />

everything worked fine.  I found that cartoon.cgfx gave the most obvious effect (not one I particularly liked, but very noticable)
               
               

               
            

Legacy_Nostrebor

  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
NWShader
« Reply #85 on: October 10, 2010, 03:50:05 am »


               When I was building the development enviroment I downloaded the newest cg (version 3.0).  There have apparently been some langauge changes.  The "Sin City" shader does not compile.  It gets the errors:



"error C1101: ambiguous overloaded function reference "tex2D(sampler, float2)"



apparently there use to be a data type called sampler that has been replaced with sampler1D, 2D, etc.   I tried changing the variables that were sampler type sampler2D.  That compiles, but no I get a mirror "You should not see this texture" image.
               
               

               
            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #86 on: October 10, 2010, 04:16:50 am »


               Nostrebor: The exceptions that are thrown appear, last I checked, to originate from NWMain. I'm not sure what causes them (I'd tracked it down partially at one point), but they pop up only when the debugger is present. I usually run NWN in windowed mode, or on my second monitor (with VS on the first) to get around that.



As for the config file issue, thanks for tracking that down. I'll implement that fix tonight and recompile, hopefully be able to upload it tomorrow, if all goes well.



Oh, and you compiled NWShader itself, or the GUI? If the former, that might be the first report of someone else actually getting it to compile, or trying. '<img'>



nwn_martin: Yeah, I have a few ideas where it may be, and most of them are in two chunks of code I changed to add the filtering feature. It should be in the GUI, since previously it was stripping the shaders/ portion of the path.
               
               

               
            

Legacy_Nostrebor

  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
NWShader
« Reply #87 on: October 10, 2010, 12:43:46 pm »


               I compiled nwShader (generates dinput.dll).  There are a couple of other mains in the project that do not compile.  I think the need GLUT.  I could probably get them to compile, but have not tried.



As downloaded from soureforge the solution file (.sln) a bit incompatible with visual C++ 8.0 express.  It seems to include other solutions (or something like that).  Anyway I took them out, changed some include and lib paths and it worked fine.  The only problem I have seen so far is that my build uses Cg 3.0 which seems to have change a bit.  As a result "Sin City" has compile error (other may also).



I'm kind of curious.  Why did you replace dinput.dll? I would have expected opengl.dll to be the dll you replaced.
               
               

               
            

Legacy_pkpeachykeen

  • Jr. Member
  • **
  • Posts: 89
  • Karma: +0/-0
NWShader
« Reply #88 on: October 10, 2010, 05:57:01 pm »


               The other projects need updated to match some changes to NWShader, I haven't fixed them yet, until NWshader is ready.



The issue with VC Express is that the GUI is a C# project, so C++ can't load it.



I haven't seen that error in the sin city shader, but it should be related to either the nws common library or the shader itself. Just an ambiguity is easy to fix.



As for replacing dinput.dll, because it was much easier and gives me a point to hook DirectInput when/if I need control over input. It has one export, compared to the 100+ that OpenGL.dll has. The simplest way to replace a DLL with a fake one is to use LoadLibrary on the real one and GetProcAddress for every function you need, so DInput was the fastest and easiest. Back when I was using Detours, inserting an opengl.dll also could cause infinite loops in the code and stack overflows, so...
               
               

               
            

Legacy_Nostrebor

  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
NWShader
« Reply #89 on: October 10, 2010, 06:37:50 pm »


               I tried the mithril golems and got a golem that looks like he has a black with silver crack T-Shirt on.

picasaweb.google.com/fileancabatica/Docs

I think the Sin City error is related to the newer Cg development enviroment I downloaded.
               
               

               


                     Modifié par Nostrebor, 10 octobre 2010 - 05:54 .