(<< home) Dev log for "Le Cauchemar", a freeware game by Phil Palmer                            
       
  Download / game info    
  Mailing list / contact    
       
Total hours: 2350.0388                    
                     
Date Entry Hours                  
23-Apr-2008   2    
  Asked Web Mania if they support ASP.NET (C:\correspondence\WebMania)      
 
My test ASP.NET website, so I don't lose it:
C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\WebSite1\WebSite1.sln
     
  Blogger: 1024MB of storage available
My current website\final\devlog folder is 16MB
     
  Gave blogger (blogspot.com) a fair bit of testing, as a possible replacement for Excel for the devlog.
Decided I didn't quite like it enough.  IT'S TOO NARROW!  It makes me claustrophobic.
I do like the way it links from small preview versions of the images to the full-size images; that's handy.
     
  (below) I never knew you could put flowcharts into Excel html pages, nice. Switching off 'autolayout' allows the nodes to be positioned freely.  Might have been useful for planning the menus.
Although, the font size keeps resetting and I can't seem to enlarge the canvas.  Also, the bubbles can become too small for the text when I open the file in Internet Explorer.
     
 
C:\Program Files\Le Cauchemar\
Profiles\
Default.txt
The game's default settings
test
test
Custom.txt
Player's custom settings
 
     
  Excel: pictures, flowchart nodes etc can be made into links - handy!      
  Web Mania's support service was super quick, but the bad news is:
"As we have only Linux servers, hence you cannot run the  ASP.NET application on our server."
BOOOO!
     
  123-Reg don't support ASP.NET either:
"At present no shared 123-REG hosting packages support asp or asp.net"
BOOOO!
     
  Web Mania:
The most data I've ever transferred in a month is (June 2007) 1254.73 MB
Hosting is about £30/month inc vat
     
  Bought 1 year of ASP.NET-compatible hosting from Catalyst2.
Had a quick look at their control panel app, very nice.
     
22-Apr-2008   3.75    
  After putting the slave into sleep mode while the game was running full-screen (master build) then bringing it out of sleep mode:
hr failed, DXUT.cpp line 3484.
Tried getting at it with the debugger, but couldn't reach that line.
Tested MS Flight Sim demo; it handles this situation fine.
     
  Added all the missing French menu text.      
  Fixed various problems that could arise from changing certain options using the menus.      
  (below) Replaced the various anaglyph example profiles with a single one that should give the best impression (minimal convergence, low saturation)
Example_TypicalAnaglyphGlasses.txt
     
 
 
     
#version 15.1 Released version 15.1
Just a couple of minor fixes and improved menu text, nothing exciting.
     
21-Apr-2008   2.5    
  Asked the iZ3D people nicely if they'd let me know how to support their displays. (C:\correspondence\iZ3D)      
#revision 1088 ModeEnvironment.cpp: Fixed crashes that would occur when starting the game with mist or falling rain disabled (previously these class instances were only getting created if their effect was enabled, and would therefore crash on CreateDeviceObjects).      
#revision 1090 Fixed a bug with falling rain: it had been using the wind's speed to control the elongation of the streaks.  So starting the game with wind disabled caused almost-invisible streaks.
Also speeded up the rain falling speed a bit.  Was previously looking a bit like neige fondue.
     
  I'm finding that granddictionnaire.com is really helpful for translating these menus - it contains a lot of very technical terminology (not surprising since it's produced by the Office québecois de la langue française - those guys ROCK!).
v15.1 will have improved French menu text.
     
  TODO: fix ground glitch seen when the game is started with rain impacts disabled      
  Still haven't been able to reproduce (in debug) the original startup crash I was looking for (related to failing assert in CModeStack::InsertAbove)
TODO: FIX THIS!
     
20-Apr-2008      
  Had a few people testing the game today as a result of this flattering link (thanks crim!) :      
  http://www.mtbs3d.com/phpBB/viewtopic.php?t=1323      
  To clarify, the game does not have native support for iZ3D yet (I hadn't heard of iZ3D till today).
It does have native support for:
- Philips WOWvx 3D displays - http://WOWvx.com
- eMagin Z800 3DVisor (stereoscopy and 3DOF headtracking) -
http://3DVisor.com
- NaturalPoint TrackIR with TrackClip PRO (6DOF) -
http://www.naturalpoint.com/trackir/
- Anaglyph stereoscopy
More details in the release log:
http://programmerart.org/releaselog
and the FAQ:
http://programmerart.org/faq
     
  I gather iZ3D takes in dual monitor inputs (hurrah!), so that's the stereo mode I'll need to implement in order to support these screens (which I definitely want to do, they sound great).
So, sorry for any disappointment today, but do watch this space :)
     
  Useful feedback from today's testing:
- There's an intermittent startup crash on v15.0 - this is top priority.  Probably an uninitialised variable, because it's never happened in debug.  v15.1 will fix this crash.  Test turning rain off, setting various reses, etc.
- I should add a dual monitor stereo mode as quickly as possible.  These screens could become
very popular.
- The game is apparently compatible with iZ3D stereo drivers (so, presumably with stereo drivers in general).
- It'd be worth me doing an optimisation pass on the pixel shaders about now (framerate is unhealthy in full screen; in anaglyph mode it's terrible).
- Options that require a restart need to make that fact clear (even if it's just a bit of debug text in the corner of the screen).  Eventually, none of the options will require a restart, but till then it's important not confuse/annoy the player.
- Screen res option needs to list just the enumerated available resolutions; don't allow funny reses to be chosen, because people don't expect them and don't want them.
...
     
  ...
- Some players didn't manage to find the text options profiles when they looked for them (but ideally they should never have to).  Maybe they were searching for *.ini ?
- Example anaglyph profile has way too much ghosting.  Should definitely change this to very low convergence and low saturation.  Maybe resurrect the anaglyph deghosting (would be a shame to waste that whole weekend's work).
- Players seem to be impressed with the realism of the graphics (?!)
- It really is about time I added some weapon effects.  This is more high-priority than the enemies; people don't seem to mind the placeholder enemies too much.  I don't think they're especially bothered about sound either (although that will add tons to the experience).
- The videos on YouTube are useful.  Need to add new ones; will probably do this once there's a weapon effect to play with.
- People are actually playing the game!  Aaaargh!!! Run away!
     
  iZ3D: Ah, it's not as simple as I thought:      
  http://www.mtbs3d.com/phpbb/viewtopic.php?t=1295      
  TODO: try asking them nicely if they'll explain how it works.<-DONE      
19-Apr-2008   0    
  Tried using Visual Studio 2005's "Personal Web Site Starter Kit"
Managed to set up a holy grail of a website on a local server (brilliant gallery and much more), but how do I then get that to run on my hosting servers?
I don't see any mention of ASP.NET applications on the Web-Mania site.  Am I just being thick, or do I need to switch to one of the hosting companies that appear when I google for ("ASP.NET" hosting) ?

Had to re-install Microsoft SQL Server 2005 to get this stuff working locally.
     
  That's all I've managed to do today.  Spent about 4.5 hours on this, which I've not logged because it hasn't produced anything usable yet.      
  I'm not going to persevere with the new site or gallery until I've asked some people about ASP.NET.      
  Auditioned a few placeholder music tracks.  Zombie Overlords is still probably my favourite.  Tried playing the game with that track combined with weather sounds - works well and adds a lot.
TODO: placeholder music & weather loops, soon please!
     
  Ooh, this track's nice, especially the intro.  I could really use an intro like that.  It's by Cinematic Orchestra apparently:
http://fr.youtube.com/watch?v=7b8SAyRjid0
     
18-Apr-2008   0    
  Decided it was time I set up some kind of screenshot gallery on the site.
Taking screenshots of ongoing work (and letting people see those screenshots) is a really good thing to do.  It lets you get a feel for what's working visually and forces you to fix any eyesores that are getting in the way.
     
  Downloaded & installed PHP 5.2.5 (C:\installs\PHP).  I don't know or care what it is, but Gallery needs it.      
  Downloaded & installed netpbm 10.27 (C:\installs\netpbm).  Again, not the faintest idea what this is but Gallery needs it for thumbnails to work.      
  Downloaded & installed Gallery (C:\installs\Gallery)      
  ...er, no wait, I don't want to use Gallery because it requires me to set up my own server.      
  Downloaded and installed 'Web Gallery Builder' (trial version), but it produces crumby unusable results.      
  I'm going to knock-up my own gallery.  Maybe Photoshop actions will help for making the thumbnails?      
16-Apr-2008   4.8    
  Added all the French text for la foire aux questions.  Took ages, but not as long as it would have done in the past; I'm definitely speeding up.
It's probably all wrong mind - please feel free to correct my French!
     
  Words that DON'T have cedillas! :
- raccourci
- ici
- cela
- facile
- recevoir
     
  Words that DO have cedillas! :
- ça
- façon
- français
     
  Took some screenshots from v15.0      
  (below) random v15.0 screenshot.  Colour grading defaults OFF in v15.0.  Not because it's broken, just because it's a counter-productive thing to have enabled until after I've got the textures, lights and effects looking the way I want them.
Is there ever a good time to turn colour grading on?  Maybe at the very end, by which point you don't need it any more because you've improved the textures and lighting underneath.  It's not something the game should rely on in order to look good.
     
 
       
15-Apr-2008   4    
  FAQ = foire aux questions (nf)    
  website: added une foire aux questions (programmerart.org/faq), because I'm gradually starting to need one (which is good).
TODO: French text; the lack of this gives a really bad impression at the moment :/
TODO: talk about anaglyph deghosting.
   
  Spooky - I typed "devlog" (pages francophones) into google.fr, jumped arbitrarily to page 10, and my devlog was right there!    
  HTML: "align" and "valign" can't be assigned values inside a style string.  Took me a while to work that out.    
  Found that the eMagin SDK is now a freely-available download :)  You used to have to do a little dance to get hold of it.
Wait...that must mean none of that stuff is confidential any more (?)  That would make it easier for me to share my code.
   
14-Apr-2008   4    
  TODO?: for sharp [parts of] shadows, threshold the soft shadow image instead of using the aliased raw shadow image?
This would allow for a continuous change of softness along a length range of the shadow (instead of the current cross-fade from sharp to soft).
     
  Virtual-window headtracking now only affects FOV if the 'auto-FOV' option is true.      
  TODO?: to reduce the extent to which colour grading exaggerates banding, do the grading inside HDRLighting.fx (tone-map the floating-point lit scene image, run it through the ramp, then output it to fixed-point final render target.
The current banding is appearing because the lit scene image is quantized to 8 bits per channel before going through the ramp.
     
  Found that the HDR\finalMultiplier option would cause the rain and the edge blur to appear too dark if it was increased, or too light if it was decreased (ie. those post-HDR effects don't take finalMultiplier into account).

For v15.0, I've just disabled finalMultiplier and toneMap ("adaptive luminance").  It would be a shame to throw these options out; instead what I'll probably do is change finalMultiplier (todo: rename) to be applied at the same point where the tone-mapping is/would be done.  In that way the post-HDR effects (and there will be more of them) won't have to worry about it.  Maybe the multiplier should only take effect when tone mapping is switched off, or maybe I'll be able to get rid of it completely.

TODO?: set finalMultiplier to 1 and tweak the post-HDR effects and the middle-grey accordingly?
     
  TODO: fix whatever that failing post-build command is in Master config.      
  Made the Master config remote-launchable.
Cleared-out some unused configs.
     
  TOFIX: alt-tabbing away from the game in fullscreen mode doesn't put it into pause mode when it should.      
  TOFIX: the south wall of Regent St. disappears on v15.0.  Looks like a CullPlane problem, but what has changed?
Check the obvious first: check that the plane hasn't got shifted/rotated (almost seems to be flipped).
Bit annoying, that, but I'm not going to let it hold up the build.
     
  MAX: Added a hidden 'NaughtyStep' layer, and put one of the John St. road patches in there because its normals were all wrong.  TODO: investigate.  Couldn't see anything wrong with the decal's orientation.      
  MAX: For some reason every time I tried to hide the NaughtyStep layer, the game failed the "is the ground there" collision assert (?)
TODO: investigate!
For now, I've just shoved that one decal to the bottom of the stack so it can't be seen.
     
  Last-minute crash on the slave, trying to open controls config.  For v15.0, I've therefore had to disable the controls config option :(
Tested it on the master and it worked fine.
For both cases, the Noctambule folder was renamed beforehand.
     
#version 15.0 Released version 15.0      
  TOFIX: frame-sequential eye-swapping button (RMB) doesn't do anything in pause mode.      
13-Apr-2008   9.5    
  TODO: for v15:
- fix processMenus option (currently causes crash if true)<-BODGED(option is disabled for v15.0)
- fix headtracking calibration mode<-FIXED
- fingers crossed that the OptiTrack stuff can be made to work on Vista...<-FIXED(just needed to install the OptiTrack SDK on the slave)
- slight specular / POM / mipping discrepancy (see screenshot mentioned below)<-FIXED(was screen-res filtering in DeferredLightingApply.fx)
- missing patchwork decals on slave<-FIXED(was uninitialised decal vert RGBA getting through to Patchwork.fx)
- been getting a problem where the app sometimes loses all its keyboard input after losing and regaining focus (does this only happen in pause mode?)
- Deal with crash trying to open controls config in full-screen.<-BODGED(fixed the disabling of the config menu item in fullscreen).
- Alt-enter, etc<-FIXED,PARTLY(I've enabled it again but the menus read alt-enter as enter to toggle options etc, TOFIX).
     
  Website: Added a YouTube video bar; improved front-page formatting etc.      
  BUG: switching motion blur off changes the filtering on the ground (dimples?).      
#revision 1073 Menu system now ensures that a disabled menu item is not selected.      
  TODO: Cars should explode when you shoot near their petrol tanks.  That will be a game in itself; can also be used as a way of taking-out multiple enemies at once (the old 'exploding barrels' trick).
A really impressive explosion effect would be time well spent, absolutely.  By changing the parameters (size, colour, etc) it should give a lot of mileage.
     
  TOFIX: alt-enter, in pause mode, is received as menu input (enter).
Same goes for alt-tab but that's only a minor glitch.
     
#revision 1075 Fixed a bug where you couldn't quit the game if OptiTrack was being used.  The quit message was somehow getting swallowed-up by the OptiTrack message loop (in COptiTrack::Update).  I expect my fix isn't ideal (re-posting a WM_QUIT if one was found in the message loop) but it does work.  The other messages (eg. I checked WM_KILLFOCUS) seem to be getting picked-up just fine, so I don't know why QUIT is any different (?).  TODO: Investigate?      
#revision 1076 Renamed CNoctambuleApp::Quit -> RequestQuit.  The name was misleading because it just posts a quit message rather than shutting-down the app there & then.      
  Re-arranged EHeadTrackingHardwareHint so that it matches the string order shown in the combo.      
  Remember: when adding new input semantics, need to update the string table!  (EINPUTSEMANTIC_)      
  Had a problem where the mouse cursor would appear in headtrack calibration mode (allowing the window to be manipulated.
A bit of fiddling later, got the same problem when entering pause mode and couldn't control the menus either.
Just had to delete C:\Program Files\Common Files\DirectX\DirectInput\User Maps\*.ini as mentioned in the comments in InputManager.cpp.
     
  Found a couple of problems with falling rain in WOWvx mode:
1. background mapping / positioning is wrong
2. it's using the Z buffer for the ordinary screen size instead of the left half of the screen (can see Z buffer 'ghosts' etc).

To avoid these problems I've temporarily disabled falling rain in WOWvx mode for v15.
     
#revision 1078 Head-tracking calibration mode is currently only available when using OptiTrack.  TODO: enable it for 3DVisor too.      
  Failed to get v15 out.
Getting a crash on the slave when entering pause mode.<-FIXED(I'd forgotten to add Menu.fxo to the installer)
Also not convinced the rain is right....
Will definitely release v15 tomorrow night.
<-FIXED, DONE
     
12-Apr-2008   8.91667    
  missing decal problem:
- not a sorting bug.  Removing the base decal doesn't reveal them.
- not a visibility testing bug.  Forcing visibility test to always pass doesn't reveal them.
- missing: doubleYellowJohnEastNorth

- IT'S UNINITIALISED VERTEX RGBA ON THE DECALS
     
  MAX: X EXPORTER: brackets in object names get turned into underscores in the X file    
  MAX: Adding a VertexPaint modifier onto an object prompts the object into including a "MeshVertexColors" block in the X file, defining vertex RGBA (floats).
Removing the VertexPaint then removes the "MeshVertexColors" block.
     
#revision 1062 FIXED: The fix I've now made for the missing decal problem is to remove vertex RGBA influence from Patchwork.fx.
When I want to use vertex RGBA for some decals later on (it will be useful), I'll just make a variation of Patchwork.fx called maybe PatchworkVertexRGBA.fx (see define VERTEX_RGBA in Patchwork.fx).

I might well make this same fix for the building materials (eg. Parallax.fx).  The current placeholder buildings have already been manually fixed by setting vertex colours or applying VertexPaint modifiers.
     
#revision 1063 Changed DeferredLightingApply.fx to use point sampling for the screen-res images (sceneDiffuse, diffuseLighting, specularLighting).  This prevents smudginess on 8800 which can filter floating-point textures.      
#revision 1064 DeferredLighting.fx: reduced the diffuse angular falloff range a bit - doing that makes it nice & contrasty, wetter and rougher, less 'default'.    
#revision 1065 Found and fixed a platform difference with the ground reflections.  In ground.fx, the reflection sampler had been set to use BORDER addressing.  The x1900 doesn't seem to support this (?), so it was using clamp instead (which works well for the reflections).  The 8800 supports BORDER, so in places where the reflection is bent by the likes of a curved road surface, black gaps were appearing in the reflection at the edges of the screen.
Now changed the sampler to use CLAMP.
Only found one other use of BORDER in Shaders.sln: RainSplash.fx.  Now changed that to CLAMP as well.
   
  MAX: REMEMBER: After editing lines, don't leave them in sub-object (eg. vertex) editing mode!
This was twisting some of my road paint.
   
  Made some quick road paint improvements in Max.    
  TODO: "Debug image" option (enumeration).  eg. setting this to "rain occlusion" would show the just the alpha channel of ERENDERTARGET_RAINOCCLUSION (which is also _FALLBACKSHADOWREFLECTIONPOSITION).
Maybe for the position 'images', I'd show the values divided by 1500 or something, so you can really see what's going on.  For the HDR luminance images, I'd show the 'exp' of the values.
   
  TODO: "Debug image mode" option (enumeration) :
- scaled PIP
- partial PIP (same scale as screen image but only visible in the PIP area)
- full screen
- half of screen?  diagonal split?
   
#revision 1067 Fixed some flickering seen in the rain occlusion.  This was simple Z fighting.
I'm now using a minimal depth bias in RainOcclusion.fx to fix this (DEPTH_BIAS_TO_PREVENT_Z_FIGHTING).
     
  OptiTrack on slave:
In COptiTrack::Init,
CoCreateInstance(__uuidof(NPCameraCollection)...
is failing with
hr = Class not registered

"CLASSNOTREG indicates that the thing you are trying to create isn't listed in the registry" (in the CLSID folder)
     
  FIXED: OptiTrack mode is now working on the slave (Vista 32).  All I had to do was install the OptiTrack SDK on the slave.  It's a free SDK that anyone can download:
http://www.naturalpoint.com/optitrack/support/downloads.html
("OptiTrack SDK for V100, C120, FLEX:3 Cameras")
     
  Installing the OptiTrack SDK (1.1.031) on the slave, got harmless messages saying that the following files may have been left over by a previous installation (although there have been no previous installations) :
C:\Windows\inf\
oem4.inf
oem5.inf
oem9.inf
     
  "IDirect3DDevice8::CreateImageSurface was renamed CreateOffscreenPlainSurface"      
  IDirect3DDevice9::UpdateSurface:
"This method is similar to CopyRects in DirectX 8."
     
  Un-commented-out the code for fullscreen controls config, and fixed compile errors (it hasn't been compiled since I moved to DX9!)      
  Trying to open controls config in fullscreen mode:
in CInputDeviceManager::ConfigureDevices:
IDirectInput8::ConfigureDevices fails (and doesn't call my callback).  Returns this error code:

DIERR_NOINTERFACE
The specified interface is not supported by the object

E_NOINTERFACE
No such interface supported
     
11-Apr-2008   2.95    
  HDR: since g_apTexToneMap[0] matches between the machines, technique "SampleAvgLum" (PS SampleLumInitial) is off the hook?

So is it technique "ResampleAvgLum" that's going wrong?  <-YES
   
  I think I can see the root of the problem now, and it's on the master side (X1900XTX, XP)
Every second texel of every second row of the g_apTexToneMap textures is very low (but not black).  Now I just need to work out why.
   
  FIXED!
I've fixed the HDR brightness discrepancy.  It was the DITHERING renderstate affecting the HDR luminance surfaces on the master but not on the slave (why the difference though?).  It was getting initialised TRUE in CNoctambuleApp::VirtualRestoreDeviceObjects.
It's now initialised FALSE in that function, with a "can't touch this" comment.  Dithering is nothing but trouble - I've seen this kind of problem with render target effects a bunch of times in the past.

Screenshot showing the damage being done:
C:\noctambule\debug\11_4_8_HDR_masterPC_dither_vs_nodither.psd

Screenshot showing master & slave now matching (g_apTexToneMap[3]) :
C:\noctambule\debug\11_4_8_HDR_masterWorking_vs_blasterWorking.psd
NOTE: TOFIX: SLIGHT SPECULAR / POM / MIPPING DISCREPANCY
   
10-Apr-2008   2    
  Focus-reloads (eg. FX files) work fine when remote debugging.      
  HDR brightness discrepancy:
On the slave:
- g_pTexAdaptedLuminanceCur is too dark, maybe something like 1/50 what it should be.  Same for g_apTexToneMap[0]
- HDR_OnCreateDevice fails to create that texture as R32F; uses R16F
- g_bSupportsD16 = true
- g_bSupportsD32 = false
- g_bSupportsD24X8 = true
-
g_pTexScene seems to match the master
-
g_pTexSceneScaled seems to match the master
-
g_apTexBloom[0] seems to match the master
On the master:
- the same path through HDR_OnCreateDevice and C_HDR::RestoreDeviceObjects
     
  TODO: lights should all have a slight fluctuation to them.  No reason for it, would just look nice.  Almost get this from the mist already.      
  TODO: continue tracking-down the brightness discrepancy, starting from g_apTexToneMap[0]      
9-Apr-2008   2.58333    
  TOFIX: (LOW priority) Monitor-dragging while in pause mode causes a couple of minor menu glitches (circuitry disappears and text is the wrong colour till selected)      
  Now starting on compatibility debugging.      
  Tried using Pix for Windows.
It doesn't seem to be able to give me a GPU timeline like the Xenon one, that's annoying.
It does show me textures and surfaces.
It doesn't seem to let me analyse a remote PC.

- leamrotatedsharp.png (aerial guide photo), in non-shipped builds, is loaded as a 22MB texture with 11 mips...and a corresponding 17MB surface [and one for each mip?]  Should probably stop that happening ;)
- 1K TGAs (with mip chain) take up 5,592,404 bytes each.  Same for 1K PNGs.
- 1K G16R16F = 4,194,304 bytes each.  NB each RT has a texture and a surface, each the same size.
- 512 = 1,398,100 bytes per texture and per surface
- largest vertex buffers are 1,200,960 bytes
     
  Made a Debug folder (C:\noctambule\debug) which will contain debugging grabs.

HDR surfaces:
C:\Noctambule\Debug\9_4_8_masterPC_HDRSurfaces.psd


Speckly junk in the alpha channel of the HDR backbuffer?:
C:\Noctambule\Debug\9_4_8_alphaJunkFromPIX.psd
     
  TODO: need an FX file for the texture displayed by CModeDebug.  This will allow the HDR surfaces to be displayed at a sensible brightness so I can hopefully find the source of the brightness discrepancy between the two machines.  WIll also allow individual channels to be displayed, inverted, whatever.<-DONE(10th, DebugShowTexture.fx)      
8-Apr-2008   2.75    
  Too-many-text-prims problem:
- there seem to be 6 prims too many being drawn for each menu.  Test: when I draw 7 less prims, half of the final character is chopped off of either the English or French (whichever's the longest) version of any menu if the final menu item is fixed-length.
<-NOW UN-DONE THIS CHANGE; SEE COMMENTS IN CMenu::CreateItemGeometry
     
  HA! At the end of CMenu::DeleteDeviceObjects, it was recursing through all the child menus, calling...wait for it...

RenderItems!

Handy!  Good old cut'n'paste.  Debug DX managed to catch the invalid drawprim that uncovered this problem.
     
  Without entering pause mode:

Debug DX:153 references on closing.  This becomes 150 after one or more monitor drags.  Alt-tabbing doesn't affect it (reloadOnWindowFocus is currently false).
"
D3DX: MEMORY LEAKS DETECTED: 1516 allocations unfreed (1543638 bytes)
D3DX: Set HKLM\Software\Microsoft\Direct3D\D3DXBreakOnAllocId=0x373 to debug"
I can't get BreakOnAllocId (from DX settings) to work.

Retail DX: 633 references on closing, 1516 allocations
     
  Can't get into the 3DVisor forums:
"The website declined to show this webpage
Most likely causes:
This website requires you to log in."

(below) Trying to follow a link to an old thread:
"Unable to open <URL>.  The Internet site reports that the item you requested could not be found. (HTTP/1.0 404)"

The paranoiac in me immediately assumes I've been banned for some reason :/

All I said was "this headset's good enough for Jehovah"!
     
  http://3dvisor.com/forum/viewtopic.php?t=979      
  When dragging between monitors, there are currently no unreleased device objects (only when closing).      
  CNoctambuleApp::VirtualInvalidateDeviceObjects:
When exiting, all effect pointers are NULL.  Normal?  NO <-FINE, already released

CRenderTarget::InvalidateDeviceObjects:
When exiting, CRenderTarget::s_pListHead is NULL.  Normal?  NO
<-FINE, already released
     
  That's interesting:
If I remove the CGameMode:: AllInvalidateDeviceObjects and AllDeleteDeviceObjects from CNoctambuleApp::FinalCleanup, I get the same number of unreleased device objects when quitting.
     
  Moved deletion of g_game.pRenderTargets from CModeEnvironment::OnRemovedFromStack to CNoctambuleApp::FinalCleanup.
I thought this would fix some unreleased device objects, but it didn't.
     
#revision 1057 FIXED.  Can now exit cleanly again, and drag between monitors cleanly.  PHEW!!!
I don't fully understand the fix - just tried it on a hunch and it worked.  It's just a matter of ordering anyway - all the right code has been in there for ages.
It was the addition of DXUTCleanup3DEnvironment at the top of CNoctambuleApp::FinalCleanup.  This also required the removal of AllInvalidateDeviceObjects and AllDeleteDeviceObjects from FinalCleanup.

This finally clears an annoying blockage for v15.  Will start compatibility debugging for v15 in the next couple of days.
     
7-Apr-2008   1.7    
  FX: The following causes D3DERR_UNSUPPORTEDTEXTUREFILTER:
"MINFILTER = NONE"
or
"MAGFILTER = NONE".

NONE is only valid for MIPFILTER.
Now fixed in RainOcclusion.fx and RainFalling.fx
     
  CMenu::RenderItems: trying to work out why the wrong number of prims is apparently being drawn (caused error in Debug DX because too many text prims were being drawn, for the number of verts)      
  TOFIX: since moving some menu init to CreateDeviceObjects, the processMenus option makes the menus crash when opening.      
27-Mar-2008   1.16667    
  TODO: when debugging the glitches in v15, try running the game using debug DX and 'break on D3D error' ticked.      
  Patchwork.fx, Parallax.fx: Now fixed:
MIPFILTER = ANISOTROPIC;
produced an error message in debug D3D:
D3D9 Helper: IDirect3DDevice9::SetSamplerState failed: D3DERR_UNSUPPORTEDTEXTUREFILTER
EEK NOW I'M CONFUSED, even the minfilter is complaining when set to anisotropic.  What's going on?
     
26-Mar-2008   2.16667    
  Grr, can't can't call virtual function overrides from within a base class destructor (because the subclass part is already destroyed) - I'd forgotton about that.
Instead, in the CGameMode destructor I'm now asserting that the device objects have been invalidated and deleted (indicated by the mode flags).  Added CGameMode::PrepareToDelete which must therefore be called before deleting a mode.  Overloading the delete operator did cross my mind... *shudder*
     
25-Mar-2008   2.16667    
  ...nearly there; just got some memory/resource leaks now.  I can't see any mis-placed calls to CreateDeviceObjects or RestoreDeviceObjects.      
23-Mar-2008   3.3    
  CGameMode now inherits from CListItem.
Added static CGameMode methods <Create,Invalidate,Restore,Delete>DeviceObjects
Removed the CModeStack equivalents, because these methods need to be called on all the game modes whether they're on the stack or not.
     
  Made some good progress with the device-changing stuff (eg. for dragging the game between monitors).
The game does actually survive this now; just need to fix up the menus and that should be it all working.  Presumably the remaining unreleased objects were to do with menus?
     
21-Mar-2008   7.9    
  Added 'to-fix' notes at the top of options.cpp
TOFIX: OptiTrack\cameraMountedOnMonitor: when true, this causes a camera/projection crash on startup<-FIXED(just had to put a check around the OptiTrack virtual-window headtracking update in ViewInfo.cpp)
     
  In a master build, alt-entering now edits the value of the 'display\fullscreen' option.
In this way, the game remembers the state that the player left the game in and starts in this mode when the game is next run.  This also keeps the 'full screen' checkbox in sync with the current state. (CNoctambuleApp::OnToggleFullScreen)
     
  Menu.fx no longer writes to the Z buffer.  Previously, the menus had been wiping away the falling rain if the pause background was frozen.      
  On the first frame, FTIME is about 22.  That must've been the loading time.<-I've now added a temporary bodge so that FTIME returns 1/60 until the environment has done its first update.  I'll be overhauling the time system real soon to allow for replays, etc.      
#revision 1041 Spent quite a long time fixing the annoying first-frame bugs that could be seen if the game lost focus before it finished loading.
Most importantly, got rid of the crash.  Also tidied it right up so that you can switch away while it's loading, come back to it after it's finished loading, and it'll be sitting in pause mode with a correctly-rendered first-frame environment behind the menu.

Ideally I think I need a 'Start game' option at the top of the Pause menu, that turns into 'Resume game' when you re-enter pause mode.
     
  Started trying to fix the crash when dragging the game window from one monitor to the other.  I think I know what's going on.
When toggling fullscreen, the D3D device is lost and then restored.  Nowadays the game handles this correctly.
But when dragging between monitors, the D3D device is
destroyed and a new one is created.
The problem is that various parts of my game code assume that the device won't be destroyed until the game is shut down.  So they're creating device objects in their constructors and releasing them in their destructors.  That creation and release needs to be separated out now into CreateDeviceObjects and DeleteDeviceObjects functions.
     
  Added CModeStack::CreateDeviceObjects.  DeleteDeviceObjects is already there and in use.      
  Renamed all InitDeviceObjects functions CreateDeviceObjects      
  g_game.OneTimeSceneInit creates the mode stack.      
  TODO: continue fixing the monitor-dragging stuff (add a CreateDeviceObjects for landscape, patchwork, etc....).  Looks like it should be straightforward.      
17-Mar-2008   3.08333    
  The following debug options now work:
processFonts
processMenus
reloadOnWindowFocus
pauseModeOnWindowFocus
allowFrozenPauseBackground
     
  CMIRenderTarget now displays render target dimensions.
Added CRenderTargetOptions::WriteToMenuString for this
     
  TOFIX: Why is custom.txt not working (loading) ?<- it was being overridden by phil.txt      
16-Mar-2008   5    
  French-English dictionary: http://www.granddictionnaire.com      
  Managed to get all 22 menus in and working and not tangled-up with each other (well just about; 'HDR' and 'motion blur' are still overlapping).
To fix the tangle I had to split up the 'interfaces' menu by adding 'input' and 'output' sub-menus.  I was reluctant about this, but I couldn't see another way, and works out more future-proof anyway.
If the menus were to reshape/resize based on contents, and this affected tree structure, it would be precarious (adding new items would change the tree structure).
     
  So tired and lethargic today; haven't got much done.  It's because I was out drinking Red Bull last night.  What do they put in that stuff?      
  YouTubed a little video of some rain (nothing new) :
http://www.youtube.com/watch?v=1c3x__pKUFg
higher-quality version:
http://lecauchemar.com/videos/rain.wmv
I might record a longer, better version of this idea later on
     
  Joined the forums at WordReference.com.  User name: z6po      
  YouTubed a video of the menus:
http://www.youtube.com/watch?v=EjvyaLIOzBE
     
15-Mar-2008   8.666    
  Option: replaced HDR\curve with screenEffects\colourGrading which is a clearer name      
  String table now contains the full set of configurable options.
Also did a lot of translation
     
  The chap I contacted on ICQ about the mythical WINx3D SDK never replied.  So I've now uninstalled ICQ (it's evil and I only installed it so I could contact him).
If anyone reading this manages to find the WINx3D SDK, please PLEASE let me know!
     
  Maths: added function WrapInt, and WrapIntExclusive which has non-inclusive limits      
  MICombo value selection is now cyclical/looping      
  Got nearly all the menus in.      
14-Mar-2008   2.5    
  Been reorganising the menus, re-grouping the options in the string table, mostly to avoid the enormous-graphics-menu problem that I had.
Also translating.
     
13-Mar-2008   2.25    
  Lost some time due to a silly 'scratchpad'-contention bug.
To prevent this happening again I've made g_game.generalTemporaryBuffer private and added methods LockGeneralTemporaryBuffer and UnlockGeneralTemporaryBuffer (which just use asserts to check that everything's ok).
     
  MICombo now takes into account all its possible variable text when calculating bounds.
Added CMenuItem::UpdateBoundsForVariableVerts for this.
TODO: same for the other item types (for spinners, check the space required for the min and max values).
TODO: limit the left position for menu contents; scale the contents to fit the remaining space where necessary?
   
12-Mar-2008   3.78333    
  Menus now draw correctly in WOWvx mode.      
  Fixed bugs with CMICombo variable text.    
  CMICombo is now functional.      
  Stereoscopy modes are now listed in order of how difficult they make it to read the menu ;)      
  TODO: for spinners (and sliders?), definitely need to be able to type the numbers in :/
This creates a bit of work for me.
Might well leave this till after v15.
     
  Added function COptions::ApplyStereoscopy      
  Found that zero-convergence anaglyph (or practically zero) is super-clean.  Obviously it minaturises the scene and only allows objects to come out from the screen rather than having depth into the screen.  But I like it - it's much more usable and impressive than the accurate version (which is ruined by ghosting).

TODO: use settings something like this in the anaglyph example profile(s):
convergence: 0.1
saturation: 0.6 odd
viewing distance: 28 odd
     
  About half of the current menu items are functional now.  You can change settings and see the difference they make to the game.      
  Found that upping (say, doubling) the rain impact density really makes the rain look more dramatic.  And it ties-in better with the amount of falling rain.
TODO: increase the default,<-done, (256 -> 512)
check the speed hit.
     
  TODO: I'm at the point where I could reeely do with some timers, now that I can adjust the graphics settings easily.
But that's another post-v15 thing.
     
  Menu items now take a real brute-force approach to applying their option changes.  They call COptions::ApplyAll, then they force a refresh of the environment image.
I was finding that the 'apply' work required after making any given change could be difficult to gather-together.  For example, after changing stereoscopy settings, CEnvironment::ApplyOptions needs to be called.
The brute-force method removes all the uncertainty.
My worry with it was that it could easily cause a dropped frame that would swap the eyes in 3DVisor mode.  TODO: test this on the new PC.
...And then there's the business of changing render target options, errgh!....
I really wish they'd designed the 3DVisor with two monitor inputs (I did see a mod for this, but you had to remove the headtracker).
     
11-Mar-2008   4.41667    
  sprintf: to left-align an integer, and set its minimum number of characters, and prefix it with a space if it's signed & positive:
"%_-6d" where the underscore is a space
There doesn't seem to be a way of specifying the maximum number of characters
     
  Replaced CStringTable::StringLength with CStringTable::MaxStringLength which takes into account all languages.
This is because I'm going to allow the language to be changed from the menu (since I've got a nice multilingual stringtable system, I think it's worth the effort to show it off).
   
  Did some translation, for some of the menu options added so far.  It's probably all wrong.  I'm currently calling anaglyph deghosting "défantomisation" (citation: http://abtutor.free.fr/ColorGhosts/index.html)    
  To add to font map:
ç (shouldn't need uppercase)
(
)
?
<-Done
   
  Font: Made the changes above; also shifted the most common 'variable' characters to the start (numbers, etc).
Found that lens blur is much more tame than Gaussian blur (ie. it doesn't spread out as much).  I think I prefer the nice soft look of Gaussian though.  Current blur settings: Graphics\Menu\blurSettings.png
     
  CMICombo now displays its variable text correctly      
  CMISpinner and CMISlider are now usable :)      
  below: used the menu to adjust realWorld \ viewingDistance as a test; this gives a glimpse of what the menu tree actually looks like.  As you can see, I'm not finished translating yet ;)
Can't wait to see it with proper reflections on it, assuming that whole thing works....
     
 
 
     
  TODO: localise decimal points into virgules.  I'm assuming sprintf won't do this automatically on a French-language system (??)  Good thing I've taken the precaution of getting a French-language system so I can test this kind of thing :D      
10-Mar-2008   2.5    
#revision 1025 Got CMICheck updating its text the way it should, phew.
I was just being thick and forgetting to transform the text verts from menu space to tree space.
     
  TOFIX: rain impact effect toggling (with alt-entering)    
  Centralised the MenuItem 'variable text' code.    
#revision 1027 CMISpinner is now displaying its variable values correctly.    
9-Mar-2008   2.31667    
  CMICheck is now closer to updating its text the way it should.  Not quite got it yet.      
8-Mar-2008   3.3    
  Added function CStringTable::StringLength      
  Added function CMenuItem::PlotText      
  CMICheck now responds to input, to toggle its bool value.      
  Full screen' menu option now works.      
  CMICheck is now just-about updating its text the way it should.      
7-Mar-2008   1.43333    
  Late start again.      
#revision 1021 TEMP: The 'controls' menu item now disables in fullscreen mode to prevent the current crash.
TODO: fix properly after v15.

Added CNoctambuleApp::OnToggleFullScreen for this.
DXUT.cpp is including global.h & main.h for this - TEMP?
     
  Started making CMICheck (the yes/no menu item) functional      
6-Mar-2008   1.38333    
  Was working late, hence the late start.      
  Got the auto menu positioning fixed, properly this time - it's all making perfect sense now and the tree is forming just the way it should.
Embarrassingly, it was the very simplest final step of the thing that I was doing wrong - distributing each menu's angle range amongst the child menus.  All the more complicated stuff was working fine (as of last night).
     
#backup Backed-up the project.      
5-Mar-2008   4.666    
  Added quaternion normalisation into MatrixLerp33 after finding some cases where the menu movements went crazy without it.      
  Found that dragging the game window fully onto the second monitor causes an error (unreleased device objects).  TODO: fix.  The DX sample apps handle it correctly.      
  Fixed the problems I was having with the auto menu positioning, but ran into yet another one.  Had a look at it using the 3DVisor in case this made the problem clearer, but couldn't see anything obvious.  Currently the stereoscopy menu thinks it has hardly any space around it for its child menus.  I haven't been able to work out why yet, but I expect it could be something to do with it being at the top 'pole' of the tree.  TODO: FIX!<-FIXED(6th)      
  3DVisor: On the old PC, the headtracker was working fine in the bottom two USBs, but for the top two I had to install its drivers.  Working fine now though.      
  3DVisor: Got a 'lost connection' error one time just after entering pause mode.  Don't know why it happened (loose USB cable?) but it was all handled gracefully.  The game switched from full-screen back to Windows to show the message, in the right language; the retry option succeeded; the game reappeared full-screen and continued with headtracking.
This was using the 3DVisor in the second monitor port (along with a second monitor).
     
  Added the 'anaglyph' menu      
4-Mar-2008   0    
  Works night out.      
3-Mar-2008   2.75    
  Added the 'stereoscopy', 'real world', 'display' and 'weather' menus.      
  CMISlider now inherits from CMISpinner.  I might rename these classes later to make the relationship more obvious.      
  Option display\headMounted is now realWorld\headMountedDisplay
The 'display' menu is more for the properties of the video output; the 'real world' menu contains all the real-world info.
     
  Made some fixes & added some tests to the automatic menu positioning.  Ended up running into another bug after adding more menus.  TODO: FIX<-done(5th)      
2-Mar-2008   8.55    
#revision 1014 Menu highlight effect has changed in design slightly.  Was originally a solid-edged bar with alpha-blended red fluid going through it (see mockup 17th feb), representing the blood of the menu.  The functional aim was to thicken/darken the background for the text.
Now it's a subtle additive red smoke, with no solid edges, drifting from the letters as if they're subliming.  Can be a wee bit hard to read the text when a light is behind this additive smoke plus the text glow, but for the purposes my demo, prettiness wins over practicality.   And it does look very pretty now.
     
  Added method CMenuItem::Enable.  Menu items can now be disabled, which makes them un-selectable, removes their text glow and turns the text to roughly the same weak colour as the menu titles.
As I add new items to the menus I'll disable any that aren't hooked-up/supported yet.
     
  F1 is now another pause key.      
  Decided that I don't want to support direct-from-game access into the DX controls config.  Partly because the time doesn't freeze properly at the moment when doing this.
I'm keeping the 'CONTROLS' input semantic because some controllers actually have a 'controls' button.  For my game, this will open up the Controls menu (my one).
     
  Temp: 'Controls' link now simply opens the DX controls config.      
  The menu tree now automatically generates the positions of all the menus.  Currently still a bit wonky; todo: fix.<-sorted(5th)      
1-Mar-2008   10.6667    
  Added method g_game.Quit to exit the app.  Made sure this doesn't bypass any DXUT error checking (message boxes about unreleased resources, etc).      
  Added option debug\reloadOnWindowFocus (reload shaders etc when the window regains focus.  In Master this behaviour is always false).
Added option debug\pauseModeOnWindowFocus (enter pause mode when the window loses focus.  In Master this behaviour is always true).
     
  CModeStack::Remove no longer asserts that the mode is currently on the stack; bails out instead (see comments).      
  Realised that I needed to let DXUT handle at least some hotkeys (eg. alt-enter); changed it back accordingly.
Also realised that DISCL_EXCLUSIVE wasn't what I wanted because it blocks the above and blocks the printscreen key.  Now using DISCL_NOWINKEY instead to disable the Windows key.
     
#revision 1006 DXUT.cpp: disabled DXUT handling of hotkeys:
VK_F3 (toggle reference device; currently I don't support this, so it crashes)
VK_F8 (wireframe; I don't support this, so it's glitchy.  Can be handy now & again but I'll re-enable it manually when I want it)  TODO?: A well-implemented wireframe option on the debug menu would be very handy for showing-off culling, patchworks, effect geometry, etc.  Would be handy for debugging too.  A good thing to add, really.
VK_ESCAPE (exit app; this key now enters & exits pause mode instead)
     
  Added option debug\allowFrozenPauseBackground (allow g_game.flags.freezeBackgroundWhenPaused to be set true where appropriate).  In Master this behaviour is always true      
#revision 1007 Fixed the rain-splash glitch seen when alt-entering while paused.
Added flag g_game.flags.refreshEnvironmentImages which allows the 'frozen' paused environment to re-render for a single frame after alt-entering.
Related to this, HDR no longer pauses when the game is paused.  It causes less problems this way (eg. alt-enter), and also it would make no sense for it to be paused when headtracking's enabled because you can then still look around in pause mode.
     
  Crosshair no longer appears in pause mode.      
  Menu tree now aligns with the current camera (so the menus appear in the right place).      
#revision 1008 Selected menu items now glow white (see CMenu::UpdateMenuItemVerts).  The glow fades out in sync with the circuit line.      
  Photoshop: found that tiling marble textures are the easiest thing in the world to make:
- difference clouds, times lots, 15 say
- curves
- done!
     
  FX: Crazy: In menuCircuit.fx (and presumably any other effect file) I have to set ZENABLE = TRUE in order for the thing to *write* to the Z buffer - despite the fact that there's a separate ZWRITEENABLE which I also have to set TRUE in order for the thing to write to the Z buffer!      
  Got a blue-screen crash while in Dev Studio doing nothing in particular.      
  Got the menu selection 'highlights' working nicely.  Took a bit of experimentation to get them playing well aesthetically with the other menu elements (especially the circuit lines).      
29-Feb-2008   2.71667    
  Menu.fx: Added a quick & dirty refraction effect, and improved the placeholder reflections to take into account the tree orientation.      
  TODO: get the default hotkeys available again in debug builds;
clean-up the game exit (from pause mode).  Is there a DXUT exit function??<-done (see 1st Mar)
     
28-Feb-2008   2.83333    
#revision 1002 Got a rare crash when drawing lighting on the first frame, while the game window was in the background (I was doing a little E&C build at the time, hmm).  Crashed because g_game.pCurrentCamera was NULL.
Had a look and saw that the pointer wouldn't be set until after the lighting would draw (???)
Now fixed.
     
  Menu transitions no longer give any movement glitches with a low framerate.
I've also smoothed-over a movement glitch that could be seen when a new transition to a third menu was started before a transition between two others had finished: the homer-interpolated transition matrix is now used as a lerp target for the final tree matrix used for drawing.
     
  Added function MatrixEqualApprox33 - this is used to detect the menu being at rest at the end of a transition.      
  Added flag g_game.flags.freezeBackgroundWhenPaused.  When the game is using no headtracking and no stereoscopy, this flag is set true so that in pause mode, the last rendered scene image is used instead of re-rendering the same scene each frame (note: the rain is still rendered each frame because it's done post-HDR).
The result of this is that no matter what framerate the player is getting for the game, the menus should always run in a frame if stereo & headtracking are inactive.  In such a case, it makes up nicely for the lack of motion blur on the menus.
     
  Seeing the menus moving against their background makes it clear that they need some refraction to stop them looking paper-thin (or hollow like balloons).  The refraction has to correctly follow the branches too, otherwise the illusion is broken, so I'll need to use the per-pixel normals.<-DONE(29th)
TODO: add refraction.<-DONE(29th)
Also improve placeholder reflection to take into account tree orientation<-DONE(29th)
     
  TODO: on entering pause mode, the tree needs to orient itself so the root menu is on the line of sight (not including the head-tracking offset).<-DONE(1st mar)      
27-Feb-2008   4.5    
  Got the menu transitions working nicely.
Added CHomer (Homer.cpp/h) which automates smooth movements between two float values.  It even lets you change direction smoothly half-way through a transition between menus.
It's surprising how getting little things like the menu movements just right creates an impression of quality.  The menus of a game are kinda like the interior of a car in that way.  If you want the player to feel like they're driving a Jaguar, you shouldn't use the menus from a Škoda Favorit.
     
26-Feb-2008   1    
  DIUtil.cpp: Now setting cooperative level to DISCL_EXCLUSIVE.  This disables the Windows key.<-(see 1st Mar)      
  Windows key can't be blocked during control config.  The player can't map it to to an action either.
DX docs:
"Even if the cooperative level for the application is disabling the Windows logo key passively through an exclusive cooperative level or actively through use of the DISCL_NOWINKEY flag, that key will be active while the default action mapping UI is displayed."
     
  Input: Couldn't see a way to prevent the likes of DIKEYBOARD_WEBSEARCH doing its default thing (although detecting the button is no problem).
I can't block it in LowLevelKeyboardProc (dxut.cpp) unless I know its VK_ code, and I can't see one that corresponds.
     
  Input: DIKEYBOARD_RMENU is 'Alt Gr'
DIKEYBOARD_APPS ("Application" in the controls config) is the 'menu' key (normally for right-click menus)
     
25-Feb-2008   1    
  I've set DXUT to no longer handle default hotkeys (esc, pause, wireframe, ref device).<-(see 1st Mar)
I've also set it not to parse the command line (just to be safe, until such time as I actually want it to).
     
  Did a few input/menu odds & ends.  CMILink now changes the current menu.      
  Revived my old MySpace page (which was still being linked to from the band page) to point people to my site.  Hopefully it won't use up loads of my time like it did before.  I'm currently keeping it very minimalist.      
24-Feb-2008   12.25    
  Had a look at the LocalDeformablePRT DX sample:
C:\Documents and Settings\user\My Documents\Visual Studio Projects\LocalDeformablePRT
Had to increase the shader model numbers in CDXUTDirectionWidget::StaticOnCreateDevice to get it to run, because 1_1 is no longer supported.
Also had a look at the PRT demo.
Didn't see anything very useful-looking for this project, but it was interesting as reference...
     
  Input: A DIACTION array, for a DIACTIONFORMAT struct, for IDirectInputDevice8::SetActionMap, is not allowed to contain two mappings of the same input (dwSemantic member).
Nor is it allowed to contain out-of-genre inputs (eg. DIBUTTON_BROWSER_PREVIOUS can only be used if the genre of the DIACTIONFORMAT is DIVIRTUAL_BROWSER_CONTROL).  For this reason I allow DIBUTTON_FPS_PAUSE to enter pause mode and DIBUTTON_BROWSER_PAUSE to exit pause mode.  In practice though, I can't test either of these 'virtual inputs' so there's also a non-virtual input to do the same thing (defaulting to P).
     
  Finally worked out how to get the menu input channels working.  I just have to call CInputDeviceManager::SetActionFormat to switch between reading game actions (ie. during play) and reading menu actions (ie. when paused).  I'll probably also use this mechanism for fly-cam, headtrack calibration, replay mode, etc.      
#revision 992 Input 'action' descriptions (seen when configuring/viewing controls) are now localised through the string table.
See EINPUTSEMANTIC_... strings.
Added OnChangeOfLanguage methods to a couple of classes.
     
  Input: semantics mapped to DIAXIS_FPS_MOVE don't appear in the config interface, and aren't active, when using a keyboard & mouse.  I'm guessing it would show up if I used an analogue joystick/gamepad.      
  Managed to get controls configurable [again?].  Just had to supply a name string for CInputDeviceManager::Create.
Control files in C:\Program Files\Common Files\DirectX\DirectInput\User Maps now get named accordingly (upper-cased).
     
  Spent most of the day giving CInputManager a thorough overhaul.  It had been based on the input code from an old DX aerial FPS sample (no longer in the SDK).  There was a lot of lazy duplicated code there so it was bulky and hard to maintain.
Now it's tons better, nice and tidy and makes perfect sense.  Added CAxisInput, and CButtonInput (which takes care of debouncing).
     
  Aarrgh!  Just noticed that CInputManager was written four years ago !  Que cela me serve de leçon.      
  F1 in fullscreen: assertion failure at C:\noctambule\source\common\diutil.cpp(344): hr hr=E_INVALIDARG (0x80070057)      
  I've only just discovered fr.wiktionary.org - it's ace!      
  TODO: need an analogue joystick/gamepad thing to test some of these control axes.      
  According to Wikipedia, an "invert mouse" option means flight-sim mouse, and apparently Quake set that standard.  I was never sure which way round it was but I'll go with that.
Added option controls\invertMouse (defaults false)
NOTE: this option isn't limited to mouse input; it inverts the final accumulated pitch value (from all devices) used for looking up & down during play (but doesn't affect head-tracking).  Does this inside the input manager.
     
23-Feb-2008   2.75    
  Faffing with the input code.  I've mostly made sense of it now.      
21-Feb-2008   5    
  FX: I can't get the BLENDOP state to do anything!  It's always just adding!  (???)      
  (below) Got the circuit lines finished.  They were sodding fiddly!  I didn't make it any easier for myself by insisting that they have perfectly rounded corners (which are too small to even notice anyway).  Ah well, it's all experience.
You can cycle through the menu items of the active menu now.  The lines fade out pleasingly when they disappear.
TODO: get those menu input channels working.
     
 
 
     
20-Feb-2008   2.38333    
  Menus: Made more progress with the circuit lines and general functionality.      
19-Feb-2008   2.18333    
  Menus: Made good progress with the circuit lines and general functionality.      
  Enemies: Sketched an almost-upright scorpion beetle guy with head-pincers, various legs (longer at the front, for uprightness) and lobstery head-fangles/feelers.  The body is fat enough that he'd be a satisfying target that could explode when hit.  The scoprion tail emits a snappy lighting attack.
(I'm not including an image here because it's not a great drawing [good by my standards though!] and don't have a scanner anyway.)

I'll try sketching a few different designs in the near future and then decide which one I like best.

Would be nice if the enemies had sort-of searchlights on/in their head, like miners' lamps, maybe glowworm-coloured to contrast with electric-blue attacks (an idea which I'm keen on).  If they have fangles & feelers, they would cast groovy shadows and could demonstrate backlighting/scattering.  Fangles would very likely be code-drawn, and code-animated to provide nice secondary motion.
     
18-Feb-2008   3.16667    
  Enemies: Spent about an hour collecting images of lobsters, toads, scorpions, spiders and other ugly animals & insects.
The toads have good faces and skin but they all look like they could be reasoned with.  Maybe they'd be more intimidating if they were snarly (like angry monkeys - sharp teeth) instead of looking bored all the time.
The scorpions look the most intimidating.
     
  Made some progress with the circuit lines for the menu selection effect.      
17-Feb-2008   8.16667    
#revision 977 (below) got the menu normals about as good as they need to be.  I'll save any further improvements till after the reflections have been added.      
 
 
     
  Made a placeholder sphere map by chopping-up some old location photography : ETEXTURE_SPHEREMAP
This'll do for the menus until the proper reflection effect is written (see 7th Feb).
     
 
 
     
#revision 979 (above) Menus now look like this.
The smudgy effect at the edges of the screen (screenEffects\edgeBlur) is a new addition in v15.  I like it because it's dreamy; it also kinda suggests water in the eyes, which is good.
If I wanted a stronger impression of water in the eyes, I could make the blur thicker at the top of the screen.  I might consider that later.  In 3DVisor mode, the effect is disabled by default.
     
 
       
  (above) Mockups for the selection effect (mockups\menus\selection_PCB.psd)

- The text lights up white

- A PCB-diagram-style line connects from the empty space on the left to underline the text (maybe the whole line, maybe just the label).  Blend mode: soft light.

- A background box with faded left & right sides contains clouds of colour scrolling from left to right.  I've previewed the movement in Photoshop - looks great, very organic.  In red especially, it's as if it's the blood of the menu.  Blend mode: normal.
     
  TODO: should the 'Link' menu items also have PCB lines to their target menus?  That might be nice; do a mockup.      
  Added the WOWvx menu.      
16-Feb-2008   0    
  Band practice      
15-Feb-2008   3.58333    
  (below) menu normals are close to being what they should be.  The texture is still rough though :      
 
 
     
14-Feb-2008   4.11667    
  menus: Had to make fixes to the branch positioning, because I had got it slightly wrong.  The branches are now drawing nicely.
TODO: for the joins to work properly, need to take into account the length of the branch (map the branch V at constant world-space density)<-FIXED(15th); did it in a different way
     
  Had a look at the menus in VR mode - they're good :)
This was also the first time I've seen the falling rain, paused, in VR mode.  It's quite spooky.  I'm definitely glad I took such a stereo-friendly approach to the the rain.
     
13-Feb-2008   3.33333    
  Did a bit of experimentation with detail mapping for Parallax.fx.  Didn't get anything worth bothering with.
See define DETAIL_MAPPING_TEST.
     
  TOFIX: option 'general\autoFOV' seems to have no effect<-WORKS FINE NOW(21.3.8)      
  Got the menu branch join points located properly; last night's stuff worked well and only needed a few little fixes.      
12-Feb-2008   4    
  Mapped the texture onto the menu ellipses, and improved the texture so that the branches will adjoin neatly.      
  D3DXCreateTextureFromFileEx, in CTexture::Create, seems to be forcing square/POW2 textures, despite the D3DX_DEFAULT_NONPOW2 flag (?)
This was causing a problem for the menu texture, but I've now made it POW2 dimensions (as it should have been, of course).
     
  Drafted the code that locates the join points for connecting the branches onto the menu ellipses.
This code also calculates how far to sink the branch into the ellipse so that the texture will join up seamlessly.
The whole of tomorrow night will be spent getting this working properly.
     
11-Feb-2008   3.16667    
  Got the menu transformation matrices working properly.      
  Added function Vec3RotateX      
  Planned the menu branches - they should join on quite easily.
Made a normal map for the menus (menuNormals.tga / ETEXTURE_MENUNORMALS).  From menu.psd
     
  Added the Graphics and Debug menus.      
10-Feb-2008   11.0833    
  Added a 'Remote Debug' build config.<-removed, no longer needed (just using Debug and switching the debugger type)      
  Finally managed to find the USB driver (or driver installer) for my modem:
C:\Installs\BT Broadband\Util\BT220V.exe
Both the PCs are now talking to each other and to that t'Internet.
This puts me at the point I should have been at four days and 55 pounds ago (the router I bought, which I couldn't get to work properly, is completely redundant now).
     
  Added a 'Remote Local Debug' build config (debug the remote exe locally)<-removed, no longer needed, now using local exe for remote debugging      
  NOTE: the debug exe, should I ever want to include it in the install, requires d3dx9d_34.dll
These dlls can either go into the system folder (where the installer currently puts them, maybe shouldn't), or just next to the exe.
The debug exe is about 3 megs
     
  Vista: HANDY: Start \ eventvwr.exe \ Journaux Windows
Shows details of recent crashes etc.
     
#revision 953 KER-REMOTE-DEBUG!!!  POW!!  :D
Now, I am the master.  Er, literally, yeah.
     
  And I'm getting D3DX debug output in French, kewl.      
  remote debugging: had to set the 'Remote Command' to be the slave-relative path to the exe ( \\master\c\... ).  (I'd forgotten this stuff because it's been 8 years since I've used remote debugging.)
The game exe and the remote-debug monitor are both kept on the master (keeps things simpler & tidier, and seems to be the approach recommended in the msvsmon docs).  Does mean the game takes
even longer to start up, but that needs fixing anyway.
Had to set the '
Remote Server Name' to be the server name displayed in msvsmon (currently PC-DE-PHIL:4015 ).
Had to set '
Debugger Type' to 'Native Only', and 'Connection' to '...no authentication' because I'm using Home Editions of Windows on both PCs.....  Corresponding settings had be chosen in msvsmon.
     
  Grrr:
"In Visual Studio 2005, edit and continue is not supported when debugging native C++ code remotely"
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101862
It's not supported in Visual Studio 2008 either:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2274488&SiteID=1
     
  Just to see what would happen, I tried enabling authentication for my remote debugging.  Got the message I'd expect:

"Unable to start debugging.
Access is denied. This seems to be because the 'Network access: Sharing and security model for local accounts' security policy does not allow users to authenticate as themselves. Please use the 'Local Security Settings' administration tool on the local computer to configure this option."

The option it's referring to is not configurable on Home Editions of Windows, so there will no remote EnC for me.  It's annoying, but it's no different from using a console devkit, so I should stop whining.  When I want to use EnC, I'll just debug locally.
     
  Installed NVIDIA PerfKit 5.1 on the new PC.
Can't get NVPerfHUD to work though; apparently there isn't an instrumented driver for 8800 yet:
"The NVIDIA Setup program could not locate any drivers that are compatible with your current hardware.  Setup will now exit."
     
  Got the remote debug monitor auto-starting with all the right parameters, so the game can now be launched with remote debugging without me having to do anything.      
  Installed NVIDIA PerfKit 5.1 on the new PC.
Can't get NVPerfHUD to work though; apparently there isn't an instrumented driver for 8800 yet:
"The NVIDIA Setup program could not locate any drivers that are compatible with your current hardware."
     
  I just got confused to hell and back - Visual Studio had set itself to 'show all files' on the solution explorers.  So I was opening the shaders solution and thinking "what is all this weird random old junk?  Where are all my .fx files?"  The thing that made it extra-confusing was that no amount of SVN reversion seemed to change anything.

The problem might have been caused by me typing on the wrong keyboard, which I've been doing all day - although there doesn't seem to be a default shortcut for 'show all files'.
     
#revision 956
#revision 958
Very nearly lost the following files, which weren't in SVN, while heavy-handedly messing about trying to understand the problem described above:
h_Menu.fx
h_MotionBlur.fx
MenuTitle.fx
CullPlaneUser.cpp
Luckily I found them in the recycle bin.  These files are now in SVN.

This is why I back-up my actual project folder, rather than the SVN repository.
Should really back-up both I suppose.  The repository is only 1.5 GB.
     
  Visual Studio: lost my keyboard shortcuts (?)<-FIXED (11th) somehow 'MyMacros.vsmacros' had got unloaded      
9-Feb-2008   2    
  Wasted the whole day trying and failing to set up
- a router
- remote debugging
     
  Project settings: I've set the debugger type to 'native only'.  This is because remote debugging on home editions of Windows only supports native code rather than 'managed' code.  I don't even know what this means, but I wanted to check that the debugger still behaves ok in that mode.  Seems fine so far.      
  Project settings: Resources: I've set 'culture' to French (France) (0x40c).  I don't think this makes any difference to my stuff anyway.      
#revision 951 Deleted the 'media' folder (junk inherited from the HDR sample).      
#revision 952 Deleted the 'UI' folder and removed it from the installer (junk inherited from the HDR sample).      
  Cleared out a load of inherited UI junk from the HDR code, including HDR_InitApp.      
7-Feb-2008   3.66667    
  The need for reflections on the menus led me into thinking about reflections in general.  The most important place I need them is on all the glass (shop fronts, etc), but I also want the cars to be reflective, and plenty of other stuff too.

I've come up with a very devious plan which, at the lowest detail setting, works without redrawing *anything* :
     
  1. Ignore the ground reflections for just now; I'll keep them working the way they are.  At the end, they might well join up with the general reflection system described below; that would be great, but it's not vital.      
  2. There will be a 'number of reflection planes' option, kinda like the numProjectors one for the shadows.  It will be possible to set the number as low as 0.  Each of these reflection planes will do pretty much what the ground reflection is already doing - straightforward planar reflection.  They'll get assigned to the wall planes that need them most at any given time.  I'll be aiming to set the default number of reflection planes to 1 (ground only) or maybe 2 if I'm feeling generous.      
  3. Here's where it starts to get novel.  I will be keeping a very small list of nearby planes (walls and ground) that will be used for simple ray-tracing.  I might well use the CullPlanes for this, since they'll already be positioned to coarsely cover great big swathes of wall, which is ideal.  One of the planes will always be a big section of the ground plane around the viewpoint.      
  4. One offscreen render target will contain a collage of images roughly representing the surfaces of each of the planes.  Those images are created by, each frame or across a span of frames, the appropriate trapezoids being cut out of the previous frame image (possibly also out of the ground reflection image), reshaped and glued onto the ORT.  Obviously only little bits of the collage (the bits that were in the frustum) will thereby get updated on any given frame, but that's fine.
When a new wall plane becomes 'active' as a raytracing plane, if it's not in view I can start it off by slapping a 'generic wall' texture on it or copy from whichever wall plane has been active longest, something like that.
     
  5. The collage from point 4 is used for the reflectors that don't have a reflection plane (so this includes all non-planar reflectors).  The following also applies to those reflectors.
In the reflection receiver material, whether it's on a window, a car or whatever, the vertex shader will trace the reflected view ray to the point where it hits a raytracing plane (if it doesn't hit a raytracing plane, bail out ASAP).
An extension here, to support normal mapping, would be that the vertex shader computes an extra two intersection points - one for the ray reflected by the tangent and one for the ray reflected by the binormal (or by vectors somewhere between those axes and the normal).  The pixel shader would then interpolate between the texture coords calculated in point 7 for each of these intersections.
     
  6. The vertex shader can compare the reflected ray direction against the main view direction, and against the view direction reflected by the ground plane.  From this it can decide whether the previous frame, or the current ground reflection image, would the better image to use for the reflection.      
  7. The intersection point is transformed into the clip space of either the previous frame's view, or of the current ground reflection view - whichever was chosen in point 6.  If the intersection point is found to be inside the frustum of interest, simply sample from the image chosen in point 6, and we're done.
If the intersection point is found to be outside the chosen frustum, sample from the collage instead.  Cross-blend at the transitions between the frustum and the collage if necessary - it won't break the bank.
     
  It's going to be a lot of work, but the result should be really pretty amazing.  Provided it all works, and doesn't look pants, the benefit-to-cost ratio of this effect will be totally off the scale :)      
  Although it's very tempting to dive into the reflection work now, I really need to get v15 out first.  This is because the compatibility bug in v14 (missing ground detail) is annoying, and slightly worrying too.
So the menus in v15 will not have any reflections on them at all,<-added placeholder reflections for now (17th)
but I will hopefully get the menus functional (most of them at least), so that options can be tweaked on the fly, finally - yipee!
     
  TODO: mock-up and implement menuitem selection effect<-done(17th) (mockups\menus\selection_PCB.psd)      
6-Feb-2008   3    
  Got the new PC working nicely.  And - PHEW - the 3DVisor headtracking is working on Vista 32 :)      
  Greatly improved the default settings for 3DVisor stereoscopy.
Remembered that I was clamping stereo convergence (0..1).  It's best to allow this to be set higher than 1, so I've now removed the clamp.  That should let me push the background further into the distance without changing the other settings.
     
  The setting that surprised me the most was interpupillaryDistance.  Once I'd got a decent impression of depth going on and the objects were appearing at the right size, it still felt like they were lacking 'weight' somehow.  Reducing the interpupillary distance from 7 to 5 fixed this really effectively.  Suddenly the cars felt as big as real cars.

These three stereo parameters - field of view, convergence and interpupillary distance - balancing them properly makes all the difference.  It's the difference between "yeah, that's
kinda 3D" (the worst feedback a VR project could ever receive) and "it feels like I'm actually there".
     
  Couldn't manage to network the two PCs using this broadband router.  Neither of them seems to be able to talk to it using USB.
TODO: GET A ROUTER!
     
  I managed to get TrackIR working on the new PC, but for some reason the game isn't finding the camera.  I did remember to copy the 'OptiTrack' folder into the 'NaturalPoint' folder.
Remote debugging might give me more information.  I hope it's fixable and not some kind of limitation with the OptiTrack SDK?
     
  TODO: need to try keeping the two eyes in sync (only updating once per two eyes); they lag apart on v14.  Or have I already changed that now?      
5-Feb-2008   2.41667    
  Hah!  I just got a crash because the 'O' in my character table was actually a zero! D'oh      
  below: got the fish-eye and subtle diffusion working for the titles.  There's a slow, just-noticeable bulging motion of the title text, as if it's breathing.  I'll probably do something similar for the tree itself; it's a good way of making the thing seem 'organic'.      
 
 
     
  The next layer is some glossy reflections, which should make it feel really solid and tie it into the environment.      
  But first I'm going to set up Vista 32 on the new PC...      
4-Feb-2008   4.5    
  Added MenuTitle.fx - Effect for menu title text.  WIll be closely related to MenuItem.fx      
  below: more soft-lighty goodness.  Pretty-much got these menu titles working now; just haven't quite nailed the fish-eye distortion.
Need to fix the glows as well; currently they get a bit chopped at the edges (faint vertical lines in picture below).
     
 
 
     
  Google: I've set France as the 'geographic target' for programmerart.org and lecauchemar.com.  I'll be interested to see if this brings in any more French hits.  The hit rate for the site is rubbish at the moment.  Why is no-one visiting my site?!      
3-Feb-2008   7.5    
  CLockableTexture can now be given a callback and context to be used at the end of OnResetDevice.
CFont instances use this to measure their characters, when option debug\processFonts is true.
     
  Added file FontCharacterData.hpp - contains the array of character data #included into Font.cpp (I'm currently only supporting one font, but that's easy to change later if I need to).
This is auto-generated by CFont::MeasureCharacters when option
debug\processFonts is true.
     
  Font blur: Gaussian, 30 pixels (for 1024 font image) .... I think      
  Photoshop blend mode formulae:
http://www.simpelfilter.de/en/grundlagen/mixmods.html
     
  TODO?: rain bounce mist effect by blending the blurred scene onto all the transitions between top surfaces and farther-away not-top surfaces?      
  below: Got all the font stuff working well.  This is built from the ground up, not using any D3DX stuff.  The blend mode is a cut-price forgery of Photoshop's 'Soft Light' blend, performed by MenuItem.fx's pixel shader.  C'est joli hein?
I'm following the mockup pretty-much to the letter, and it's paying off.
     
 
 
     
  TODO: Menu titles <-done (5th)
and selection effect.
     
2-Feb-2008   9.16667    
  Added an error dialogue to handle unplugging of the 3DVisor while the game is running:
MESSAGE_3DVisorError_removed
TODO: need to zero the headtrack transform if the player chooses to continue without headtracking.
TODO: looks like I need to do some 3DVisor re-initialisation if the player chooses to retry.
     
  Excel: ctrl+` to show all forumulae 'raw' rather than evaluated (discovered this by accident because it's my Visual Studio 'find in files' shortcut)      
  Added functions:
Vec2Zero
Vec2InitMinBound (initialise a minimum-bounds vector to high positive values)
Vec2InitMaxBound (initialise a maximum-bounds vector to low negative values)
     
  Added options:
debug\processFonts - (TODO) measure the characters on the font texture(s) and save out the measurements<-DONE(3rd)
debug\processMeshes - (TODO) optimise all meshes and save out the optimised versions (this will reduce the game's startup time enormously - currently it optimises the meshes each time it starts)
     
  TODO?: D3DXCreateTextureFromResource ??      
#revision 933 Spent a long time extending CLockableTexture so that it can load itself from a texture file (this is so I can lock the font map to measure the characters, when option debug\processFonts is true).
Had a lot of ordering & resource-handling hassles to get my head round, most of which were caused by the complete deletion & reconstruction of the pause menu tree each time the pause mode is entered (intentional, debug only, for ease of testing).
But it's working now, at last :)
     
  TODO: Measure the characters<-DONE(3rd)      
1-Feb-2008      
  below: a petition to free our friend from a horrible situation in Dubai; you might be able to help him by signing it:      
  http://www.petitiononline.com/cle2008/petition.html      
  more info:      
  http://thetruthaboutdubai.com/      
1-Feb-2008   2.83333    
  Made a decent chunk of progress with the font & menu stuff.  I'm on the brink of seeing some letters on the screen now :)
Added MenuItem.fx (effect for CMenuItem text)
     
  Remembered there is no D3DPT_QUADLIST >:(      
30-Jan-2008   3.5    
  Improved the font texture loads.  It's now square as well.  The glow seems to fit ok; will need to wait & see if it's wide enough for what I want (although I'm not likely to want to change the layout now!)      
  Added CFont, which takes care of calculating basic positions and UVs for text verts (CFont::PlotText).
It owns the character table and each CFont instance owns a texture.  In practice there will only ever be one font instance, but I'll write it as if there could be any number of them.
     
  CFont: Decided that I probably don't want to get into the business of automatic line-wrapping, and I shouldn't need to.      
27-Jan-2008   5    
  The online devlog is now the complete devlog from day 1.  This is mostly to try to draw more hits in.
Internet Explorer seems to deal pretty well with huge pages, eg. doesn't try to download pictures until you scroll to them.
     
  Tried using the GDI function 'GetGlyphIndices'.  Supposedly I would just have to include <windows.h>, but this didn't help; the call still didn't compile.  Not sure what I'm doing wrong there.      
  Tried using Photoshop's File\Automate\Web photo gallery option (after running the action called Select Workspace "Web Design")
Output here: C:\Noctambule\Website\gallery
I'll try a different template next time.
     
  Note: ImageReady lets you save out SWF files.  I don't know how to make them animate, link or any of that stuff though.      
  Installer: Discovered the right way to ship fonts for the game: just set the font file's 'register' property to 'vsdrfFont'.
When you install the game, it magically installs the font! :)
And it uninstalls the font when you uninstall the game (but presumably not if it's marked 'permanent').
     
  15*8 = 120      
  8*16=128      
  Diacritiques utilisés en français :
http://fr.wikipedia.org/wiki/Diacritiques_utilis%C3%A9s_en_fran%C3%A7ais
     
  Eventually went off the idea of using D3DX font stuff.  It was *almost* helpful, but not quite.  I got the feeling that it was going to make things more complicated than they needed to be, and less flexible.      
  Built-up the font map PSD (C:\noctambule\Graphics\Fonts\Menu\font.psd).  It took a while but it's looking sturdy now.  I'm leaving plenty of room round the characters so I can have a blurred (glow) version that uses the same coordinates.
See corresponding string array currently at the top of menu.cpp
     
26-Jan-2008   10.25    
  Added file pairs for the menu system (most of them are stubs at the moment) :
PauseMenuTree - subclass of CMenuTree for the pause menu tree
Menu - a menu, a node in a menu tree
MenuItem - base class for all menu item types (below)
MILink - item that navigates to another menu
MIConfirm - eg. for the 'quit' option; pops up a confirmation dialogue.  Might use this for the undo options too.
MICheck - checkbox, for Booleans.  This'll be the most-used menu item type.
MISpinner - for int and float values
MISlider - eg. will be used for 0..1 type values
MIRenderTarget - render target dimensions (and in some cases, format)
MICombo - for enum values.  Slightly slangy use of the Windows term 'combo', since there's no 'edit box' element to it.
     
  Note the absence of a basic 'text box' base class, and of any mention of 'boxes' in the naming.  No boxes here.
All menu item types have a string index property, because they'll all display at least one string.
     
  Added ESTRING_none for uninitialised strings.      
  Strings: started using these naming conventions for menu strings in the string table:
(ESTRING_)menuName_title - the menu title string
(ESTRING_)menuName_optionName - the option's label string
(ESTRING_)menuName_optionName_confirm
- the confirmation message for an MIConfirm item
     
#revision 913 StringTableParser: fixed a parsing bug that was stopping some entries getting written out.      
#revision 914 ...and another one.      
  C++: Weird - it seems that a constructor can't directly call a pure virtual method of its class (doesn't link), but it CAN call such a method via another (non-pure-virtual) method.

eg. CMenuTree::CMenuTree can't call CMenuTree::Populate,
but it can call CMenuTree::Init, which calls CMenuTree::Populate
<-no, that gives a runtime 'pure virtual function call' error.
I'm now calling CMenuTree::Init from CPauseMenuTree constructor instead; this works fine.
     
  Note: CLinkedList is not circular.
Added CLinkedList::DeleteAllElements.
     
#revision 916 Made some fixes to CLinkedList.  Spent a while getting frustrated at some memory trampling problems I was getting with it.  Fixed now.      
#revision 917 I fell-out with CLinkedList/CLinkedListItem and have now deleted them (they still exist in SVN history).

I've replaced them with a slimmer, wiser CListItem base class, which is nice and minimal (ListItem.h)
     
  C++: It's a shame you can't pass parameters to destructors:
error C2524: a destructor must have a 'void' parameter list
     
#revision 919 Another stringtable parsing fix (all the French text was coming out English)      
  Started finding out about D3DX's font stuff.  Looks useful.
'Text3D' sample:
C:\Documents and Settings\user\My Documents\Visual Studio Projects\Text3D
     
  Some info about optimised anaglyphs:
www.3dtv.at/Knowhow/AnaglyphComparison_en.aspx
     
25-Jan-2008   0    
  C's leaving doo (another one off to France!)      
  EB recommended Monpellier again.  I'll very likely visit there this year.      
  NC says the game wasn't running too well on an 8600.      
24-Jan-2008   3.25    
  CModeHeadTrackOffset, when added to the mode stack, now makes the hardware-specific profile 'currently-editing'.  This'll save the player a load of confusion.  Returns to the previous profile when removed from the stack.
This means the player can never graphically edit headOffsetMatrix in the Custom profile (by design).
     
  below: Got an accidental 3rd-person mode, by setting a large head position offset when in 3DVisor mode.  This created a head-tracked pivot cam, which is really quite nice to use!  So I'm tempted to add a mode like this:      
  http://www.youtube.com/profile_video_blog?sid=C4FFF779482D5F6C&id=B109960914F9AABD      
  Same video at full quality (24 MB wmv) :      
  http://lecauchemar.com/videos/thirdperson.wmv      
  Didn't really get any work done this evening.  Preparing and uploading a video takes hours :(  And it leaves me in a distracted mood so I can't get any coding done afterwards.      
  On the up-side, I know how to use Windows Movie Maker now ("ga-ga!"), and I know its output works with YouTube.
I used the Video for local playback (2.1 Mbps) setting.
     
23-Jan-2008   2    
  New PC: Just needed to send some power to the CPU.  Now working fine :)
Just waiting for Vista to arrive now.
     
  Added function CModeStack::InsertAbove      
  CGameMode now inherits from CNameUser      
  CModeStack: fixed the ordering within the various add & remove methods so that the mode is fully added/removed before OnAddedToStack/OnRemovedFromStack is called.  This makes it safe for modes to add/remove child modes when they're added/removed.      
  Added function CNoctambuleApp::SetPauseMode      
22-Jan-2008   0    
  Built the new PC with tons of help from M.  At the end of the night it powered-up but didn't do anything.  I assumed I'd broken the CPU or the motherboard.      
21-Jan-2008   0    
  Started trying to build the new PC.  Used the wrong screws when trying to fit the motherboard (misled by some instructions).
Need pliers to continue.  Can't find pliers.
TODO: find pliers.
     
20-Jan-2008   10.5    
  Increased CNoctambuleApp::s_generalTemporaryBufferSize from 2K to 16K.
CNoctambuleApp::(g_game.)generalTemporaryBuffer is used to buffer the file contents in COptions::Save.
It's also used by CBlockFileParser and CRainFalling.

(These were previously called MAIN_TEMPORARY_BUFFER_BYTES and g_temporaryBuffer)
     
#revision 901 COptions::Save now saves out every option correctly.      
  Moved: COptions::ReadRenderTargetOptions
is now
CRenderTargetOptions::ReadFromFileString
     
  CBlockParser: All the 'Read...' methods are now static.  The likes of CRenderTargetOptions uses these functions; I'm happier to expose them than to force classes to inherit from CBlockParser just to get at them (which could be confusing if their job isn't to parse blocks).
Fittingly, all these methods were already marked as const-this anyway.
     
  CBlockParser::ReadVec3/Vec2/Matrix now take pointers instead of references - more consistent with the rest of the code and therefore less likely to cause mistakes.      
  I reckon this music track would be brilliant for the replay mode:
The suitably-titled "Zombie Overlords" by DeathBoy:
http://deathboy.anti-goth.com/ToRights/zombie%20overlords%20-%20DeathBoy.mp3
It fits well because it's dark, techy, intense, glitchy and ominous-sounding.
TODO: choreograph the camerawork/cuts to tie-in the with whatever track I end up using.
     
  Options: rather than having ok/cancel options, I'll add a button to revert to (re-load) the last saved options.  This'll need to reset the override flags as well.
This option should be called something like "Undo last changes"
Saving will be automatic on exiting the pause mode.

A separate option for "Restore defaults" will be provided (empties the currently-editing profile, clears its override flags, re-loads the profiles).
     
  Undo: If changes have been made in the current pause session, the undo option above needs to change to 'undo current changes' (reload all current files - doesn't require a backup).
After undoing current changes, it should change back to 'undo last changes' (copy from backup instance)
     
  More undo: Each menu needs its own local 'undo' and 'defaults' option as well.      
  For the partial profiles, I'll need to put a choice in the (probably main) menu for whether we're editing the Custom, OptiTrack or 3DVisor options (defaulting to Custom).
In debug builds, maybe include the option to edit the 'Default' profile as well.

This setting will simply control which override flags gets set when editing any options.  It should probably spring back to Custom each time you enter the pause mode, to save confusion.
     
  Partial profiles: need some visual indication of which options are overridden in the current profile, and a way of un-overriding them (right-click?)
The override/unoverride option should toggle the value between its unoverridden* value and its last overridden value (if any) from the current pause session.

*not necessarily
default
     
  Added a Profiles\AutoBackups folder which will allow the 'Undo last changes' option to work (game-generated copies of the previous versions of the custom profiles will be kept here)<-changed the undo system to work without backup files now      
  Installer: Added AutoBackups folder (ships empty)<-removed now; not using files for the undo system.
Renamed 'Optitrack' folder to 'OptiTrack' - shouldn't cause any disruption
     
  I've got a slight mix of enumeration styles in the game.  Nearly all of them are old-style (as specified in my coding conventions doc) :
like "ETHREADPRIORITY_LOWEST"
but three of them are EB-influenced and make use of scope (including one I added just now) :
like "COptions::EEditableProfile::custom"

Either style could technically be used in the options profiles, but for that case I'll definitely stick to the old style for consistency.

For the rest of the code.....well the scoped ones make the other ones look bad.  Scoped ones are better I'd say; non-scoped ones are more popular/common; it's good to show consistency; it can also be good to show flexibility.  There doesn't seem to be an ideal solution without knowing the style preferences of the target audience.
I'll just carry on using a mixture.  However, I won't wrap any enums in their own little struct/class unless I actually have a need to.<-(see below)
Updated the coding conventions doc accordingly.  See also: log entry on 2nd of March 2007.
     
  Hmm, now I see the reason for wrapping those enums in their own little structs - it's because the enumerator doesn't create proper scope for its contents the way a struct does.
ie. Two enums in the same scope can't have the same member names.
     
#revision 906 Cool, the partial profiles loading & saving is now working properly (saving a profile only writes-out the values that the profile overrides).
TODO: stop it writing out empty category blocks<-done
     
  Added functions:
COptions::Load
COptions::FlagOptionOverride
     
#revision 908 CModeHeadTrackOffset (headtrack calibration mode) now detects the player's changes and flags the relevant option as being overridden, causing the new values to write to the currently-editable profile when pause mode is exited :D
Where did I put that biscuit tin?
     
  Well that's actually all the options stuff done for now - a weekend well spent.  This leaves me totally ready to start putting the menu system in place, made all the more satisfying by being able to hook into a *working* options system right from the start :)      
19-Jan-2008   8.75    
  NOTE: strncpy_s appends a null terminator, in addition to copying the requested number of characters.      
#revision 899 I've renamed my #included CPP files to be HPP files instead.  HPP seems to be the most correct extension for the job, according to the description below, and it saves me having to exclude them manually from the build when they're added to the project.
- OptionDescriptions.hpp
- StringsFrançais.hpp
- StringsEnglish.hpp
Updated the tools accordingly
     
  HPP: "Header file that may contain variables, constants, functions, and other code referenced by a C++Builder [etc.] source code file; allows common functions to be referenced by multiple files..."      
  Weird, I was sure there was a 'strcatf' ?      
  NOTE: the option description system doesn't allow for private members in the option category structs.  Not ideal, but I only had one of them anyway.      
#revision 900 Spent today writing the OptionsParser tool, which is working well.  COptions::Save now does just that :)      
  Non-loaded members of option category structs use the NON_LOADED symbol after their type, which is a signal to OptionsParser to skip to the next member.      
18-Jan-2008   2.8    
  PC is scheduled to arrive on Monday.      
  Nailed-down the workings of the "option descriptions" system from last night, using a compiling mockup of the auto-generated code.  This looks like it's going to work well.
NOTE there is still no automation for menu population, association of menu items with options, etc.  I don't want to automate any of that, never did.
     
  I've designed-in some support for editing of partial profiles.  SOptionDescription::flags is used to indicate which profiles override their inherited value for the option (the relevant profiles being Custom, 3DVisor, OptiTrack).      
  Added function COptions::Save, which takes a filename and a filter for the flags described above.      
  Added file OptionDescriptions.cpp which will be auto-generated by the 'OptionsParser' tool.      
  TODO: OptionsParser tool!<-DONE(19th)      
17-Jan-2008   4.25    
#revision 881 Yeah, no point doing anything with OptiTrack at the moment - I'll wait till the new PC's put together, and see how that copes with it.
Till then, since I've made a bit of a mess and broken a couple of things, I'm reverting COptiTrack.cpp&h to revision 876.
     
  Added website\final\code to SVN.      
  OptiTrack: The weird startup lerp was caused by a faulty matrix copy (like *destMat = *srcMat where neither is a pointer, so it was only copying the first float).
That's a relief - I'd imagined it was some kind of sinister, thread-related hoy.
     
  CModeHeadTrackOffset: Made this much more usable by changing the transform control to be in head space rather than TrackClip/headset space.      
  Added functions:
MatrixGetTranslation
MatrixToEuler
     
  Removed options:
headTracking\headOffsetX
headTracking\headOffsetY
headTracking\headOffsetZ
headTracking\headOffsetYawRadians
headTracking\headOffsetPitchRadians
headTracking\headOffsetRollRadians
     
  Added option headTracking\headOffsetMatrix      
  OPTIONS:
I need to do a bit of an overhaul in order to make the options nicely saveable.
I could do this using fancy C++, wrapping each type in a class so I'd have like COptionsFloat with a float() operator and so on.
Instead I'm thinking of writing a little tool that parses Options.h and for each category builds up a CRC-sorted table of names, CRCs, types, (strings&counts) and member pointers.  And the same kind of thing for the categories themselves. 
Something like the following (but obviously made to compile) :

const SOptionCategoryDescription COptions::s_optionCategories[EOPTIONCATEGORY_NUM] = {

{"WOWvx", 0x18322693, 7};// name, crc, numOptions
 
...};

const SOptionDescription COptions::s_optionDescriptions[COptions::s_optionCategories.numOptions] = {

{"nearDist", 0x34782562, EOPTIONTYPE_FLOAT, &g_game::s_staticOptions.WOWvx.nearDist, NULL, 0},

{"contentType", 0x24978523, EOPTIONTYPE_ENUM, &g_game::s_staticOptions.WOWvx.contentType,
COptions::s_WOWvxContentTypeNames, EWOWVXCONTENTTYPE_NUM},

...}

<-done, see OptionDescriptions.cpp
     
16-Jan-2008   4    
  OptiTrack thread:
- had to raise the priority to above-normal to get it to move at all in fullscreen.
- when windowed and paused, it's reasonably smooth.<-when windowed & running and set to THREAD_PRIORITY_TIME_CRITICAL, it's very good
- when
running and/or fullscreen, it's jerky.
     
  Tried running the TrackIR heads in the background while the game was running in a ~1280*1024 window:
- it's jerky just like my in-game tracker thread
- when its priority is set to 'realtime', it copes better and uses as much as 20% CPU
     
  I might leave this stuff till I can test it on the new PC.  I feel like I'm wasting my time at the moment.
I've tried everything I can think of; it's as if there isn't enough CPU speed for the image processing to happen fast enough - which maybe suggests that it's not done in the camera hardware itself like I'd imagined?  Not sure.
     
15-Jan-2008   3.5    
  Added option debug\disableEnemies (replaces a macro called ZOMBIEMANAGER_NOTHENOO ;)
I'm trying to keep all the 'debug' properties named so that their defaults are false (hence 'disableEnemies=false' rather than 'enemies=true')
     
  Remembered that the fallback shadow image is generated on a small ORT, so the zbuffer can't be used when generating it.      
  If I definitely only want fallback shadows on the ground (or shall we say, the 'reflective mesh'....) then FallbackShadowReflectionPosition.fx can be merged into FallbackShadow.fx, and the fallback shadow image can be generated by rendering the reflective receiver mesh with this combined effect.
<-nah, that would mean drawing the receiver mesh for each light.  It's good that currently the receiver only has to be drawn once (RT covering quads from there on) to generate the images for all the lights.
     
  Got the fallback shadows working properly.      
  FallbackShadowReflectionPosition.fx: removed the constant 'cMainViewDir'
The depth occlusion now works by comparing VP-relative squared scene
distance with squared view-space receiver Z position.  (NOTE the slight mismatch; if it causes any visible problem then I'll fix it - so far it looks fine).
     
  FallbackShadowReflectionPosition.fx: removed the constant 'cFallbackShadowsOnGroundOnly' (now always true).
Using fallback shadows on meshes other than the intended receiver produces glitchy, unreliable results (works well in some cases, certainly, but that's not good enough).
     
#revision 875 Removed option shadows\fallbackShadowsOnGroundOnly (now always true)      
  TODO: option for ground (kerbs) to reflect in ground (backface culling should help a lot here)
This will also produce kerb fallback shadows, which will be nice.
     
#revision 876 Realised I could rename StringsFrancais.cpp to StringsFrançais.cpp, and did so (purely to be awkward), using SVN rename.
Updated the StringTableParser tool accordingly.
     
  Threads: found that without the Sleep(0) sub-loop in each of the thread procedure loops, Windows locks up.      
  TODO: finish converting COptiTrack to use a thread to read the camera.      
14-Jan-2008   4    
  Trying to track down this weird reflection / fallback shadow glitch:
- rainOcclusion = false: doesn't change it
- numProjectors = 0: doesn't change it
- remming-out the fallback shadow drawprim doesn't change it
- ERENDERTARGET_FALLBACK_SHADOW looks fine
- ERENDERTARGET_REFLECTEDDEFERREDLIGHTING_DIFFUSE looks fine
- remming-out the CRainImpact drawprim doesn't change it
- writing height=(1 or 0) from parallax.fx doesn't change it
- writing height=(1 or 0) from ground.fx doesn't change it
- writing gloss=(1 or 0) from parallax.fx doesn't change it
     
  ...ERENDERTARGET_REFLECTION_FINAL      
#revision 870 Fixed most of the problem I was seeing (corruption / shadow after-images in the ground reflection image).
DeferredLighting.fx was reading shadow samplers even for the reflected draw (in which case they were just whichever textures were last used on those two stages).
I've now added uniform parameters to toggle shadow work and to toggle the 'diffuse shadow' behaviour (fallback shadows set this false to only shadow specular lighting).
This fix should be a fairly hefty savings too :)
     
  Fallback shadow masking is still misbehaving (and always has been).  That's why specular has been missing on walls etc (showing up only occasionally, with faulty masking corresponding to the ground behind the building).

- FallbackShadow.fx has a bit of code to prevent shadows when the light is behind the viewpoint.  It seemed to be causing far more glitches than it prevented, so for now I've remmed it out. 
TODO: test properly once the other glitches are fixed.
- When the ground mesh is drawn into the fallback shadow 'reflection position' image, the landscape seems to have already been cleared out of the zbuffer.  The landscape absolutely
must be in the zbuffer at that point in order for the masking to work.  TODO: reorder stuff so that this is the case.
- clearing ERENDERTARGET_FALLBACKSHADOWREFLECTIONPOSITION to a specific value and then testing for that value just doesn't seem to work.  There's must be some catch I don't know about, probably specific to floating-point render targets.
     
#revision 871 Right, I've got something partly working now (still got the sorting problems), by using 0.f as the 'no shadow' value (tested-for in FallbackShadow.fx).  TODO: investigate/improve, etc.
See CLandscape::GenerateFallbackShadowReflectionPositionImage.
     
13-Jan-2008   0    
  Spent today catching up with work-work.      
  VirtualDub: a good setting seems to be Indeo 5.10, 50% quality, force keyframe every frame (30fps).
Below: dancing head video with those settings, youtube-ified.  Also synced the music which was 1 beat behind :
     
  http://youtube.com/profile_video_blog?sid=C4FFF779482D5F6C&id=00E8D93EFCDE138E      
12-Jan-2008   13.5    
  The crazy background thing last night was caused by an uninitialised W column in CHeadTracker::vsHeadTransform.      
  Added adaptive smoothing for TrackIR - works a treat; filters off all the jittering.
Removed option headTracking\smoothing
Added option OptiTrack\smoothingRange (the total object pixel distance above which the lerp T is 1)
     
  Added a little unit test for the COptiTrack's vector tracking (generates artificial objects to track) - COptiTrack::SpoofObjects.  I really should have done this to begin with - it took about 10 minutes and it's helping the debugging enormously.
By generating artificial objects, I'm removing the following sources of inaccuracy:
- IR camera FOV measurements
- TrackClip light position measurements
- IR camera resolution
     
  Using the artificial objects, the tracking (especially looking at depth results) is bang-on except when the clip is at certain 'ambiguous' angles, then it shakes briefly same as usual.  This is reassuring - it narrows down [most of] the problem to COptiTrack::InterpretObjects.  In fact, the jitter will almost certainly be coming from the ray-plane intersection in GetDistanceFromRayToRing.  I would love to know how a mathematician would solve all this.....      
  Tried using a different implementation of IntersectRaySphere (from t'Internet again).  Currently sitting alongside it and named 'IntersectRaySphere2'.  Compared the difference in return value (inside COptiTrack::TestZPosition); it never exceeded 0.001f.
Both versions gave the occasional jitter described above.
     
  TrackIR 4 camera res: 355*290
355/290 = 1.2241379310344827586206896551724
     
#revision 869 Wow...just been playing with virtual-window headtracking + full-strength anaglyph + placeholder weather sounds.
It's a spicy combo!
     
  TODO: maybe add an anaglyph-friendly (drier) version of the lighting?  Specular highlights on the ground seem to be the main things making the anaglyph really ugly at the moment.      
  Did another bout of testing & calibration for TrackIR.....
- I'm now using the officially quoted horizontal FOV of 46 degrees, *exactly*.
- The aspect ratio that works in conjunction with that FOV give the correct distances for the clip is exactly 6:5 (1.2:1), so that's what I'm now using.
It's possible that instead, I should be using the aspect ratio of the camera res, adjusting the fov to fit accordingly.  Who knows.  It seems to be working well anyway.
     
  TODO: a fix is needed in the VW headtracking: I'm not convinced the camera correctly moves closer to objects as the head moves forward; investigate!      
  Parallax.fx: made the top sides and undersides of objects automatically wetter      
  TODO: fix whatever that glitchy fallback shadow / reflection thing is!!<-FIXED(14th)      
11-Jan-2008   4.5    
  TODO: really should try a rainbow ramp texture for the volume lighting.      
  Added option OptiTrack\cameraMountedOnMonitor (defaults true)
This indicates that the OptiTrack camera is on the real-world screen plane.
When this is true and a camera is active, realWorld\distanceToScreen is ignored and the head depth percieved by the camera is used instead.
     
  Noticed that alt-entering while paused leaves the rain (and presumably bloom?) over-bright (alt-entering again while not paused fixes it).
Could this be a clue to the over-brightness bug on nVidia cards???
     
  Had another look at the TrackIR control panel app.  Their head-tracking results are extremely solid and precise compared to mine.
One of the reasons why it's so good seems to be the clever smoothing that they're using - the interpolation rate seems to be weighted by the delta between the current and destination transforms/dots.  In this way, pixel-level jittering is completely hidden, while large (genuine, intentional) movements feel perfectly responsive.
     
  Added a disclaimer in the release notes, and in the public headtracking source, saying that my TrackIR support is a bit naff.      
  Added function Vec2Distance      
  Got the virtual-window fov working; currently just sorting out some smoothing stuff.      
#revision 864 Below: an uninitialised matrix or something started causing this crazy random flickering background.  So I made an impromptu music video - enjoy!      
  http://youtube.com/profile_video_blog?sid=C4FFF779482D5F6C&id=00E8D93EFCDE138E      
10-Jan-2008   0    
  Got the phone line fixed.
Been ill the past two days, really weak and tired (and no doubt will be tomorrow as well)
     
  Below: ordered a nice new PC to cheer me up.  ETA: 15th January  ETA for French Vista: 24th-28th January.      
  file://C:\correspondence\newPC      
9-Jan-2008   3    
  Little detour this evening - I'm going to add the 'virtual window' head-tracking mode, having seen a video of it looking very effective using a Wii-mote.
When using OptiTrack, this mode shouldn't suffer so badly from the accuracy problems I'd get normally, because it's only the head's position that we care about, not its orientation.
     
  Removed CCamera::ApplyProjection.  This work is now done in CViewInfo::ApplyCamera.      
  TODO: fix crash;<-working now(11th)
finish virtual-window fov update<-done(11th)
     
8-Jan-2008   4    
  FIXME!!! HDR\finalMultiplier breaks the brightness of the rain and the other effects using the bloom image.      
  Now writing HEIGHTMAP values to position.a (MRT[1].a)      
  DeferredLighting.fx: Added heightmap-based fake self-shadowing for diffuse.  Works lovely.      
#revision 860 DeferredLighting.fx: Tried doing something similar for specular.  Decided it wasn't worth it (it worked, but in practice you hardly get to see it), and it damaged the glinting of the rain impacts too.
DeferredLighting.fx is highly speed-critical.
     
  DeferredLighting.fx: Ambient is now affected by height.  Works lovely.      
  Ground.fx: Reflection strength is now increased at areas where the reflected object is very close to the ground.  This makes ground-to-landscape joins look more natural.      
#revision 861 Very pleased with all the improvements to the lighting model.
The POM is looking mighty chunky now, even on the ground :)
     
7-Jan-2008   3.75    
  Improvements to texture levels (road, kerbstones, brick) and Ground.fx.
Ground.fx now has nice Fresnel-esque stuff
     
  IMPORTANT: Keep colour grading turned OFF while tweaking texture levels!!      
  TODO: finish fixing Ground.fx (see #errors - to do with reflection position)<-FIXED(8th)      
  TODO: really need to streamline the texture tweaking process.  Maybe use that procedural T-pages idea (model them in Max and make the game assemble them) ?      
  TODO: decide what to do about kerb decals (overhang)      
6-Jan-2008   11.3333    
  Colour grading (HDR\curve) is now forced OFF in anaglyph modes.  This is because:
- grading increases contrast; contrast is bad for anaglyph
- grading affects colour balance, which wants to be kept flat for anaglyph
- grading is expensive; anaglyph is expensive enough already
- grading was causing a rain colour mismatch in anaglyph modes
     
  NOTE: bloom source image is too banded to be of much use on its own      
  3DVisor: roll drift seems worse than I remember it, hmm.  I'm not getting any yaw or pitch drift though.
Lack of yaw drift would seem to suggest that the problem isn't magnetic.
     
  Added option motionBlur\secondaryBlur (defaults true / false for 3DVisor).
This blends the scene towards the bloom image according to each pixel's speed (done in HDRLighting.fx).
This hides the gaps in the motion blur that appear when turning sharply.
When using an HMD, the benefit of this option is negligable and it should not be used.
     
  Added option screenEffects\edgeBlur (defaults true / false for 3DVisor).
This blends the scene towards the bloom image at the edges of the screen.
     
#revision 847 Getting an instant-restart crash whenever I try to draw to MRT[3] when drawing the menu.
- tried setting the MRT[3] target on MRT[1]; that works fine
- tried a different target as MRT[3]; still crashes
Moving the menu draw to inside CPatchwork::Render prevented the problem (see revision)
     
  Found that the menus will need to draw after the bloom image is created, otherwise they feed back and become opaque.
Drawing them after the bloom image is created means they can't have any motion blur or deferred lighting.
Motion blur on the menus was really nice while it lasted, but you can't have everything.
     
#revision 851 Started playing about with texture brightness levels, starting with the road surface - which now looks about the way it should (inky black with a just a scattering of grey speckles).
TODO: Ground.fx / DeferredLightingApply.fx: texture colour has to get even darker in the distance (shallower angles) - so that road paint appears to blend in with the tarmac.<-DONE(7th)
     
5-Jan-2008   10.8333    
  RenderSubset: NEW TEST: now only generates rain lighting for the first of the two eyes.<-no dedicated rain lighting image now, see below
TODO: VR mode: need to improve eye swapping method so that the ordering is never wrong (swap using a signal to the headset).
     
  Renamed CMist::Generate -> CMist::Prep because nowadays it doesn't do any rendering, just prep (it's rendered as part of DeferredLightingApply.fx)      
#revision 833 Moved pRainFalling->GenerateLighting to be done straight after CHDR::EndScene (instead of right before the rain render).
The lighting image no longer lags behind by 1 frame when used on the MenuTree.
<-see below
     
  CGameMode::flags is now public      
#revision 835 Made important changes to falling rain:
- Did-away with rain lighting image.  Rain now refracts the HDR bloom image (which I've set-up to be an unbiased blurred version of the scene).
- HDR bloom and glare are now drawn in a separate pass after falling rain has drawn.
- Falling rain now performs its own colour grading to match the scene's colour grading (unfortunately I don't see another way of matching the colours)
     
  The limitation of the above is that the values of BRIGHT_PASS_THRESHOLD and BRIGHT_PASS_OFFSET (HDRLighting.fx) can never change.
The result is a slightly different style of bloom / glare, the kind of soft-focus look that was used in Fable.
Luckily for me, this suits both the misty environment and the dream setting.  The glares are going to be designed properly at a later point....
     
  Added options:
HDR \ bloomStrength
HDR \ glareStrength
     
  A slight problem with the new rain lighting is that it turns black at the very edges of the screen.      
  TOFIX: Noticed that rain moves with the player / viewpoint      
  3DVisor: Tried using the independent left/right RGB gain settings to create a perfectly ghost-free anaglyph mode.  Unfortunately the ranges of these settings don't allow complete filtering of colour channels.  However they should be sufficient to work as ghost reduction for a player wearing anaglyph glasses under the 3DVisor.  I might well give that a try at some point, crazy as it sounds.      
  TODO: get rain working in anaglyph mode<-done(6th)      
  Passed the 2000 hour mark.  I don't know if that's good or bad.      
4-Jan-2008   2.83333    
  Quadro: 14.0 didn't have the missing patchwork decals, and really didn't seem to have the over-keen bright pass either.  Tried fixed & floating-point lighting; both worked perfectly.  Rain seemed to go slightly odd-coloured when I brought the window size up to 800*600.      
  TOFIX?: Are rain impact splashes double-bright on 8800??  Would that make sense, with the brightness bodge?      
  I'm going to ignore the missing patchwork bug till I can get hold of an 8800/Vista to test on.  No idea what's going on there.      
  Control improvements (eg. for VR mode) will be left till version 15 I think.      
  Maintenant : MENUS      
  Mocked-up a more packed menu (weather/rain):      
  file://C:\noctambule\mockups\menus\blueRainRough.psd      
  Had a think about how to construct the menu tree.  Decided to make each blob a triangle fan, so that joining the branches to them will be fairly easy.  The glow/feather round the edges will all be done with textures.  I'll create the impression of 3D shape using normal maps.

I decided I didn't want to go down the route of rendering the tree as an offscreen mask and blurring it to get the feathered edges - too expensive and any lumpiness in the edges due to limited res would ruin it.

Considered building it as a fully-3D model in Max.  I'm fairly sure I'd be able to do this, with a bit of experimentation, but decided not to for a few reasons.  The 3D shape doesn't need to be deadly accurate anyway (as proven by the fact that the mockups looked fairly convincing).
     
  MENUS: tree shape squidging should all be done in the shaders (with the blob verts themselves kept in vertex buffers that change as little as possible).  I suppose it'll need to be in the VS so that branches stay connected.      
  Added MenuTree.cpp & .h containing the menu tree class and (temporarily) the classes for the menus and menu items.      
  I'm using the prefix CMI for menu item classes, eg. CMICheckbox.  I expect I should really be using namespaces or something instead....
Updated the coding conventions doc.
     
  CMIRenderTarget: TODO: (ideas at least)
- works like a spinner but has two drag zones, one for each dimension
- RMB changes the units of the dimension under the cursor (see mockup)
- label flashes / pulses when the control is edited; clicking on the label applies the change and puts the label back to normal.
- maybe menu tree fades out while the values are being edited (to give a clearer view of how things are looking) ?
- for the benefit of total-VR mode, spinners need to be mouse wheel compatible (and there should NEVER be any need to use the keyboard - although the ability to type values in would be a nice bonus if it's easy to do)
     
3-Jan-2008   0    
  Got M's recommendations for a new PC.      
2-Jan-2008   1.75    
  A couple of things I noticed in v14 on 8800 (on Vista) :
1. some ground patchwork decals appear to be sorted wrongly.  (BC car park & pavement, east manhole cover, John St. north yellow lines & kerbstones are all missing)
2. The brightness bodge that I added for nVidia cards works as intended, but the bright pass contains more stuff on 8800 than it does on mine (which makes sense, because the adjustment is in the 'finalMultiplier' which is done after everything else).
     
  The most important thing for me was that v14's VR mode worked fine on Vista, with stereo and headtracking.      
  Tested on a 16:10 monitor (setting aspect ratio in the profiles accordingly), all worked fine.      
  Can't think what the reason would be for problem 1 above.  Tried forcing zwrite & ztest off when drawing all meshes, they still came out fine on mine.  Tried removing the qsorts and they still appeared ok (because there isn't much overlapping yet).
Tried reversing the draw order (first in the draw loop, then in CMeshFrame::QSortCallback_VerticalDepth), to check that this gave the result I expected.
Maybe it's not a problem with the sorting but with the culling.  TODO?: Maybe test a v14 exe with no patchwork culling?
     
  TODO: option to use the current desktop res in fullscreen      
20-Dec-2007   5.66667    
  CBlockParser::ReadEnumeration now correctly ignores trailing whitespace in the property value string.      
  Flickering, glitchy lighting actually looks really cool, especially with the motion blur.
TODO?: Just before the enemies arrive, all the streetlights should go crazy (flickering and even flickering to different colours - like the enemies disrupt the mains somehow.  That way, you can tell when enemies are coming by the lights glitching, giving you an incentive not to shoot them all out.  Nice!  Using the lighting as a gameplay device is definitely a good idea.  Or do something with lightning.  Maybe that's their attack?!)
     
  After a bit of history-hopping, I found the source of the crazy lighting glitch I was getting.  I'd added a comment at the end of the "RTForceFloat: false" line in default.txt, and CBlockParser was ignoring lines with '//' anywhere on the line!      
  CBlockParser::ParseBlock now correctly handles trailing comments.      
#revision 825 Options: Testing render-target property values with whitespace:
"frameRT:   [/1<tab>,<tab>/4]"
"frameRT:   [/1,/4<tab>]"

Assertion failed!
Program: c:\Noctambule\Source\Debug\LeCauchemar_DEBUG.exe
File: c:\noctambule\source\options.cpp
Line: 618
Expression: (*pSrcChar) == ']'
     
  NOTE: HDR_InitApp has got nothing to do with HDR; it's legacy GUI setup from the HDRLighting sample.
TODO: remove it!!!
<-DONE (8th Feb 08)
     
  Oh wow, CNoctambuleApp::RestoreDeviceObjects already calls COptions::ApplyAll.  I'd forgotten about that.
So it is safe.
     
  CHeadTracker::Init now calls COptions::ApplyAll after choosing a headtracker device and loading its sub-profile.
This is much nicer than applying a sub-set of the options.
     
#revision 826 COptions::ApplyBeforeDeviceCreation now updates DXUT according to the options:
calls DXUTStartFullScreen and DXUTSetFullScreenRes.
     
  TEMP: Right mouse button now toggles eyes (even in master) when in frame-sequential stereo mode      
  TOFIX: disabling HDR\curve in Default_HeadTracking_3DVisor.txt went badly wrong....
Checked that it works ok (in 3DVisor mode) when disabled in default.txt
     
#revision 827 Going for version 14.0 ..... (please work!)      
  TODO: use a release EMADevice_DLL.dll !      
  Tweaked colourGradingMap_default.png by blending on 33% of colourGradingMap_3DVisor.png on top.  Haven't tested it yet ;P      
  Disabled HDR\curve in Example_speedyBare.txt      
#version 14.0 Released version 14.0      
19-Dec-2007   3.66667    
  TODO: very low priority, but eventually, I should handle the headset being connected & disconnected during play.      
  3DVisor: I've got 4 USB ports on the back of the PC.  The headset works fine on the bottom two.  On the top two, it gets power (displays work fine), but says "new hardware detected, Z800, blah blah" and fails to connect.  Why is that?
Also, TrackIR does something very similar in the leftmost of the two USB ports on the side of the case.
     
  I think this was happening (genuine 3DVisor headtrack connect error), but it's not happening now...
unconnected
can't connect to headtracker -> CANCEL
can't find headset
plug in
CANCEL
headset found.  try headtracker again?
YES
can't connect to headtracker
retry several times, then cancel.  Game starts with no headtracking.
     
  I'm leaving any polishing of the headtracker connection stuff till after the build.  It's plenty sturdy enough now and I don't have time to get sidetracked.
Actually I'm just going to leave it the way it is.  It's a matter of opinion which way it should work, and the current way avoids unnecessary create-then-delete nonsense.
     
  Kewl, CHeadTracker::Init now has a Thunderdome-style while loop for choosing between headtracker hardware!
// PP(19.12.7): up to two devices enter; up to one device leaves
     
  Testing CHeadTracker::Init with no hardware hint (default)
-
no devices: searched for 3DVisor then searched for TrackIR
-
TrackIR: searched for 3DVisor then found and used TrackIR
-
3DVisor: found and used 3DVisor (didn't search for TrackIR)
-
both: found and used 3DVisor (didn't search for TrackIR)
     
  Testing CHeadTracker::Init with 3DVisor hardware hint
-
no devices: searched for 3DVisor then searched for TrackIR
-
TrackIR: searched for 3DVisor then found and used TrackIR
-
3DVisor: found and used 3DVisor (didn't search for TrackIR)
-
both: found and used 3DVisor (didn't search for TrackIR)
     
  Testing CHeadTracker::Init with OptiTrack hardware hint
-
no devices: searched for TrackIR then searched for 3DVisor
-
TrackIR: found and used TrackIR (didn't search for 3DVisor)
-
3DVisor: searched for TrackIR then found and used 3DVisor
-
both: found and used TrackIR (didn't search for 3DVisor)
     
  (above) Checked that all error messages were present and correct.      
  (below) assertion failure when starting-up in TrackIR mode with the trackclip out of view.  Added a milestone bodge (bailout) and a REMIND message for now.
Now copes fine with the trackclip starting out of view.
     
#revision 821 "Assertion failed!
Program: c:\Noctambule\Source\Debug\LeCauchemar_DEBUG.exe
File: c:\noctambule\source\viewinfo.cpp
Line: 265
Expression: !pCameraIn->objectMatDirty"
   
  When the game selects a headtracking device, it now loads and applies one of two options profiles containing just the default headtracking settings for that device:
Default_HeadTracking_3DVisor.txt
Default_HeadTracking_OptiTrack.txt
These profiles can be edited by the player, but TODO: make them overrideable by custom.txt, otherwise the player could lose the default data.<-FIXED(below)
   
#revision 822 ...It now also loads Custom_HeadTracking_OptiTrack.txt / Custom_HeadTracking_3DVisor.txt straight afterwards, allowing the player to customise without losing any data.
The default profiles are now kept read-only and the custom ones are persistent.
   
  Default_HeadTracking_3DVisor.txt now sets up all the 3DVisor default settings, not just headtracking.
COptions::ApplyBeforeDeviceCreation is now called afterwards (instead of just ApplyHeadTracking).
This is precarious and needs to be improved after v14.
<-FIXED(20th)
TODO: should also rename these profiles to prevent confusion.
   
  Fixed frame-sequential speed-halving (CNoctambuleApp::GetFrameTime. todo: improve?)    
  TODO: Fix current crazy lighting glitch.<-FIXED(20th)    
18-Dec-2007   3.5    
  TODO for v14:
- fix speed-halving in frame-sequential mode<-Fixed(19th: CNoctambuleApp::GetFrameTime. todo: improve?)
- keyboard turn mode, mouse turn option
- mouse-only controls ("total VR" mode)  btw, TotalVR.com is taken
- 3DVisor yaw reset thing<-done
- what's going on with that post-build step in master config?<-TODO: use a release EMADevice_DLL.dll !
     
  Managed to terminate the 3DVisor headtracker thread, but only by calling TerminateThread, which is dangerous and not recommended (I think it's quite safe for my purposes though).
Tried using a volatile 'exit' flag but found that the headtracker thread doesn't get polled during the shutdown stage.  It can be exited smoothly in this way while the game is running, but not while it's shutting down.  Why is that?
     
#revision 819 Headtracker thread exit codes: 2 = in response to the exit flag, 3 = forced by TerminateThread      
  Checked the behaviour of 'assert' in a master build.  It's better than I'd expected, and perfectly safe:
-does work
-does evaluate the expression (eg. function call)
-error box displays source filename, line number and expression
-error box even appears and is functional in full-screen!!
-error box options are
abort (quits smoothly), retry (lets you debug the exe, although I think this option only appears if you have certain stuff installed), ignore (closes the box and carries on).
     
  The V macro, in a master build, evaluates its expression but ignores any failure.      
  TODO: switch to using my own assert macro (give it a unique name, not ASSERT).      
  C3DVisor::InitHeadset now "enables the external monitor".
I'm not yet clear on what the benefit of not "enabling the external monitor" is.  But I don't want my monitor to go dark when I'm using the headset (which is the only effect the option has, as far as I can see).
I've always left the monitor enabled using the utility app, but once or twice I think I've seen it lose/ignore the setting somehow.
     
  3DVisor: unwanted processes are now killed before every connection attempt (see C3DVisor::CreateDevice)      
  3DVisor: Managed to get an infinite loop inside EMA device construction, by disconnecting the USB a second or so after launching the program.
Not much I can do about that, and it's not a worry anyway.
     
#revision 820 3DVisor init is now almost right, but there's a slight loophole.  I'm about to fix this now.<-nah, after the build
(TODO: need to create a device without headtracking first, to establish whether or not the unit is connected....  Messy, but I don't see another way of presenting the right information to the player in the right order.)
<-nah, see 19th
     
17-Dec-2007   3.66667    
  String table: I'm using the term "image" to mean render target in the English strings.      
  Menus: Added tree layout doc:      
  file:\\C:\noctambule\docs\menuMap.txt      
#revision 814 Fixed a stringtable parsing bug.      
  Added loads more menu text to the stringtable.      
#revision 815 Fixed another stringtable parsing bug that caused some strings to go missing.      
  TODO: default profile should set up the headtracking values for Z800, not for OptiTrack ?
Need to decide what the game does about choosing between headtrackers (each with their different default values).<-ALL SORTED(19th)
     
  TODO: OptiTrack headtracking on a separate thread (use headTracking\separateThread).      
  TODO: terminate the headtracking threads properly.<-done(18th), but see note      
  Added some OptiTrack dialogue boxes.      
  3DVisor: If the connection fails, the game now does one automatic silent retry before it starts displaying error messages.      
16-Dec-2007   10.25    
  (below) Spent a couple of hours mocking-up the pause menu in Photoshop.  It was only afterwards that it reminded me of neurons, and of bubbles seen underwater, and of a heart.
Anyway, the menus are going to take the form of these translucent blobs, connected together in a sort of a tree around the player's head.  It's a sort of sci-fi "organic computer display".
- Clicking on a 'link' makes the tree rotate so that the target menu is centred in the field of view.
- Another option, when in VR mode, would be that the tree always stays put and that menus just change colour as they become current (when a 'link' directs to the menu or a control on the menu is used).  You'd be able to see the colour change along the branch from the menu you're currently looking at.
...
     
 
       
  ...
-For mega brownie points, the tree would contain a Navier-Stokes fluid simulation, so coloured dye could run through it.  The dye could be attracted to low pressure in the current menu or something.  The dye could have a different refractive index from the clear fluid.  I'm not likely to do this dye thing though - it'd be tons of work and there's better ways I could be spending my time.
-The tree should write noisy values to the
velocity buffer, to cause slightly jumbled motion blur.  This will add a layer of dreaminess straight away.  See flashback sequences from Underworld.
-The text boxes might also want their own
glitching effect.  This will provide some movement as well as making the text look 'dreamy'.  Letters should sometimes change into different letters of similar width.  Be careful to avoid hackneyed text effects, eg. the skateboard-game jitter (radical!)
-The tree must gently
squidge around / pump or something; must not be frozen.  The current menu could beat like a heart.
-Tree rotation needs to be motion-blurred.
     
  I think I've got enough to be going on with; I'll play the rest by ear.      
" Global.h: Disabled warning 4345:
"behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized"
     
  Added option headTracking \ separateThread
Added option headTracking \ threadPriority (LOWEST / BELOW_NORMAL / NORMAL / ABOVE_NORMAL / HIGHEST)
     
  Putting the 3DVisor headtracking on a separate thread has brought my framerate from around 20 to around 33.
(800*600, debug, default settings).
Based on those numbers, it must take about a 50th of a second to get a reading from the headtracker, regardless of the PC.  I should time this properly, but I've got more interesting things to do.  The important thing is that it's not slowing the game down anymore.
     
  With nearly all the effects stripped out, I'm managing to keep the VR mode above 60 (most of the time) in Master config now, which lets me at least get some idea how the game should feel (and it's ver' nice).  Need to upgrade this PC to get the full experience.      
  Fixed the head-tracked stereo separation for 3DVisor.  It wasn't properly accounting for the display being head-mounted.
TODO: for TrackIR, use the old method (from SVN) and test that it's correct.  Check display\headMounted.
     
15-Dec-2007   10.5    
  Found some occasional flickering artefacts in the floating-point lighting (800*600) :(
Floating-point lighting on this card also removes various filtering (including some full-screen filtering that shouldn't be there; TODO: investigate<-FIXED(12.4.8))
     
  Started setting up the string table functionality.
TODO: For the likes of the credits, the stringtable parser should be able to invent the absent identifiers by appending the UK string (suitably processed) onto the last identifier it found.
eg. "ESTRING_CREDITS_THANKS_CelineAccabat"
<-DONE
     
#revision 806 Set up a Tools\StringTableParser project and added it to SVN      
  SVN: Never source-control .NCB files!      
  Stringtable:
0x0D, 0x0A = end of row
0x0A = newline
0x09 = tab (cell delimiter)
I'm opening stringtable.txt in binary mode because in text mode the 0x0D characters get filtered out
     
#revision 808 String table parser is now working nicely.      
  Added function UtilGetWideString (now used by UtilGetTempWideString).      
  TODO: CStringTable::StringW ?      
  Added function UtilMessageBox (takes in stringtable indices and control flags; returns response code).  Very handy.      
  Teehee!  In the French 3DVisor user guide, someone's accidentally left a little green text box that says "Testmuster" !      
  Set up a nice little network of dialogue boxes to handle any & all problems during initialisation of the 3DVisor.  Spent a wee bit of time translating these into French.      
  3DVisor: current firmware version is 6.3E      
  3DVisor:  The new utility, Lab Tool, seems to lose / give up its own connection when the game starts, rather than preventing the game's connection.  Nevertheless, I've added it (LabTool.exe) to list of processes killed before the headset connection is attempted.      
#revision 810 Pleased with the stringtable system; it's real smooth.  Dialogue boxes appear in the right language as specified by the 'general \ language' option (which defaults to French bien sûr).      
13-Dec-2007   3    
  3DVisor: considered making the game change the headset's timeout values, but decided this is something that the user won't want me to mess with.  So I'll continue using the 'keepalive' signals (these won't slow the game, so they can't interfere with frame sequential stereo).  Even resetting the EEPROM doesn't change the timeout values set by the user.      
  3DVisor: when the you first connect to the headtracker, its current yaw is is set as the zero yaw by the eMagin system.      
  3DVisor: [update: almost] Never fails to connect to headtracker when it's in standby (flashing green) mode when you try to connect.
Wanted to try something that might guarantee a successful headtracker connection:
- connect firstly without headtracking
- call GoSleep
- clean up
- connect again with headtracking.
See SDK source for details of why this isn't possible :(
     
  I'm a bit paranoid about mentioning any eMagin SDK stuff in this log; the SDK is all marked confidential, and I only managed to get hold of it after I'd contacted eMagin from my work email account.      
  Y'know, the headtracker connection used to work every time anyway.  Is it only since installing Lab Tool that it's started failing?  I have a feeling that did install a new drivery type thing.
Another change in behaviour (I think) is that after an unsuccessful connection, simply putting the headset into standby makes it work next time ([update: nearly] always works).  Used to have to disconnect the USB lead & re-connect it (unless I just forgot to try the standby button before ?).
     
  3DVisor yaw now resets when exiting pause mode.  TODO: neaten this (should orient the player to the current virtual head yaw; currently snaps the virtual head yaw to the current player orientation).
See CHeadTracker::ResetTransform
     
  Added option headTracking\hardwareHint (NONE / FORCE_NONE / OPTITRACK / 3DVISOR)      
  TODO?: Might sound silly, but I'm quite tempted to design a jetpack into the game, and maybe flying enemies.  Flying around even with the flycam, in VR mode, is amazing.  It's partly because the headtracking gives you a real sense of height when you look down (and I'm not even in stereo mode yet).
Headtracking is great.  It connects another one of your senses into the game: the sense of balance / direction!  And the more senses you connect to the game, the more it feels real and engages your instincts.
Complications with a jetpack would be:
- requires more advanced building collision (probably need this for weapons anyway?)
- occlusion culling gets more complicated (and doesn't help much once you're above rooftop level).
     
12-Dec-2007   3.7    
  Fixed the stuttery headtracking.  I'd left an "if( (g_game.frameNumber&4)==0 )" in the headtracker update, duh!
That's a relief.
     
  (below) Made a new & improved grading map for 3DVisor mode.  Although obviously it's not clear from a screenshot, this comes out nice & vivid while preventing the over-contrast that these little displays would give if using the default grading.
(left to right: no grading, grading for 3DVisor, grading for CRT)  The CRT one is a bit harsh at the moment - you lose too much of that subtle mist.  I'll bring it back a bit.
     
 
       
  I'm fed up with the bug where everything's double-bright on nVidia cards; it gives a bad first impression.  I'm guessing it simply happens when using float RTs for the lighting.<-no, see below.
TODO: test floating-point vs. forced fixed-point on an nVidia card.
TODO: bodge: halve the HDR\finalMultiplier on all nVidia cards<-DONE(13th, in COptions::ApplyAfterDeviceCreation)
     
  CBlockParser::ReadBool now accepts '1' as true.      
  WEIRD: I tried setting lighting\RTForceFloat to true on my x1900, which I was pretty sure couldn't blend to floating-point RTs.  Erm, but it seems to be working perfectly.  And it's definitely using floats; the banding is practically invisible, same as on 8800.
Maybe when I tested this last time, I was trying to blend to D3DFMT_A32B32G32R32F (which comes out black).  With D3DFMT_A16B16G16R16F, it seems 100% fine.
Maybe I tested ALPHA blending last time, rather than additive?  (the lighting uses additive blending to build-up its offscreen images).
Here's what I'll do:
     
  lighting\RTForceFloat now defaults true.      
  TODO: test 3DVisor head-tracking on a separate thread
TODO: need an eye-swap calibration mode for 3DVisor (display 'left' & 'right' over the relevant eye)
     
11-Dec-2007   2.66667    
  "VxDs are not usable in Windows NT or its descendants. Starting with Windows 2000, these operating systems use the Windows Driver Model (WDM)..."      
  Summarised my quest for framerate-independent stereo, on the eMagin forums:
http://www.3dvisor.com/forum/viewtopic.php?t=1036&start=0&postdays=0&postorder=asc&highlight=sync
If only I could find that WINx3D SDK !!!
     
  Right then, this time I'm really giving up with it, until such a time as fresh information comes in through the forum.
Now turning my attention to V
ersion 14: Xmas Edition™ instead!
     
#revision 801 SVN: Finally managed to untangle SVN and add the driver projects for safekeeping.      
  Z800: Hmm, head-tracking's gone stuttery.  Why's that then?
TODO: FIX THIS!!!!!!!!<-FIXED, phew. 
     
10-Dec-2007   5.5    
  Noticed that 3DVisor.exe, even just sitting in the system tray, is continually spitting-out a debug line such as:
[4076] VendorID: 9ac8, ProductID: 6b
I wonder what it means.
     
  (searched wdk help for wdm.h)
ms-help://MS.WDK.v10.6000/Kernel_d/hh/Kernel_d/WDMIntro_d5b4fea2-e96b-4880-b610-92e6d96f32be.xml.htm

"Kernel-mode drivers that follow WDM rules are called WDM drivers. All WDM drivers must:
Include wdm.h, not ntddk.h. (Note that wdm.h is a subset of ntddk.h.) ..."
     
  I need to include wdm.h in order for video.h to compile.
The
avssamp sample driver is WDM one, and I can build it, but when I try to load it using InstallDriver.exe it fails with ERROR_SERVICE_DISABLED.
If I do manage to convert DemoDriver to WDM, will I get the same load error??<-No, converted it now and it still loads
     
  "The I2C bus has only two wires: the serial clock line and the serial data line.
Reading and writing data bits to the I2C lines on the display adapter is hardware dependent, so the vendor-supplied video miniport driver must provide the functions that instruct the display adapter to read and write the individual bits."
     
  Hmm yeah, I've been a bit thick.  WriteDataLine etc aren't functions I can call, they're functions I can implement.
If I'd paid closer attention to the docs, I would have seen that they're callbacks provided by the driver (that's me).
     
  "VideoPortDDCMonitorHelper implements the details of reading the EDID structure according to the I2C specificaiton, but must call back into the video miniport driver to read and write individual data bits to the I2C serial clock and data lines.
The four functions,
implemented by the video miniport driver, that read and write individual bits to the I2C clock and data lines are ReadClockLine, ReadDataLine, WriteClockLine, and WriteDataLine. When the video miniport driver calls VideoPortDDCMonitorHelper, it supplies pointers to those four functions in DDCControl->I2CCallbacks."
     
  Went back and had a look at DrYak's info about syncing the stereo:
http://www.3dvisor.com/forum/viewtopic.php?t=1036&start=0&postdays=0&postorder=asc&highlight=sync
     
  Downloaded eMagin's Lab Tool thing.  Yak's idea about using different sync values between the two eyes sounds very interesting...<-it isn't possible to use offsets that big      
  Allowed the Lab Tool to remove 3DVisor Software Utility, as it seemed to want to do.<-re-installed it      
  Lab Tool reports that my headset has the "3D Commands" capability.  Not sure what it means by that, probably just means the enable/disable 3D mode command.      
  3DVisor: phase at around 18 seems to work well for the stripes calibration test.      
  clock=2047/4095 = show left side of screen      
  Tried fiddling with phase, clock and position settings, but they don't allow a big enough offset to do a split-screen-style stereo mode.      
  TODO: find out about SciTech GLDirect.  Is it a forerunner to Snap?      
  TODO: maybe get hold of that sync-doubler VGA pass-through thing that comes with those LCD shutter glasses at work.  I think that will actually alternate the Z800 (refreshing at 120Hz).  But I don't think it helps me in trying to send my own image pair.  Would be an interesting experiment anyway (in fact, wouldn't this make every game work with the Z800?)      
9-Dec-2007   10    
  Hmm, I lost rather a lot of time to those two gigs (plus hectic work stuff).
Need to keep an eye on how much time gets lost practising next year.  It might become necessary to pull-out of band activities 'early'.
     
  I'm probably going to give up trying to do the framerate-independent frame-sequential stereoscopy thing; it would be really nice but there's more important things to take care of, and time is getting short.
So if you have a frame-sequential headset, and you want to run the game stereoscopically, you'll just have to make sure your PC can keep the game above 60fps.
<-currently trying to get it working using the WDK
The annoying thing is that mine can't :(
I should look into upgrading....
     
  Of course, it would be a very fair criticism to say that the game simply runs too slow - that's the truth of it.
But, although it sounds flippant, my time is far better spent making the game look pretty than making it fast, because the PC/GPU setups people use to play the latest games are fairly monstrous anyway and they can handle it.  No point spending a load of time optimising when the target audience was already able to run it at 60 (which they are) - it's invisible work.
     
  below: here's the VBE doc for the I²C functions that should let me control the DDC pin:<-can't generate interrupts from Win32, see below      
  file://C:\Noctambule\Articles\VBE_I2C.pdf      
  http://www.vesa.org/Public/VBE/vbesci10-2w.pdf      
  Function 15h, Sub-function 11h - Begin SCL/SDA control
Function 15h, Sub-function 10h - Report VBE/SCI Capabilities
Function 15h, Sub-function 14h - Write SDA data line
[Function 15h, Sub-function 13h - Write SCL clock line]
Function 15h, Sub-function 12h - End SCL/SDA control
     
  Example French function descriptions:
"lit les données EDID du moniteur principal"
"ouvre le fichier DUMP"
"écrit le buffer des données EDID dans le fichier DUMP"
TODO: have a dig around on some French coding sites, get more of a feel for commenting & naming
     
  "Generating interrupts only works when running a 16 bit program... Generating an interrupt from a Win32 program
will cause an access violation."

"You cant make BIOS calls in windows from a user mode app...
You can use a published API.......lookup DeviceIoControl on MSDN...."

"at http://www.geocities.com/SiliconValley/Haven/4824/vxdprg.html Bill Alexander has free source code for a VxD to do BIOS calls. Looks like I'll have to recompile it with the Windows 95 DDK though (it's Windows 98)."

"Win32-based applications cannot use MS-DOS and BIOS interrupts"
     
  ...So it's not possible for me to call BIOS functions directly (which would make things very, very easy)
Using 'INT' causes an exception like it says.
     
  The only route left to try now seems to be the I²C functions in the WDK.  Can't remember how far I got with them before...
"WriteDataLine sets the I2C serial data line to high or low."

(see 28th Oct 07)
Needs to be a separate driver I think
     
  Writing a device driver for Windows :
http://www.adp-gmbh.ch/win/misc/writing_devicedriver.html
     
  Essentials Of Building Windows Drivers :
http://www.wd-3.com/archive/WinBuild.htm
     
  I've now managed to get the example driver DemoDriver (from the Essentials article above) to build, and load, and be successfully called from the game.  Had to update it here & there because it was written for the 95/98 DDK.
I just haven't found a good way of debugging the driver code yet.<-Now using DebugView, see below.
It's definitely running the driver code, because if I add an ASSERT, in 'checked' configuration, it causes my PC to instantly restart.
     
  Installed a thing called DebugView (http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx), which catches debug output, like Watson does.
But it doesn't catch any of the DbgPrint calls in the driver code.<-Yes it does, just need to tick 'Capture Kernel'.
     
  DemoDriver is a kernel-mode driver.      
  Just so I don't forget:

Firstly run one of the WDK build environments for XP:
C:\Documents and Settings\user\Application Data\Microsoft\Internet Explorer\Quick Launch\WDK 6000\Build Environments\Windows XP

To build the driver:
cd C:\WinDDK\6000\src\WinBuild
build -cef

To load the driver:
cd C:\WinDDK\6000\src\WinBuild\libchk_wxp_x86\i386
InstallDriver DemoDriver load

To unload the driver (must do this then re-load each time it changes) :
InstallDriver DemoDriver unload
     
  Added DebugView to the Visual Studio 'tools' menu.      
  Tried to add all the WinBuild (example driver) stuff to SVN, but couldn't quite remember how to do it.
I'll just wait till I've set up the new driver under the Noctambule folder, that'll be easier.
     
  Tomorrow, if all goes well, I should be able to get that DDC pin doing its thing.
If the headset responds, that's obviously wonderful.  If it doesn't, I might try and get hold of a multimeter to check that the signal is coming through.
     
15-Nov-2007   0    
  (below) possible enemy inspiration: really gruesome baby dolls, suitably nightmarish:      
  http://www.autopsybabies.com      
12-Nov-2007   0    
  I'm completely tied-up with the band at the moment, so I'm not going to be able to make much/any progress till December.
I will almost certainly do a build in time for Christmas with the following features:
- native z800 head-tracking support (if you haven't seen this headtracker natively supported yet, you'll be amazed how good it is).
-
z800/x800 (frame sequential) stereoscopy mode - Note: this will only work if your PC can keep the game above 60Hz.
     
  (below) the band:      
  http://myspace.com/deathboy      
4-Nov-2007   10.5    
  Added envirornment variables:
SCITECH
SCITECH_LIB
C:\scitech\mgl60r23
     
  C:\scitech\mgl60r23\bin-win32\dmake      
  C:\scitech\mgl60r23\bin-win32>dmake C:\scitech\mgl60r23\examples\snap\graphics\hello\makefile
'C:\scitech\mgl60r23\examples\snap\graphics\hello\makefile' is up to date
?
     
  C:\scitech\mgl60r23>my_start-sdk.bat
Release build enabled.
Open Watcom C/C++ 1.0 Win32 GUI compilation environment set up.

C:\scitech\mgl60r23\examples\snap\graphics>
     
  C:\scitech\mgl60r23\src>dmake build
=======================================================================
** BUILDING: SciTech SNAP SDK libraries for current compiler
=======================================================================
START: Building PM Library
wcc386 win32\pm.c
dmake.exe:  Error -- wcc386: No such file or directory

dmake.EXE:  Error code 129, while making 'targets\pm'
dmake.exe:  Error code 255, while making 'single'
     
  C:\scitech\mgl60r23>my_start-sdk.bat
Release build enabled.
Visual C++.NET 7.0 32-bit Windows compilation environment set up
C:\scitech\mgl60r23\examples\snap\graphics>
     
  C:\scitech\mgl60r23\src>dmake build
=================================================================
** BUILDING: SciTech SNAP SDK libraries for current compiler
=================================================================
START: Building PM Library
....
k_cp n_ga.lib C:\scitech\mgl60r23\lib\release\WIN32\vc7
================================================================
DONE: Single compiler SNAP SDK build completed successfully!
     
  mkdebug and mkrelease (replacing dmake build) are also both successful      
  French strings for a doom-type game:
C:\scitech\mgl60r23\examples\mgldoom\d_french.h
     
  Couldn't get the Doom example to build:
C:\scitech\mgl60r23\examples\mgldoom>dmake
...
LINK : fatal error LNK1181:
cannot open input file 'mgl.lib'
dmake.exe:  Error code 130, while making 'doom.exe'
There is no mgl.lib anywhere :/ (?)
     
  C:\scitech\mgl60r23\examples\snap\graphics\gatest>dmake
...
LINK : fatal error LNK1104: cannot open file 'gatest.def'
LINK : fatal error LNK1141: failure during build of exports file
dmake.exe:  Error code 130, while making 'gatest.exe'
There is no gatest.def
     
  Made a gatest.def that just contains
NAME    GATEST
     
  C:\scitech\mgl60r23\examples\snap\graphics\gatest>dmake
cl /nologo @C:\DOCUME~1\user\LOCALS~1\Temp\mk000001
   Creating library gatest.lib and object gatest.exp
LIBCMT.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16
referenced in function _WinMainCRTStartup
gatest.exe : fatal error LNK1120: 1 unresolved externals
dmake.exe:  Error code 130, while making 'gatest.exe'
<-needed to change mystartsdk.bat to use 'c32' instead of 'w32', see below
     
  _WinMainCRTStartup defined in build\intel\mt_obj\wincrt0.obj      
  dmake -u to force rebuild      
  mainCRTStartup (or wmainCRTStartup) ---- An application using /SUBSYSTEM:CONSOLE; calls main (or wmain)      
  These example apps are CONSOLE apps; they have a 'main' rather than a 'WinMain'.
So the compiler (cl) arguments want to contain /link /SUBSYSTEM:CONSOLE, as shown here:
C:\scitech\mgl60r23\examples\snap\ddc\ddctest>cl ddctest.c /link /SUBSYSTEM:CONSOLE
cl is being called from dmake.exe<-needed to change mystartsdk.bat to use 'c32' instead of 'w32', see below
     
  C:\scitech\mgl60r23>mystartsdk.bat
Checked debug build enabled.
Visual C++.NET 7.0 32-bit Windows console compilation environment set up
C:\scitech\mgl60r23\examples\snap\graphics>
     
  Built the SDK libs with w32 again.      
  Well, I've now got as far as building an exe (snap/ddc/ddctest.exe) and actually being able to run it.
I now get this error message:
---------------------------
Fatal Error!
---------------------------
Unable to load SNAP device driver!
---------------------------
OK  
---------------------------
     
  COOL!  I can attach the debugger to the ddctest.exe process and get a call stack.      
  ddclib.c \ LoadDriver
looking for ddc.bpd
     
  Fixed that (set up a C:\windows\system32\snap folder), but now I get this:
---------------------------
Fatal Error!
---------------------------
Invalid license!
---------------------------
OK  
---------------------------
Up till now, I thought this thing was free :/<-it is free (GPL) see license.faq and license.gpl
     
  TODO: get C:\scitech into SVN      
  C:\scitech\mgl60r23>mystartsdk
Checked debug build enabled.
Visual C++.NET 7.0 32-bit Windows compilation environment set up
C:\scitech\mgl60r23>
SET CHECKED=0
C:\scitech\mgl60r23>
SET DBG=0
C:\scitech\mgl60r23>mystartsdk
Release build enabled.
Visual C++.NET 7.0 32-bit Windows compilation environment set up
     
  Hmm, I can't seem to build the SDK libs anymore, fails near the end.  It's fine until this point:
START: Building Techniques Class Library
cl /nologo @C:\DOCUME~1\user\LOCALS~1\Temp\mk000001 /c dlist.cpp
dlist.cpp
cl /nologo @C:\DOCUME~1\user\LOCALS~1\Temp\mk000100 /c list.cpp
list.cpp
cl /nologo @C:\DOCUME~1\user\LOCALS~1\Temp\mk00022a /c hashtab.cpp
hashtab.cpp
C:\scitech\mgl60r23\include\tcl\hashtab.hpp(46) : fatal error C1083: Cannot open
 include file: 'iostream.h': No such file or directory
dmake.exe:  Error code 130, while making 'hashtab.obj'
dmake.EXE:  Error code 129, while making 'targets\tech'
dmake.exe:  Error code 255, while making 'single'
     
  I don't seem to get an accurate callstack when I get the 'invalid license' message.  Can't see where the message comes from.  Can't find that string in any of the files.
isvLicense variable is NULL though
license.h just defines EMPTY_LICENSE, whatever that means
     
  Downloaded the pre-build MGL Doom demo; tried to run it but it instantly restarted the PC.      
  C:\WINDOWS\system32\snap\config\snap\config\ddc.log:
"Unable to validate license!"
     
  emailed license@scitechsoft.com asking about the licence problem.  I don't even know if the company still exists, and even if they do I doubt they'd answer my email, but you never know.
C:\correspondence\scitech
     
  Hmm, when I add a call to GA_getDaysLeft into ddctest.c, before the call to LoadDriver, I get this:
---------------------------
Fatal Error!
---------------------------
Unable to load nga_w32.dll!
---------------------------
OK  
---------------------------
     
  Hmmmmm........      
3-Nov-2007   7    
  Installed Ad-Aware 2007 Free
Installed Spybot S&D
     
#restore In Computer Management:
Disabled my printer port (in the Computer Management program), to see if it stops the 'found new hardware' thing every time I start Windows.<-didn't help; I've re-enabled it.  I'm too scared to 'uninstall' it because I don't know how I'd re-install it.
     
  ...also disabled the Windows Indexing Service.      
  Why are lsass.exe & csrss.exe constantly chipping-away at my hard drive?  I gather this is normal, but it's a bit irritating.      
  Installed Win3D Drivers (which I think use redraw-synced page flipping), but couldn't get the test app to work at all.  And they didn't include an SDK or any source.
Even in anaglyph mode it gives the same message: "this image cannot be queued for this eye".
     
  3DVisor: Here's a hardware mod that lets the visor take in dual monitor inputs (but it seems to require the removal of the headtracker hardware).  Presumably gives you 60Hz 3D.
Not useful for me, just interesting:
     
  http://www.tekgear.ca/index.cfm?pageID=90&prodid=571&section=103&nodelist=1,103&function=viewproducts      
  Been raking around on t'Internet trying to find the mythical WINx3D SDK.  Looks like exactly what I need, but no-one seems to know where it can be found anymore.
"...for page-flipped stereoscopy, the start address must change every time a vertical sync occurs on the video card. This is the primary purpose of WINx3D - to keep the image that is displayed on the video card synchronized with the VR gear. The DirectDraw Flip() function is inadequate for this"
Sent an email to a couple of people who were also looking for it, in case they still have the same email addresses and managed to find it:
     
  file://C:\correspondence\WINx3D      
  below: Some discussion of WINx3D.  Apparently David C. Qualman (davidq@win3d.com) is the author, but the SDK has been bought up and is no longer free:      
  http://www.stereo3d.com/discus/messages/21/1318.html?1081163732      
  Programming With VESA BIOS Extensions:      
  http://www.ddj.com/cpp/184403213?pgno=1      
  Another VBE programming article:      
  http://www.gameprogrammer.com/1-vbe.html      
  Installed the SciTech SNAP SDK      
  Started trying to get the DDC example 'project' to compile & link:
C:\Noctambule\SNAP\ddctest\ddctest.sln
Will come back to this.
     
  below: This chap has used the WINx3D SDK in the past (2003), so I ICQ'd him to ask if he still had it (awaiting reply)      
  http://www.stereo3d.com/discus/messages/21/2057.html?1081177263      
  So it was an evening of detective work.  But I can justify spending a bit of time on this - if I can manage to put all the pieces in place, it'll be amazing.      
2-Nov-2007   0    
  ...and it's just as well I did back up the project!
Just after writing that last entry, I noticed I'd picked up a virus, started heavy-handedly trying to weed it out, and ended up knackering my registry - leaving me unable to log in to Windows.
Had to crash on the Floor of Ubuntu while I worked out how to repair the registry files, but thankfully the procedure is simple and well-documented.
The registry rollback not only let me back into Windows, but also disabled the virus, which is nice.  Should maybe install some kind of anti-virus now though....<-DONE
     
  Installed AVG Anti-Virus Free Edition 7.5.503:      
  http://www.google.co.uk/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Ffree.grisoft.com%2F&ei=UIArR7X2Kpjy0QTznaHoBQ&usg=AFQjCNG5n3zvu8FfBUqDjiZLOqbTklsN2A&sig2=yuI3jPM5GyjKYeUfW--2pQ      
  Anyway, looking on the bright side, at least this didn't happen:      
  http://markstirton.blogspot.com/2007/11/my-toilet-exploded.html      
28-Oct-2007   2    
#backup Backed-up the project.      
  Windows: Found that the system-tray programs to be launched on startup are specified in this registry folder:
Software\Microsoft\Windows\CurrentVersion\Run
     
  WDK: Device Extensions:
http://msdn2.microsoft.com/en-us/library/ms794734.aspx
     
  WDK: Getting Started with Windows Drivers:
http://msdn2.microsoft.com/en-us/library/ms791699.aspx
     
  VideoPortDDCMonitorHelper requires a device extension (PVOID  HwDeviceExtension)
IoCreateDevice
supplies the device object & extension (OUT PDEVICE_OBJECT  *DeviceObject)
IoCreateDevice requires a driver object pointer (PDRIVER_OBJECT  DriverObject)
Driver object pointer is received by
DriverEntry (PDRIVER_OBJECT  DriverObject)
DriverEntry is called when a driver is loaded.

In other words, I don't think I can use VideoPortDDCMonitorHelper within the game - would have to be in a separate driver.
     
  I wonder if someone has already written a driver to do what I want to do?.....      
  This looks like a good article:
Driver Development Part 6: Introduction to Display Drivers:
http://www.codeproject.com/system/driverdev6asp.asp?df=100&forumid=262328&exp=0&select=2167158
     
  Downloaded a 30-day trial of "WinI2C/DDC" (catchy!), which is like an all-singing-all-dancing version of the driver I need.
No use to me, because it's $450 or something.
Just wanted to use it to test the DDC control of the headset.
     
26-Oct-2007   2.83333    
#revision 770 Tried using D3DPRESENT_DONOTWAIT to catch dropped frames.  Obviously doesn't do what I hoped it would; IDirect3DSwapChain9::Present never returned D3DERR_WASSTILLDRAWING.      
  If QueryPerformanceCounter and QueryPerformanceFrequency are accurate, then video output is flipping slightly faster than 60 Hz (more like approx. 60.333 Hz when the game is fullscreen).  And the headset is fine with that, because it just syncs with the monitor signal rather than swapping exactly 60 times per second.  But why is the output not exactly 60 Hz ?!
And more importantly, how on earth can I sync-up with the actual rate?  I've tried all sorts but can't get it to work reliably.
Several people on the 3DVisor forums have run into the same problem.
     
  Blimey, VGA includes a Display Data Channel / Data clock line (DDC) and the 3DVisor can read this as a signal indicating which eye to send to!  That'll be why the nVidia stereo drivers didn't give a random eye swap each time - they were selecting each eye in turn explicitly!  And that's how they kept the headset in sync regardless of the framerate.  That's what I want too.
Some explanation here:
http://www.3dvisor.com/forum/viewtopic.php?t=1036&start=0&postdays=0&postorder=asc&highlight=sync
DDC on Wikipedia:
http://en.wikipedia.org/wiki/Display_Data_Channel
     
  WDK: VideoPortDDCMonitorHelper :
http://msdn2.microsoft.com/en-us/library/aa479182.aspx
     
  Installed softMCCS, hoping it would let me poke DDC signals out to the headset.  It doesn't seem to be aware of the headset being there, so it just tells me that my monitor isn't plug&play and DDC/CI (and all the other stuff) isn't available.  I would've expected it to let me send something out regardless :(
Running softMCCS has made my monitor quite dark now for some reason.
     
  TODO: try using VideoPortDDCMonitorHelper to write DDC signals (#include C:\WinDDK\6000\inc\ddk\video.h)      
25-Oct-2007   1.75    
  Game now kills AdobeUpdater.exe on startup.  That's the last time that program interferes with my fullscreen mode!      
  Still trying to get that frame-drop handling working....      
21-Oct-2007   6.083    
  TOFIX: (does this always happen?) when the headset's in standby (flashing green light, screens off), the game fails to connect to it.  Hmm.
Pressing the power button to wake it up first fixes the problem, but it would be nice if this could be automated.
     
  Noticed that after a headset init failure, simply re-running the game can make it work properly.  Maybe try putting the init in a loop so it can make two attempts??      
#revision 768 Removed option anaglyph\laggingApproximation, to simplify some code.  Anaglyph stereoscopy is rubbish enough without allowing lag between the eyes.      
  Website: I was thinking about getting one or more .fr domains.  From wikipedia:
"There is a French presence requirement and administrative contact address must be in France; some other restrictions on some of the specific subdomains"
So the only legal way to get one at this point would be if someone in France could buy it and act as the admin contact on my behalf (I don't even think it would be legal for them to transfer the domain to me).  So it's not worth the bother.
     
  From AFNIC.fr:
"Le contact administratif est impérativement établi en France et doit y disposer d'une adresse effective qui lui permette de recevoir des actes judiciaires ou extrajudiciaires."
     
  Spent ages trying to get the frame-sequential frame-drop handling working but haven't managed yet.  TODO: find out why fps shows as > 60 when running in 1 frame.      
18-Oct-2007   3.5    
  25*25, frameRT=[/2], debug, windowed, everything switched off (phil.txt):
40fps
     
   (+paused:
still 40fps)
     
   +skip CModeEnvironment::Render except HDR::BeginScene & EndScene:
52 fps
     
   +skip C3DVisor::GetHeadsetData:
60
     
   +CModeEnvironment::Render:
still 60
     
   +800*600 fullscreen, frameRT still [/2]
60, +/- 1 occasionally and fleetingly
     
   +C3DVisor::GetHeadsetData:
48 fps
     
  Building the game project:
"Compiling resources...
Linking...
Embedding manifest..." (endless pause)
- same happens after a clean rebuild
- mt.exe maxing the CPU.  I cancel the build
- vsmsvr.exe & devenv.exe each using 50% CPU
- I close both VisualStudios, there's still 2 devenv.exes and vsmsvr.exe, still doing the same thing.
- I close Excel.  Excel.exe still present in the task manager.
- Fraps app isn't visible, but Fraps.exe process still showing.  I try to end its process tree.
- PC goes into super-unresponsive mode (screen updating once every 5 seconds or so; effectively no controls are usable).  Needs a restart.
There was no visible harddrive or network activity during any of this.
     
  After the restart:
Opening Noctambule.sln, definitely no other copy of it open:
"IntelliSense information will not be available for VC++ projects because the IntelliSense database file C:\Noctambule\Source\Noctambule.ncb could not be opened for writing."
     
  Did another clean rebuilt of noctambule.sln, and everything's fine now (except no intellisense).  3DVisor.exe is running btw, so that's not the problem.
I do suspect EMADevice_DLL.dll might have been involved in all this though.
     
#revision 766  +frameRT=[/1], fullscreen 800*600:
60 fps in most places, as low as 47 in the worst case (standing at CRUK corner looking at BT)
     
  The eye-swapping (caused by frame drops) makes me feel quite yucky quite quickly.  Let's fix that now using a timer.  ..At least I hope it's the eye-swapping and not just general simulation sickness from the fake moving and turning while in stereo mode.  I haven't set up the stereo convergence properly for Z800 yet either; that could be relevant.<-(18th: seems fine when the views are the right way round; I've also set convergence to 0 in VR mode now)      
  I still can't believe that thing I read (might've been eMagin blurb) claiming that the brain copes fine with flipped stereo views and "makes sense" of the depth.  Nonsense!!  Complete nonsense.  You get the impression that there's depth information in front of you, but not the sort that makes any kind of sense.  It's like saying that pushing-in the side of one eyeball slightly turns your TV programmes into 3D.      
  Two things that are really effective in VR mode:
- sheltered hidey-holes - you get a much stronger feeling of enclosure.  A sheltered audio effect should also strengthen this immensely.
-
light glares (when different in each eye, even just occluded in one eye) - when your brain gets the two non-matching streaky patterns of light it confidently registers that there's a lightsource there.  Will be great when I add the proper light glares.  They'll respond correctly to headtracking too (nice counter-rotation...)
     
  TODO: fix stereo separation to take into account head tilt      
  TODO: for VR mode, a blurry black screen border would seem to be a sensible idea (to give the impression that the 'window' is too close to be in focus).  This might make the stereo feel more natural.      
  TODO: get the frame-drop handling working!      
17-Oct-2007   2.75    
  (link below) More examples of that speed-painted art style that I want to use for my next project that I keep thinking about but will never have time to do.
These are by a bunch of Pixar people who get up at silly o'clock to paint stuff:
     
  http://www.earlybirdpainters.blogspot.com/      
  Managed to get frame-sequential stereoscopic mode working on the Z800!!  ie. managed to reach 60fps, or "88" as I like to call it.
Had to switch pretty much all the effects off :(
Also had to switch off head-tracking, because waiting for the readings to come back takes a seriously long time.  TODO: put that on a separate thread!!!  Waiting around for that kind of thing is crazy!  I should really do the same for TrackIR, if I can be bothered.  TrackIR's a complete relic for me now.
     
  Frame-sequential stereo fixes described in yesterday's entry.      
16-Oct-2007   2.5    
  Why does Visual Studio sometimes just lose the project from my solution?      
  Added option category controls
Added options
controls\mousePitch - Defaults true.  It's false in the Z800 example profile (no need to pitch with the mouse when you're using Z800, that would be silly)
controls\mousePitchSpeed
controls\mouseTurnSpeed
     
  TODO: try a cursors-only control style (side keys to turn while running).  This will probably be more suitable for VR mode.  Add option controls\mouseTurn.      
  Oh yeah, last night I dreamt I was in one of those WWII shooters (presumably called "Men Of Honor" / "Honor Of Heroes" / "Band Of Men" / "Medal Of Valor" or something like that ;)
We were escaping from a sort of POW camp.  During the escape there was a bit where I was basically running away from a guard taking shots at me, knowing that any second one of them would probably hit.  Was quite a tense bit of action; would be good if my enemies could shoot.  Apart from anything it would mean more sparkly effects flying around the place - always a good thing.
I would also really like to somehow recreate the fear I got from watching Dr. Who when I was little (Daleks especially).  I reckon a lot of that fear was created by the audio.
Hmm, my dreams have no sound - speech is present and sometimes there's (pretty good) music, but no other sounds whatsoever!  Maybe it's because I've spent so long playing games with the sound off (at work), so I'm used to all the silent action.
     
  Added option category screenEffects.  This is for all the screen effects apart from those belonging to the HDR system.  And apart from motion blur, which isn't intrisically a screen effect the way colour grading is.
Added option:
screenEffects \ colourGradingMap
     
#revision 763 Removed all the 'topline_' textures (old WOWvx headers).
There's still copies in C:\noctambule\3dtv
     
#revision 764 Added folders
Graphics \ Final \ Effects (eventually I'll move all the effects graphics into here)
Graphics \ Final \ Effects \ ScreenEffects
which now contains the two colour grading maps.
     
  Thanks to all my forward-planning, it only took a couple of lines of code to get the frame-sequential stereo mode (mostly) working :)
TODO:
- stop it producing motion blur<-done(17th) now got a "previous final view matrix" per eye
- stop the strange flickering of the lighting<-done(17th) mist lighting RT wasn't getting cleared between eyes.
- add an eye-swap key<-(17th: now on right mouse button temporarily)
- add dropped-frame handling? (so that frames can be dropped without the eyes swapping)?  I think the headset waits a second or so before switching out of stereo mode (so dropping a frame here or there shouldn't switch it out).<-(17th: that's exactly right)
     
15-Oct-2007   0    
  Er, been really tied-up with work and the band.      
  Bought a new aerial photo, from Bluesky this time rather than Getmapping.
It's tons better!  Same res, but much clearer and I reckon it's also more positionally correct than the blurry, badly-stitched JPG I've been using till now.  This one's a GeoTIFF, which Photoshop loads just like a TIFF.
This is going to make things a lot easier when I do my next batch of construction work.
It cost slightly less than the last one, too.  I'm really quite glad I found this.  Found it through Google Earth.
     
6-Oct-2007   4.25    
  Removed the Z800 Software Utility from my startup programs.<-added it back, to check that the auto-termination of this process is always working (see below).
The game connected with the headset on first attempt this morning, from standby (flashing green) mode.
Re-started the machine, worked first time again, from 2D (amber) mode.
     
  Aha!  I just need to kill 3DVisor.exe before trying to connect?      
  dxstdafx.h: added #include <tchar.h>
(needs to be included before strsafe.h)
     
  Added UtilEndProcess.
Had to add linker input Psapi.lib for this.
     
  UtilEndProcess reference from Microsoft docs:
Enumerating all processes: http://msdn2.microsoft.com/en-us/library/ms682623.aspx
How To Terminate an Application "Cleanly" in Win32:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q178893&
     
#revision 761 On startup, the game now terminates any and all processes it finds by the name of "3DVisor.exe"
It now successfully connects with the Z800 headtracker every time.
     
5-Oct-2007   3.5    
  Z800: AngX, AngY, AngZ seem to be angular accelerations.
AccX, AccY, AccZ must be the positional accelerations.  I doubt I'll have any use for those, except maybe for detecting crouch & uncrouch, not likely though.
     
  Z800: "The headset includes: 3 gyroscopes, 3 accellerometers and a compass"      
  Experimented with yaw vs. compass readings.  I can't see any difference in results between the two - they seem like the same reading with a fixed offset between them (angle difference between the two values never changes by more than 1e-06f as the headset moves around).
Posted on the aforelinked thread about this and asked about the known motion detector init problem.
     
  I have seen a bit of minor drift on all 3 rotation axes but it always sorts itself out sooner or later.
Yaw drift is most noticeable when the pitch is extreme.
So far I haven't found any need for a re-centring option when using Z800.  CHeadTracker::Calibrate (mis-named) only applies to OptiTrack.
     
  Added C3DVisor::KeepAlive which keeps the headset awake.  Don't call this every frame.      
  Interesting - I'd got the headset connecting properly every time, then I opened Fraps and ran the game; suddenly it can't connect to the headset.
Unload Fraps, run again, connects fine.
Open Fraps again, connects fine.

Then it works, then it doesn't.... I can't see a pattern >:(<-FIXED(6th)
     
  3DVisor stereo: I need to be able to run the game, in 800x600 debug, at its default settings or above, with all the rest of the effects & stuff that I haven't even added yet, without ever dropping below 60 fps (I've checked that the headset definitely doesn't switch to stereo when the fps is below 60).
Currently I'm in the low 20s.  No amount of optimisation work is going to get me out of this (and optimisation work isn't the best use of my time anyway).
So
I'm going to buy a faster graphics card and have done with it :)
NB - in frame-sequential stereo mode I will get some speedup from only having to do half as many updates, but that won't help much.
     
  Didn't really do much work on the game this evening, just a load of experimentation with the headset (mostly logged)      
4-Oct-2007   5.25    
#revision 753 OptiTrack support is fully working again, under the new headtracking system.      
  Installed a DirectSound example project:
C:\Documents and Settings\user\My Documents\Visual Studio Projects\SoundFX
     
  Had to move WDK include path to before DX ones, to avoid a DirectSound entanglement.      
  added linker dependency: EMADevice_DLL.lib      
 
Synaesthesia: Totally unrelated to anything, here's what 3.1415927 looks like in my head.  I gather everyone has different colours, so this probably looks horribly wrong to anyone else.  I'd be interested to hear from you if you have the same colours:
     
#revision 756 Had to add post-build steps to copy the appropriate EMADevice_DLL.dll to the appropriate output folder.
Can now step into the source for that dll.
     
  3DVisor.cpp: Because of the funky overloaded 'EMADevice::operator new', I had a crash when the 'Z800' object was a member of C3DVisor, when the construction failed.  Works fine as a global.      
  Got the Z800 headtracking working.      
  I can hardly describe how bloody amazingly wonderful the Z800 headtracking is.  Silky smooth, deadly precise, totally responsive.  It's like it's not there.
After taking the headset off and putting the light back on, I find myself looking around the room going "where am I"?
THAT's virtual reality!!
And I haven't even added the stereoscopy yet!  Or the sound!
The 'headTracking\smoothing' option is now set firmly to zero, that's how good it is.
     
  Poor old TrackIR....  seems so inadequate now.  TrackIR support cost me about two weeks of my schedule, too.
Did learn some useful stuff from it though.
     
  TODO: try using the Z800's raw compass data instead of its yaw value - apparently that works really well:
<-DONE(5th) I can't see any difference in results between using the yaw and the compass reading, they seem like the same reading with a fixed offset:
     
  http://3dvisor.com/forum/viewtopic.php?t=979      
3-Oct-2007   3.5    
  Today marks one year since I stopped drinking.
TODO: When I overhaul the devlog converter, I'll get it to spit out some productivity stats that can be graphed (hours per week / month).
Should see that the past year has been significantly more productive than the previous ones.  The lack of nights-out and subsequent hangovers will have played a big part in this, but also the band activity has been sparse.
     
  There was an important development on the 14th or 15th of June - I suddenly stopped feeling regret for the things I'd said & done in the past while drunk.  This catalogue of memories had been cutting and stinging me every day for nearly ten years, then suddenly it just wasn't there anymore.  Very weird and very helpful :D
I have a feeling my short-term memory has suffered a bit, maybe as a result of not being exercised by the constant retrieval of drunken memories new & old.  I seem to have to write things down more than I used to, mais c'est pas grave.
Of course, for all I know these changes could have been brought about by the Roaccutane rather than the cessation of booze activities; I wouldn't know.
I probably won't start drinking again till after the project is "finished", at which point
lots of things are going to change.....
     
  Found that there's an eMagin X800 3DVisor, which I gather is the same as the Z800 but without headtracking.
I want to support this; therefore my headset-handling class is going to be called C3DVisor rather than CZ800 (the two headsets use the same SDK).
     
  Added:
- C3DVisor (3DVisor.cpp&h) - takes care of all the 3DVisor specifics (headtracking & other device features)
-
COptiTrack (OptiTrack.cpp&h) - all the OptiTrack specifics (covering TrackIR), ie. most of the current contents of CHeadTracker.
Both these objects are members of
g_game.
CHeadTracker now becomes a thin layer that pulls the appropriate information from those two objects to produce standardised head transform data.  CHeadTracker also still handles all the debug draw.
     
#revision 752 CHeadTracker::Calibrate: Removed some half-written code that would try to auto-detect the OptiTrack camera orientation.      
  Eek, I now have an "OptiTrack.h" and an <optitrack.h>.  Seems to work ok though; I suppose that's what the angle brackets are designed for.      
  Added options category OptiTrack (g_game.options.headTracking.OptiTrack)
Moved the following options from
headTracking into OptiTrack:
cameraOrientation
xHalfFOVTangent
yHalfFOVTangent
videoThreshold
     
  Noticed occasional rain occlusion failure outside House of Fraser (<-sounds a bit Westworld, that ;)
TODO: fix this
<-DONE(12.4.8)
     
  Got the game running with the re-jigged headtracker code; isn't quite working yet though.
TODO: finish this, add 3DVisor headtracking.
<-DONE(4th)
     
2-Oct-2007   4.25    
  Installed the Microsoft Windows Driver Kit 6000 (had it on a DVD at work, now copied to Installs folder)
I can now build and run the eMagin example projects, yay!
     
  FXC _DEBUG compile: c:\Noctambule\Source\HLSL\EnhancedMesh.fx
Microsoft (R) D3D10 Shader Compiler 9.19.949.0046
error X3539: ps_1_x is no longer supported; use /Gec in fxc to automatically upgrade to ps_2_0
error X3539: Alternately, fxc's /LD option allows use of the old compiler DLL
     
  Moved the eMagin SDK to C:\Noctambule\eMaginSDK, and put it into SVN.      
  Joined eMagin forums, username 'phil'      
  Been having difficulty connecting with the Z800 head tracker.  This is a known problem (TK3DERR_NON_DEVICE).<-FIXED(6th)
Some discussion:
     
  http://3dvisor.com/forum/viewtopic.php?t=979      
  BUT - disconnecting and reconnecting the USB seems to fix the problem.
Hmmm....<-FIXED(6th)
     
  What I'm going to do is port the tracking code into the game anyway, then if it doesn't behave properly I'll try initalising it from various different points in the game code to see if I can find one that works reliably.<-FIXED(6th)      
1-Oct-2007   3.5    
  v13.3, on 8800, has what looks like fallback shadow junk (ERENDERTARGET_FALLBACK_SHADOW or ERENDERTARGET_FALLBACKSHADOWREFLECTIONPOSITION or ERENDERTARGET_REFLECTION_POSITION not being cleared, that's what it looks like).
TODO: check it on quadro/PC375 again; try testing with rain occlusion switched off.
It's quite possible that this will be fixed as a result of getting the impact effects togglable (DONE).
     
#revision 744 <-got what looked like the same problem here (now fixed).  Needed a zbuffer clear needed before generating the reflection image.
Made the clearing a bit neater now; it's now done at the start of RenderSubset (rather than RenderEye).  It's skipped if the render category is RAINOCCLUSIONDEPTH.  Could alternatively add a renderData flag for the zbuffer clear.
     
#revision 745 Rain splashes and rain ripples can now be independently toggled without any glitches.      
#revision 746 CBlockParser now correctly skips lines commented-out with "//"      
  Added profile Example_HMD_eMagin_Z800_3DVisor.txt      
  Added options
display\headMounted
display\useMaxRefreshRate
display\refreshRate
     
  Renamed ESTEREOSCOPYMODE_ALTERNATING to ESTEREOSCOPYMODE_FRAME_SEQUENTIAL
Renamed ESTEREOSCOPYMODE_DUALDISPLAY to ESTEREOSCOPYMODE_DUAL_OUTPUT
All the options enums use the convention EMYENUM_MY_VALUE
Elsewhere in the code, I also use EMYENUM_MYVALUE.  Really I should've made a rule for this in the coding conventions doc, but it's very minor.
     
27-Sep-2007   3.666    
  My VR HEADSET arrived today!!!
We are now officially in Teh Futur.
     
  Very pleased with it so far.  In terms of display quality, the Z800 is pretty much exactly the way I imagined it.  Fills about the same FOV as a monitor (anything more generous costs thousands unfortunately).  I haven't run anything stereoscopic through it yet though; that's what I'm working towards now.
The optics are a bit blurry round the edges, but that doesn't cause me a problem (especially since I was planning to add that effect for this game anyway).<-loads clearer if you ensure that the eyepieces are as close as possible.
It's also more contrasty than a CRT;
dark stuff gets a bit lost so I'll need to tweak my colour grading.<-tested, works well, see below.
     
  The head-tracker looks very promising too.  Even just using its default mouse emulation, it's working well.  Currently looks like the tracking update rate is a bit slow but a bit of smoothing will fix this.<-I WAS TOTALLY WRONG, THE HEADTRACKING IS AMAZING, SEE 4TH OCT.
Using Z800 and TrackIR together is great, except that the TrackIR's limited angular range suddenly becomes restrictive when you start using an HMD rather than a fixed monitor.<-but the z800 headtracking is tons more useful than TrackIR.
     
  Being able to properly look around though, it's so cool.  I looked up at the rain coming down around a streetlight, and  honestly felt like it was going to get in my eyes.  I reckon if the game were set in summer sunshine, I'd find myself  squinting when looking up at the sun as well.      
  Tried to build the Z800 example projects.  But they require the Windows XP DDK (driver development kit), which is a 2.4 GB download >:(
download link:
<-Got it now (2nd Oct)
     
  https://connect.microsoft.com/Downloads/DownloadDetails.aspx?SiteID=148&DownloadID=4606      
  TODO: download this beast and hope it works!<-Got it now, and ti works (2nd Oct)      
  Joined the Microsoft 'Connect' programme; this is necessary in order to download the DDK (also known as the WDK).      
  Rain impact effects are now nearly safely togglable - TODO: finish this!<-DONE(1st Oct)
DeferredLightingApply.fx now uses uniform parameters to toggle reflections, anaglyph, rain splashes and mist.
     
  Needed to use Catalyst control panel to force 60Hz, otherwise the game display was horizontally shifted on Z800.  This probably means the game is trying to use the highest possible refresh rate instead of the Windows one.
TODO: fix this.
     
  Z800 was coping badly with my dark colours & subtle mist (coming out too contrasty), but thankfully this is very easy to fix using colour grading.  Tested with a curve that makes it look somewhere between the original and graded CRT results (looks great now) :      
  file:\\C:\noctambule\mockups\post\z800.acv      
26-Sep-2007   4    
  Fixed CLockableTexture.  OptiTrack debug image now displays again in the calibration mode.
I think they just needed to pass unique resource names through to the CTexture constructor.
     
  COptions now displays a warning message if it finds an unrecognised option category (COptions::WarningUnrecognisedCategory).      
  Got CCleaner and Regmon.  Fraps now works.      
  MOM.exe is "Catalyst Control Center: Monitoring program"      
  Started having a look at performance.  Need to stay above 60fps at 800*600 in DEBUG mode, in order to debug in Z800 stereo mode.......
I'm a long way off this at the moment (as low as 45 with 0 shadow projectors).  Lighting seems to be a real killer; lighting bounds are too generous in many cases.
The easiest fix would be to buy a faster graphics card ;)  It's tempting....
     
  TODO: finish getting rain impact effects safely togglable (see #error)      
  TODO: speed up the ground collision by not including small polys in the cache (kerb bevels etc!!)
Alternatively, set up automatic generation of collision geometry - that would be better.
     
  Profile 'Phil.txt' is now always loaded when running from the debugger, even in Master config.      
25-Sep-2007   2.75    
  Tracking down the patchwork normals bug:
- not a change in Patchwork.fx
- patchwork (TS) normals themselves are fine; must be a bug in ground.fx
<-FIXED.  Ground.fx revision 569, lines 703 [& 704]: basically a remout of a required transformation for the normal.  Variable 'normal' at this point is not the WS normal that needs to be output.  A bit of renaming might have helped there.
     
  Found that the headtrack calibration mode was crashing since it changed over to use CLockableTexture.  That means 13.2 would crash if you pause when using TrackIR.
As a temp workaround, the debug image is not drawn in v13.3 (but the debug meshes etc are).
TODO: Fix CLockableTexture!!!<-DONE(26th)
NOTE: WOWvx mode's CLockableTexture is working fine.
     
  TODO: COptions::WarningUnrecognisedCategory<_DONE(26th)      
  below: I've been thinking "Zombies?... Spiders?..." for quite some time now.  If only I'd thought to put the two together!
NB. this is not my enemy design, this is from Dead Space.  It's exactly the kind of thing that I'm after though - not just scary, but grotesquely and instinctively scary.
     
 
       
#version 13.3
#revision 740
Released version 13.3      
24-Sep-2007   2.25    
  Orthographic culling now allows for a sheared view matrix (see UpdateOrthographicProjection).
This prevents objects popping-out from the rain occlusion depth image.
     
  Added define RAINOCCLUSION_DEBUG_DEPTH_IMAGE, since it was a bit fiddly otherwise to get a debug display of that depth image.      
  EEK!  Patchwork normals are wrong (unless you look south)!  When did that start?  TODO: FIX THIS!!!
- Wrong in 13.2
- Wrong in 13.0
- Fine in 12.0
- got broken between 19th June & 10th September (revisions 625 to 721 inclusive)
<-FIXED(25th)
     
23-Sep-2007   1.8    
  TODO?: FX: make a header function for common rain occlusion stuff.  Currently there's some duplicated code+constants+sampler.      
  Ground.fx: ran into the vs_3_0 output register limit (again) trying to add rain occlusion, then noticed something that should've been obvious before:
In the PS, I should be (and am now) doing this:
 input.tangent = normalize(input.tangent);
 input.normal = normalize(input.normal);
 float3 binormal = cross(input.normal, input.tangent);

not this:
 input.tangent = normalize(input.tangent);
 input.binormal = normalize(input.binormal);
 input.normal = normalize(input.normal);

Removes a VS output, reduces the required vert size, saves a normalise in the PS.
Checked that the binormals are still the right way round, by looking at the road text (this shows an obvious wrongness when the binormals are flipped).
     
  ShaderBuild.exe: removed fxc logo text (/nologo) - makes it nice & easy to spot errors.
Compiling individually still shows the logo text (as intended).
     
  Ground.fx: all ripples (flow, impact rings) are now applied using the 'lerp TS XY' method (previously lerping TS XYZ).
TODO: re-tweak ground normal/ripple strengths<-nah it's looking ok now I've fixed the normals bug(25th)
     
  Ground.fx: Rain impact ripples now have rain occlusion.      
  TODO: characters need to be able to draw into the orthographic depth image.  Currently they don't seem to manage.      
  TODO: fix occasional lighting lollipop tilting ugliness      
  The areas of shelter are starting to feel sheltered (but audio will help this enormously).  You get a nice contrast when you step back out into the rain.  This is good!      
22-Sep-2007   7.55    
  Strengthened the falling rain so it looks denser and glintier.
It's now visible even against dark ground or dark sky.
     
  Profiles: integers can now be used in place of enumeration values (CBlockParser::ReadEnumeration)      
  Spent quite a while un-knackering the fallback shadows.  Some weirdness:
I'd been trying to use reflection position Y values less than a certain height to mean 'no shadow'.  But it seems I can only get this to work if FallbackShadow.fx checks for an exact Y value rather than greater/less than (which I'd be far happier with because it's more flexible towards RT format).
See FALLBACKSHADOW_NOSHADOW_Y.
     
  Rain occlusion now shears correctly.  The shear is pivoted around the viewpoint height.
TODO?: improve orthographic visibility testing to account for the sheared view matrix?  This will only be worthwhile if the occasional popping-in&out of rain occlusion around objects becomes visible.  I haven't found it noticeable so far.<-DONE(24th)
     
  Rain occlusion volume's XZ bounds are now clamped around the bounds of the visible RainFalling cells.
That's why the depth image appears to jump around all over the place when you debug it (just in case I forget next time I look at it).
     
  Remembered about the 'vpRelativePositionIn' parameter of TestSphereVisibility.      
#revision 735 Rain occlusion depth image is now generated at start of the frame rather than per eye.
TODO: deal with frame-sequential stereo
     
  Re-enabled linear mag filtering for the mist - loads better!  Must've disabled it as a temp test?  (DeferredLightingApply.fx)      
#revision 737 Rain occlusion now creates a single matrix constant for RainFalling.fx (vpRelativeWorldToUVW).      
  RainSplash.fx: Removed unused (remmed-out) pass 3      
#revision 738 RainSplash now gets the same occlusion as RainFalling.  The occlusion bailout is on pixel shader pass 2 (the more expensive one, with the loop to extrude the splashes).
It's quite nice now to see the boundaries of the RainSplash effect waving back & forth as the wind changes.  The audio wants to match this so that when you're in shelter you hear the patters waving in and out (or at least, you think that's what you hear).
     
21-Sep-2007   3.33333    
  At work, made public the code and graphics for RainFalling, Mist and VolumeLighting.  I was reluctant to do this, but I would have appeared unhelpful otherwise.      
  Release log: documented the workaround for the v13.2 WOWvx startup crash (having noticed that people from the Netherlands had spotted the WOWvx support ;)
Tested the workaround as documented.
     
  Improved profile Example_3DDisplay_Philips_WOWvx_42inch.txt :
Doubled the dimensions of all RTs except the reflection one, to compensate for the half-dimensions frameRT that gets stretched over the whole screen by the display hardware.
     
  As I'd assumed, Z800 stereoscopy works with any graphics card & drivers if the application generates the two views and sends them frame-sequentially.  Phew!      
  The game is now explicitly v-synced (D3DPRESENT_INTERVAL_ONE), in both windowed and fullscreen modes.  This is necessary for frame-sequential stereoscopy (besides, who wants tearing?)
The D3DXUT defaults previously only enabled v-sync in in full-screen mode (using D3DPRESENT_INTERVAL_DEFAULT).
     
  Rain occlusion: Decided to avoid the need for a depth surface, by using these renderstates (below) for the alpha-only depth image.  Could have borrowed the projector depth buffer but decided not to - keeps things simpler and neater and more flexible.  And I'm guessing any speed difference would be negligable.
The important bit is the MIN alpha blend:
CULLMODE = CCW;
ZWRITEENABLE = FALSE;
ZENABLE = FALSE;
ALPHABLENDENABLE = TRUE;
SRCBLEND = ONE;
DESTBLEND = ONE;
BLENDOPALPHA = MIN;
COLORWRITEENABLE = ALPHA;
     
  below: FallingRain.fx now has working occlusion.  Currently it's just vertical, but next I'll shear the depth image's view matrix according to the angle of the rain.<-DONE(22nd)
TODO: somehow use the rain occlusion depth image to reduce the mist in sheltered areas?
     
 
 
     
20-Sep-2007   3.43333    
  FX:
"ID3DXEffectCompiler::CompileEffect: Only 1-d shader arrays allowed"
     
  Added option weather\rainOcclusion (defaults true)      
  Hmmm, the rain streak pixel shader now knows where each pixel is relative to the surface of the environment.  This info could be used to produce a new, more accurate rain splash effect......
TODO: investigate this!
     
  Resurrected and tidied the orthographic stuff in CViewInfo.  Rain occlusion depth image is now working properly.      
  Occlusion of FallingRain.fx is nearly working; not sure at the moment that my WS occlusion positions for the streaks are correct (see fx error).      
19-Sep-2007   3.93333    
  Back to the weather effects:
Rain occlusion, because it's a bit shameful that there currently is none.
     
  Decided that the occlusion system for the rain visuals will not need to deal with audio at all.
The audio effects of sheltered areas will be triggered by bounding boxes.  Boxes rather than rectangles / fences because I want the sounds to work properly with arbitrary camera positions.
     
  Added CRainOcclusion (owned by CModeEnvironment).  Considered making it a CProjector subclass; decided it would be better not to.  It doesn't really tie-in closely enough with any of what I want for the lighting (I don't have any use for "directional" lights, as far as I know).      
  CRainOcclusion currently borrows the floating-point alpha channel of the fallback shadows' reflection position RT.
Fallbacks' yes/no signal is now in the Y channel (see comments).
     
  v13.2 crashes on startup if WOWvx mode is enabled.  I must've forgotten to test WOWvx after changing all the naming (13th).  This is fixed for v13.3.
From now on, I'll remember to
clean the Master config of Shaders.sln before doing a build - this catches a few potential problems to do with shader files.
     
  Retired a few old FX files into the 'graveyard' folder.      
  below: interesting accident.  It flickered like lightning or like an old film.      
 
       
  Made a good start on the rain occlusion.  Found that the orthographic CViewInfo stuff has been kinda half-removed, so I need to resurrect that before the depth image can render properly (see #error).      
#backup Backed-up the project.      
18-Sep-2007   2.5    
  Fixed the WOWvx header EDC
- an alteration to UtilCRC was required (ie. UtilCRC must not have been conforming to the CRC-32 standard before)
- I had to reverse the EDC bytes.  Presumably I had to do this last time as well? - check this
     
  Got the header displaying again.  Had to write the bytes to the texture in BGRA order, but the texture format is D3DFMT_A8R8G8B8.  I don't know why the component order gets swapped like that.
Current header (matching the 'standard' video header) is shown in blue on the header map
F102408000001F3A7B38 :
     
  file:\\C:\Noctambule\Graphics\final\headerMap.png      
  TODO: tweak the WOWvx settings in Default.txt; include the tweaked values in v13.4.      
  Anaglyph ghost reduction is currently hors service.  Added a warning message about this (if the option is selected) and stopped it crashing.      
  Updated the example profiles to use the new stereoscopy options.      
#version 13.2
#revision 727
Released version 13.2, which contains the following improvements to WOWvx support:
- smooth viewing zone transitions by default.
- all 3D display parameters can now be configured using options profiles.
     
16-Sep-2007      
  Got loads of nice rain & weather recordings from S, so I'll be able to start experimenting with audio shortly, which should add loads.
It'll involve a lot of guesswork though, because my right ear is practically stone-deaf to the high-frequency sound of rain :(
     
  Some of the MP3s decode with nasty clicking artefacts though, and I've heard this problem before.  What am I doing wrong there?  I'll try opening them at work and see if I get the same thing.      
13-Sep-2007   6.333    
#revision 723 Made a lockable texture class (CLockableTexture, LockableTexture.cpp&h), in preparation for generating the WOWvx header in code.
Inherits from the CTexture resource, but NOTE: doesn't use m_pResource (neither of its two textures can use D3DPOOL_MANAGED because they're both D3DUSAGE_DYNAMIC).
Changed CHeadTracker over to use CLockableTexture for its debug image.
     
  The reason I want to generate the WOWvx header in code is that it's currently using 'signage' mode rather than 'movie'.
This means the view transitions aren't smooth.  And I really do want this game to be a solid demo of the WOWvx displays.
Also, it'll be good to have all the parameters adjustable, just in case.
     
#revision 724,
725
Tidied-up the stereoscopy options:
- the term '3DTV' is now changed to 'WOWvx' in both the options and the code - been meaning to do this for ages.
- added option categories WOWvx and anaglyph (moved the relevant stereoscopy options into these).
NOTE: the new sub-categories aren't nested in the profiles, but they are nested in COptions.  Could improve the parsing to handle nested blocks later.
     
  Release log: I'm now striking-out fixed bugs.  This means that when you look back at the release notes for an old version, you can easily see which of its bugs are now fixed.      
  Added a 'new files' log which should make the build process a bit smoother (usually I forget about the new files I've added and have to build several times before it runs) :      
  file:\\C:\noctambule\builds\NewFiles.log      
  Added function UtilCRC      
  Got the WOWvx header texture generated in code from profile options.
TODO: Fix this - currently the EDC value from UtilCRC is wrong.<-FIXED (18th)
     
  TODO: need to squeeze this many hours in every night! ;)      
12-Sep-2007   1.666    
  v13: The ground patchwork decals appear mis-sorted on PC375 (7800? 7900?) and PC558 (Quadro).
<-FIXED in v13.1.  I had been re-using landscape\dimpleNormalsRT (now 2TTT) for the dimples height image (which is formed using blending).  The effect on SM3 nVidia cards was as if blending were disabled in PatchworkDimples.fx.
Now using non-loading member landscape\dimplesRT, which copies dimpleNormalsRT but is forced to D3DFMT_A8B8G8R8.
     
#version 13.1
#revision 722
Released version 13.1.  This just fixes the dimple height blending on cards that can't blend to 2101010 render targets.      
10-Sep-2007      
  Grabbed v13 videos and put them on YouTube.
NB this was an entire evening's work (not logged).  Next time round it'll be a bit easier because I'll be able to cut & splice the bits I like rather than trying to record perfect clips.
     
  Something that was made very clear by this capturing exercise was that my shadows need fixing quite urgently.  I had to throw away loads of recordings just because of shadows breaking-up.  They wasted a fair bit of my time.      
9-Sep-2007   11    
  TODO: for version 13:
- get blurQuality working<-DONE (8th)
- fix POM edge glitch (just a bit of limiting needed somewhere?)<-done (9th)
- get OptiTrack calibration mode usable<-DONE (9th)
- get options saveable<-nah that's for the next build
- finish motion blur?  would be nice, shouldn't take too long<-nah that's for the next build
- tidy OptiTrack detection etc<-done
- finish the headtracking effects<-no, need to get v13 out today.  v13 will have 'rudimentary TrackIR support'.
- fix dimples (view tilt)<-DONE (9th)
- check occlusion culling (view tilt)<-gave it a quick check and it looks fine
     
  Velocity.fx: disabled lerping of each texel towards its maximum velocity sampled during the blur.  This was making itself too noticeable - eg. running towards a lamppost, the lamppost would be bobbing up and down and this movement would vertically blur the background around the object.      
#revision 715, 716 Fixed the POM edge glitches, by adding two limit values:
- min tangent-space view Z position (currently 1 cm), this also prevents a possible db0 (MIN_TS_VIEWPOINT_Z)
- max parallax displacement (currently 10 cm, should be plenty) (MAX_PARALLAX_LENGTH)
     
  Fixed the dimple problem when the view was tilted.  This yielded lots of improvements:
- dimple processing now draws using a ground-plane quad instead of a very approximate ground-covering screen-aligned quad
- was therefore able to chuck out a load of uploaded constants, and calculations on both CPU & GPU sides (see GetViewSpacePositionOnGroundPlane in h_Global.fx)
     
  Weird, after making the changes above, had to roughly half PATCHWORK_DIMPLEPROCESSING_SMOOTHNESS.  Can't see why that would be.      
  Ground.fx: Cheapened the dimple normals influence by using the 'lerp TS XY' method, as I've been calling it.  The strength can now be adjusted using GROUND_DIMPLE_NORMALS_INFLUENCE (better to use this than PATCHWORK_DIMPLEPROCESSING_SMOOTHNESS, which is now set to an optimal, bumpy as possible, value - to keep the normal colours strong).      
#revision 718 The above change partly alleviates the refraction-vs-POM glitch visible around road paint (see 31 July 07)      
  HDRLighting.fx: added COLOUR_GRADING_STRENGTH, because it's slightly quicker to tweak this than the ramp texture.  Might be temporary; definitely neater to edit the texture.      
  Dimple normals now use a 2TTT target - why didn't I think of that before? (don't need to blend to it; alpha channel not needed because only the XY of the normals is used; blue channel, instead of alpha channel, now holds height).
Looks much nicer now!
     
  Also added GROUND_NORMALS_FINAL_TS_Z_MULTIPLIER (Ground.fx), because the patchwork normals were looking a bit lost now that they're lerped towards dimple normals rather than rotated onto them.      
  Added an ambient colour to the volume lighting image - definitely a good idea because some of the fainter mist & rain had got lost under the colour grading.
Ambient colour is defined by LIGHTMANAGER_VOLUMELIGHTING_AMBIENCE.
Removed hardcoded ambience from RainFalling.fx
     
  Targetting now takes into account head-tracking.      
  Setup: Added the three OptiTrack DLLs to the system folder.
NOTE: These are sourced from C:\Program Files\NaturalPoint\Optitrack\bin, but I've also put backups in the Builds\OptiTrack folder.
     
#version 13.0
#revision 721
Released version 13.0.  Didn't have time to do new videos, will do this tomorrow night.      
8-Sep-2007   1.333    
  Oops, been distracted by work, YouTube and band stuff.
Some YouTube-related name-dropping:
- Mark Stirton (of Stirton Productions) said the game looked interesting (and weird)! :D  Ace!
- Mario Cavalli kindly posted-up his 1992 film Soho Square for me!  (this is very relevant to some ideas I've been brewing-up for the mythical "next project" that I'll never have time to do) :
     
  http://www.youtube.com/profile_favorites?user=ProgrammerArt      
  Found that my motion blur had never been adapting its #samples per pixel to the pixel's velocity - it was always using the max #samples.
Can't coax the HLSL compiler into letting me do this - has anyone else managed? :
- sample value X from a texture
- use X to determine the number of samples to take from another texture
     
  So for now, I'm going to let the Wookiee win and just always use the maximum number of samples.  When I next upgrade DX, I'll have another try, since I have a feeling there was some compiler bug mentioned in this area.....      
  Got motionBlur \ blurQuality working.  The 'max' setting (not recommended!) uses 169 samples - that's literally the maximum number I can use before it fails to draw the effect.      
2-Sep-2007   1.6666    
  NOTE: C++: can't check enum values at compile time :(      
  C++: Why does this never work?  It's straight out of an MSDN example but it doesn't work.  What am I doing wrong? :

#pragma warning( push )
#pragma warning( disable : 4100 )
// Some code
#pragma warning( pop ) 
     
  Headtracking: no longer crashes on startup when no camera is found      
  Started getting option 'motionBlur \ blurQuality' Working; ran into a bit of compiler fussiness - todo: finish this<-DONE (8th)      
1-Sep-2007   8.93333    
  I'm finding that motion blur mishaps create some really nice dream/nightmare effects.
TODO: I reckon hijacking the motion blur effect (random rippling in the velocity buffer?) will be a great starting point for the dreamy look.  Not entirely unlike the Batman Begins hallucinations, which I really like.
Ooh, If that motion blur distortion can be masked, it could be great to use selectively on stuff like the enemies or the environmental text (the stuff that I would *want* to look closely at in a dream would but struggle to get a clear image of).
     
  below: a couple of other motion blur mishaps.  Crashing waves on the left (if you blur your eyes); glass/gem overlays on the right.  Glass has been one of my ideas for the menus etc so that was a nice coincidence.
If I do use any glass/liquid for the menus, it would be a good idea to have it reflect the environment - this would show the player their own reflection which would be neat.
     
 
       
  Found that my motion blur velocity image had been one frame behind, now fixed;      
  Spent most of the day trying to find a good processing technique for the velocity buffer.  This is to deal with velocity boundaries.  Tried loads of stuff, but in the end it became clear that the 'clever' methods need loads of loop iterations (far too many) to actaully give a good result.
So I'm now just doing a simple blur on the velocity, plus lerping each texel towards the maximum velocity sampled during the blur<-DISABLED(9th, was causing bad artefacts).  Works well enough.
     
1-Sep-2007   6.08333    
  Added option headTracking \ smoothing (1-t value for lerping to the head transform each frame).
Can't be bothered making the smoothing framerate-independent [yet].
     
  Tested option headTracking \ cameraOrientation.      
  Added Light.cpp&h to SVN (gulp, these were unversioned till now).  Checked that these were the only ones.      
  Searching for free rain sounds online seems to be a complete waste of time.  The loops need to be ultra-crisp or they're no use at all.      
  Added these options and got them working:<-TODO: get blurQuality working<-DONE(8th)
motionBlur \ blurQuality (replaces maxSamples, because my blur loop needs to be unrolled - compiler bug?)
motionBlur \ blurVelocityImage (blur the velocity image to prevent edge artefacts at velocity boundaries)
motionBlur \ distanceForMaxSamples (step distance above which the maximum number of samples is used)
     
  Options: Unrecognised option warnings now display the name of the profile in which the problem was encountered.      
30-Aug-2007      
  Some very good (and completely unaffordable) HMDs, using 24 SVGA (800x600) inputs:    
  http://www.sensics.com    
  http://www.inition.co.uk/inition/product.php?URL_=product_hmd_sensics_pisight&SubCatID_=16      
  Interesting VR site:      
  http://vresources.org      
  800*600, 42° diagonal FOV, £644 (still too expensive, FOV still too small) :      
  http://www.personaldisplay.com/content/fmds/fmd_sub02_01.asp      
  http://www.personaldisplay.com/content/fmds/fmd_sub02_01c.asp      
  http://www.vrealities.com/i-visorfx601.html      
  640*480, 60° diagonal FOV, £1244 (too expensive, res too low):      
  http://cgi.ebay.com/Virtual-Research-V6-HMD-Virtual-Reality-VR-display_W0QQitemZ150156037777QQihZ005QQcategoryZ187QQssPageNameZWDVWQQrdZ1QQcmdZViewItem      
  The diagonal FOV I get from this monitor (LG 700S) is about 60° (35 cm from the screen)      
  Got a sudden blue-screen crash (trying to open Calculator, with lots of Explorer windows open)
Something about NTFS.SYS
When I got back into Windows after the restart, it thrashed the hard drive for a couple of minutes before doing the usual startup stuff.
     
  Great big HMD comparison chart, with prices:      
  http://www.inition.co.uk/inition/compare.php?SubCatID=16&SortID=13&Asc=0&cur=GBP      
  Narrowed it down to these two HMDs (which is not to say I'm going to buy one).  Both 800&600, around 40° diagonal FOV:      
  eMagin Z800, which has built-in 3DOF head-tracking.  Accepts frame-sequential 60 Hz (30 fps stereo).  Info and headtrack SDK at www.3DVisor.com:      
  http://www.inition.co.uk/inition/product.php?URL_=product_hmd_emagin_z800&SubCatID_=16      
  http://www.3dvisor.com/products.php      
  Daeyang i-Visor FX601 (field-sequential = line-sequential = 600/2 vertical res??) / FX605 (dual-input, too expensive)      
  http://www.inition.co.uk/inition/product.php?URL_=product_hmd_daeyang_ivisor&SubCatID_=16      
  User reviews for the z800:      
  http://www.amazon.com/eMagin-Z800-3D-Visor-3DVisor/dp/B000CCYL3S      
  another review:      
  http://extremeoled.com/print_article/eMagin+Z800+3DVisor+Stereoscopic+Headset/163899.aspx      
28-Aug-2007   3.5    
  NOTE: lighting tails are (and always have been) needlessly fat for lights close to the ground.
TODO: proper specular highlight shape calculation, in conjunction with CLight::ClipTailBelowHead
   
  TODO: dimples are glitchy in the distance when tilted; fix this    
  Got the lighting geometry working with head tilt (just needed a load of aspect ratio compensation to go with the  rotation).
Didn't do anything special for ground slope though.  No point adding that till it's really needed.  Mild slopes won't cause visible problems.
     
  Decided not to attempt auto-detection of headtracker camera orientation - I've lost enough time to feature-creep recently.
Instead, added option headTracking \ cameraOrientation
     
  TODO: deal with CLight::s_handleTilt      
22-Aug-2007   2    
  Added function Vec2Average    
  Downloaded VirtualDub, for preparing video files    
  Trying to get that lighting geometry tiltable.....<-DONE (28th)      
21-Aug-2007   2.5    
  Got the shadows working with head-tracking (I had forgotten to check the 'useHeadTracking' flag, on the projector camera).
Reflections are fine (UtilDrawGroundCoverQuad seems to work ok when tilted; could probably optimise according to the tilt though).
   
  Got the mist working with head-tracking.    
  TODO: need to improve lighting lollipops so they support view tilt (and ground plane slope, while I'm at it).
Easiest thing to do will be to keep the existing calc of the head shape and (from the clipped head shape) screen area, then rotate the head and plot the tail according to the screen-space vector from the light pos to the reflected light pos.
<-DONE (28th)
   
  Intro: TODO?: Use a floaty flying camera (running along a spline) + phospheney blurry effect?  Flying around with head-tracking looks great.  Phospheney blurry effect would be perfect for the edges of the screen, if it wasn't too annoying.      
  TODO: Should really give some thought to using "dream text" as the theme for the menus/front-end/HUD.....
Just need to make sure it doesn't end up messy, with all the stuff going on in the background as well.
It's tricky because when you're tweaking graphics options you probably don't want the scene to be obscured or filtered in any way.....
Would be good to get all the menus etc started SOON.
     
21-Aug-2007   2.91667    
  Added function MatrixLerp    
  Added some head-track smoothing.  Currently simple lerping.    
  Motion blur now takes into account head-tracking.      
  You can actually peek round corners now that the head-tracking is in, it's cool!      
  Started getting the shadows etc working with head-tracking, TODO finish this (see #error), TODO: tidy/rename stuff      
  TODO: try adding head-track steering method      
  Found that generating the headtrack debug image is quite costly; TODO: better control for when this is & isn't generated.      
20-Aug-2007      
  Overtime.  Wait...didn't I make a rule about that?!    
19-Aug-2007   10.25    
  CMeshFrame::RenderIndividually no longer tests visibility in non-_DEBUG builds    
  NOTE: any kind of split-screen / picture-in-picture features are now officially not going to happen (time is getting short so I need to ban as many features as I can - a 'to-not-do' list, for a change!).      
  For the head-tracking, I needed to overhaul the camera / viewInfo system a bit:
- cameras are no longer involved with stereoscopy
- CCamera::Apply is now CViewInfo::ApplyCamera (this applies the offsets for head-tracking and stereoscopy)
- cameras are not aware of head-tracking
     
  NOTE: in anaglyph modes, motion blur setting currently has no effect (no blur).  May or may not get the two working together later on (would be nice, of course).      
  Got the anaglyph working again (had been broken by the motion-blur) : LightManager.cpp      
  (below) Checked that WOWvx mode hadn't got broken by motion blur or colour grading.  And no, I'm not going to motion-blur the depth data!
(NB - this is not the aspect ratio used in WOWvx mode)
     
 
       
  Added option category headTracking
Added options
headTracking \ xHalfFOVTangent
headTracking \ yHalfFOVTangent
headTracking \ videoThreshold
headTracking \ headOffsetX
headTracking \ headOffsetY
headTracking \ headOffsetZ
headTracking \ headOffsetYawRadians
headTracking \ headOffsetPitchRadians
headTracking \ headOffsetRollRadians
     
  MaxScript: head.max: head->clip matrix:
$trackclip.xform.gizmo.transform
...but I can't get that matrix to work in the game.  Certainly had to negate all the X components.......?
     
  Added CModeHeadTrackOffset (ModeHeadTrackOffset.cpp & h) - the game mode for setting the head/clip offset for head-tracking (lets the player move & rotate the head model into position relative to the trackclip).
Pleasingly, this took no time at all and worked straight away.
     
  Got the player's head transform correctly tracked ^_^  It's currently working just like the TrackIR support in MS Flight Sim (ie. 6DOF and suitable for a head-mounted display).      
  TODO:
- Some kind of smoothing, because the low camera res really shows now that it's controlling the view.
- handle the slight glitch where the sphere intersection in CHeadTracker::TestZPosition fails (z pos close to max z).
- make the tracking clever enough to understand when the point order crosses over.  The TrackIR 4 software doesn't do this, but it would improve angular range quite a bit.
     
  TODO: fix shadows & reflections, which look like they're still using the main camera position rather than the viewInfo position<-fixed (21st)      
  TODO: the 'virtual window' head-tracking effect      
18-Aug-2007   6.583    
  Planned the head-tracking calibration.  Found that it can work by requiring the player just to look at the screen centre (rather than the camera as well) provided the following assumptions are true:
1. the camera is known to be mounted somewhere on the screen plane, OR the distanceToScreen setting is reliable;
2. the player's 'head' position (point between the eyes) lies on a line perpendicular to the screen plane and originating at the screen centre.
   
  An assumption I definitely don't want to make would be that the camera is positioned at the screen's X or Y centre position, because I know people like to put it on the left hand side of the monitor top for example, to get a better view of the trackclip.      
  TODO: in calibration, try interpreting objects in each orientation mode; see which one gives the most sensible head orientation & distance.<-NO, MORE COMPLICATED THAN IT SOUNDS + FEATURE CREEP! (28th)      
  Added typedef QSORT_CALLBACK      
  Swapped EHEADTRACKEROBJECT order (now top, middle, bottom), less confusing      
  Got the binary depth search working - very effective.      
  I've now put my camera quite far away, slightly behind the screen plane and way off to left of the monitor.
This gives really good coverage, so I want to support this kind of unrestricted camera positioning.
     
  Tried to borrow the TrackIR calibration head model, an .X file; couldn't get it to display as anything other than a crushed-up blob though.  Is it skinned or something?  Appears fine in the DX viewer.      
  Made a quick head model for tracking debug      
16-Aug-2007   2    
  Added some v13 preview videos to the game's new Bebo page.  Feel free to 'add' me:    
  http://bebo.com/lecauchemar      
  Made the headtracking simpler (cheaper) and more stable most of the time, by using the vector between the bottom & MID lights as the trackclip's 'up' axis (previously bottom & top).      
  Started changing over to a binary search for the clip's Z position, TODO: finish this, too tired now      
  Freetrack? TODO find out more about this:      
  http://freetrack.online.fr/      
15-Aug-2007   4.75    
  Re-learned how to do simultaneous equations - needed to happen sooner or later.    
  (below) Got some very official-looking TrackClip PRO measurements from the OptiTrack forums; used simultaneous equations (arc-arc intersection) to derive coords from these (now using these coords, and the tracking does look more stable as a result).
NOTE: there were more significant figures in the trackclip measurements in the first version of that post; I used the first version, because those numbers must have come from somewhere good.
   
  http://forum.naturalpoint.com/showflat.php?Cat=0&Number=25932&an=0&page=0#Post25932    
  Corrected the trackclip model to match the new light coords.      
14-Aug-2007   1.5    
  Fixed all but the most minor of my tracking glitches.  I had just made a couple of really clumsy mistakes, causing code to be in the wrong order and variables not to be initialised.  Must've been sleep-coding again!    
  It's now nice & stable.  The only remaining glitch is when the sphere intersection in CHeadTracker::TestZPosition fails (z pos close to max z).  Shouldn't be too hard to fix that.....    
13-Aug-2007   2.91667    
  Maths: Added functions:
- GetDistanceFromRayToRing
- GetClosestPointOnRay
   
  Hoped that GetDistanceFromRayToRing would completely solve my tracking problem, but it didn't........ need to investigate further.......<-working now (14th)      
  Currently getting totally bizarre results (see #error). <- fixed 14th      
12-Aug-2007   8    
  TODO: see flight sim forum below, where someone suggested the same approach as mine for using the TrackIR (the projection adjustments were even mentioned) :    
  http://forums.x-plane.org/index.php?showtopic=18586&st=0      
  tracker fov: another possible v fov is 2*atan( tan(46/2) * (3/4) ) =
35.31838401289530331635147238541
     
  measured the TrackIR 4 camera's fov:
at 50 cm:
X extent is 19.75 cm
Y extent is 16.35 cm
aspect ratio: 1.2079510703363914373088685015291
X half-fov tangent: 0.395
Y half-fov tangent: 0.327
X half-fov degrees: 21.554019920478842643648210638558
Y half-fov degrees: 18.107744742279231622861032074031
     
  Double-checked the measurements above by using x=0.5 and y=0.5 positions; all bang-on, no sign of barrelling / fish-eye.      
  Made some handy lightweight metre & half-metre sticks by chopping-up an old tape measure.  Why didn't I think of that before?!      
  Got a fault in my vector tracking at certain angles, but I'm pretty sure I know what's going wrong now, at last.  It's because I avoided figuring-out GetDistanceFromRayToRing this morning, and used a different method instead, which I now know to be incorrect.
GetDistanceFromRayToRing is trickier than it sounds...  Hopefully fixing that will put everything into place.
<- fixed 14th
     
  Added GetDistanceFromRayToPoint      
11-Aug-2007   8.25    
  cross-product: swapping the parameters negates the direction of the output    
  Added functions:
- IntersectRaySphere
- MatrixSetTranslation
- IntersectRayPlane
     
  Removed macros:
- MATRIX_SETPOS
- MATRIX_SETPOSVEC
     
  Added axis vectors & negative axis vectors.  Obviously it would always be better to optimise these out, but they are still handy to have around.      
  Put 2 XForm modifiers on the trackclip model, so that middle.x = 0 and top.xz = 0      
 
 
     
  above: vector tracking with TrackClip Pro is now working well :D
The depth calculation is iterative (because I'm not clever enough to do it the fancy way, assuming there is one), but it's all good and doesn't seem to need as many samples as I'd imagined anyway.
TODO: use a binary search for the depth.<-done (18th)
     
  Asked on the NaturalPoint forums if they could provide exact measurements for the TrackClip and the camera fovs      
7-Aug-2007   2.4    
  Tracking: tried prioritising my 'objects' (points) by rank, and by score, but seemed to get unhelpful results either way.  Maybe it's because I have to set up preferences for min/max/ideal object size first.
For now I'm prioritising by area, which gives the result I want.
   
  Added Vec2Mul and Vec2Div
Changed the VEC2 functions to take pointers rather than references, for consistency
     
  Tracking: Note: object X coords are negated, no idea why      
  (below) The trackclip model is now pinned neatly onto the lowest object (follows it cleanly round the screen)
NOTE: model is currently facing away from the camera; when all 3 points are tracked, it should (fingers crossed) swing round to face the camera.
TODO: get the top point pinned next
     
 
 
     
6-Aug-2007   3    
  Continued setting up vector tracking & its associated debug rendering.
TODO: use the qsort to discard the non-useful objects (rank? score?)<-using AREA
TODO: fit the debug image to the display width
   
  Some free sound samples (potential monster noises etc).  Need to find more pages like this:      
  http://www.freeinfosociety.com/site.php?postnum=596&phpMyAdmin=af0f6b4465fe3f904426eaeb3dc0e3fa      
5-Aug-2007   3.333    
  Another use for the head-tracking: Head lamp.  Will be great to see this picking up subtle head movements, will make it way more real.
Because a head lamp doesn't really require any player animation, I can (and should) put this in pretty soon.  Will be useful for inspecting unlit areas.
A 'light cannon' or flare gun would be useful too.
   
  Added HUDObject.fx for the trackclip model.  This might well be used for weapon icons etc.      
  Corrected the measurements of the trackclip model.  Now 100% confident about the side view (drawn at the screen plane, it's perfectly 'actual size', with the 3 light positions matching, as well as the numbers all being nice & round).
The X offset of the mid light is currently 1.25cm, which may or may not be correct; tricky to measure.
     
  Got the trackclip model displaying properly.      
4-Aug-2007   13    
  TRACKING: XYZ coords seem to be in millimetres, times two, the coords of the bend of the vector clip.
When X & Y are 0,
Z is 520 when the bend of of the clip is 26cm from the camera.
   
  TRACKING: running around 50fps, I'm requiring 197-199 loops to pick up a frame from the camera.
Running at a bad framerate, this number jitters between the discrete values of 1 and 199.
Removing the per-frame LED commands changes this only slightly.<-this stuff's all variable
     
  OptiTrack: Been getting vector tracking results that don't make sense (especially for X & Y position).  The values move in the right direction but apart from that they don't make sense.  eg:      
  file://C:\noctambule\docs\HeadTracking\centre.png      
  Started investigating my own vector tracking for the TrackClip:      
  file:\\C:\noctambule\docs\VectorTracking.txt      
  Procedural texture info: Search for "Using Dynamic Textures" in DX help      
  Un-included wxdebug.h, for reasons I can't be bothered describing; then had to add my own ASSERT and REMIND macros (global.h)      
  From DX docs:
"Use square textures whenever possible. Textures whose dimensions are 256x256 are the fastest"
     
  My camera's FOV is quoted as 46 degrees (I think that's horizontal)
So until I've done some measurements, I'll assume that the half-fov tangents are in the same ratio as the res, giving me a vertical fov of 38 degrees (38.248394107273148325087524587558)
     
  trackclip: 11cm from top to bottom LED      
  Built a model of the trackclip to help me with debugging the vector tracking.      
  Got the camera's image displaying in the correct aspect ratio in front of the view.  Will use this as a background for my trackclip model.
Took ages to get the image into a texture and then onto the screen.  Had to use a D3DPOOL_SYSTEMMEM texture for the locking, then UpdateTexture onto a D3DPOOL_DEFAULT texture so it can be rendered.  Trying to render the systemmem texture always gave white.  Locking the default-pool texture didn't actually fail, but gave corruption.  Both textures are D3DUSAGE_DYNAMIC.
     
3-Aug-2007   8.75    
  Spent all day trial-and-erroring with the basics of the head-tracking, which was jerky and weird to begin with, because I wasn't retrieving the frame data in the right way (amongst other things).
It's now smooth as silk, but as far as I can tell, OptiTrack's vector tracking only supports the cap, not the trackclip :/
I don't think I can justify the time it would take me to work out the TrackClip tracking myself.  Asked on the OptiTrack forums if anyone knew how to do this.
 
  Threads before OptiTrack init (note all the IDs change from run to run) :  
1976 __freeCrtMemory (main thread; dunno why it has that name) Normal   0  
744 Win32 Thread Time Critical   0  
3064 Win32 Thread Time Critical   0  
2940 Win32 Thread Time Critical   0  
  pCameraCollection->Enum adds the following threads; pCameraCollection->Release removes them with the following output
The thread 'Win32 Thread'
(0x54c) has exited with code 0 (0x0).
The thread 'Win32 Thread'
(0xb14) has exited with code 0 (0x0).
The thread 'Win32 Thread'
(0x1a4) has exited with code 0 (0x0).
The thread 'Win32 Thread'
(0xe40) has exited with code 0 (0x0).
   
3212 Win32 Thread Highest   0  
2244 Win32 Thread Normal   0  
3896 Win32 Thread Normal   0  
2404 Win32 Thread Normal   0  
292 Win32 Thread Normal   0  
  pCamera->Start adds the following threads; pCamera->Stop removes them with the following output
The thread 'Win32 Thread'
(0x588) has exited with code 1 (0x1).
The thread 'Win32 Thread'
(0xcac) has exited with code 35 (0x23).
   
1508 Win32 Thread Normal   0  
3040 Win32 Thread Highest   0  
  WEIRD: OptiTrack shutdown, probably because it removes threads or something, can't be done in a destructor.  If I try to do it in ~CHeadTracker, there's a crash when it exits the function.
Now using Init & Shutdown methods instead.
 
  TrackIR: To view profile XMLs:
- remove '?' from start and end of XML tag
- add </xml> at end of file
 
  TrackIR: noticed that pitching movements were causing a slight roll to be read as well.  This was because I'd angled the camera, on the side of the monitor, to point inwards so as to centre the lights.  Aligning the camera with the screen plane fixes it, but gives me less rightwards truck range.
TODO: at the centring stage, fix this problem up
 
  From the OptiTrack forums, preferred object size:
"For the Track Clip Pro - on average i would say between 75 and 100."
     
  Fixed typos in Example_SpeedyLowRes.txt, causing wrong display dimensions.      
2-Aug-2007   3.83333    
  Ported basic 6DOF tracking code from the OptiTrack forums (link below).  This was a butchered version of the command-line sample, with the ATL stuff taken out.  Had to add pFrame->Release after pFrame->Free, otherwise it would crash after 19 or 20 updates.
Might've also had to
frame=NULL before each camera->GetFrame, can't remember.
     
  http://forum.naturalpoint.com/showflat.php?Cat=0&Number=17391&an=0&page=0&vc=1      
  Got a rough test whereby the player's camera is driven from the CHeadTracker instance.  Pitch & Yaw seemed sensible, but when I added roll....currently looks like it might be trying to read a track-cap; or am I maybe just doing something wrong with the way I'm combining the rotations? TODO: FIX THIS      
  OptiTrack command line sample initially didn't compile (unicode entanglements).
Got it compiling by removing #include <atlbase.h> and all the ATL usage: CComPtr (a type of smart-pointer), CComVariant (a VARIANT wrapper).
Then just had to set
frame=NULL before each camera->GetFrame.
     
  My camera doesn't support greyscale imaging :(
Would've been awfully groovy to project the player's face image into their in-game face in real-time.  Instead, could take in a web-cam stream (this would require a calibration mode in-game, but that's no biggy.  The calibration would remain 100% valid until the such a time as the cameras are repositioned).
A face AVI could be recorded as part of the replay.
TODO: find web-cam; get hold of video stream
     
  NOTE: be careful not to open a second tracking app while the camera is already in use (eg. TrackIR while the game is running); this breaks things.      
1-Aug-2007   2    
  TrackIR arrived this afternoon.  Does its job wonderfully.  I just need a head-mounted stereo display now and I'm all VR'd up! >:D  Seriously, I'm going to start looking for an HMD, because TrackIR's angular tracking range is really good (wasted on a monitor).
The TrackClip fits my headphones perfectly too.  It's all groovy.
     
  Here's what I want, virtual retinal displays:      
  http://www.cs.nps.navy.mil/people/faculty/capps/4473/projects/fiambolis/vrd/vrd_full.html      
  The best HMDs I can find on eBay are 800*600:      
  http://cgi.ebay.com/I-glasses-Video-PC-SVGA-equal-to-70-inch-TV-HMD-VR-NEW_W0QQitemZ110057964273QQihZ001QQcategoryZ294QQrdZ1QQssPageNameZWD1VQQcmdZViewItem      
  Or cheapy 800*225:      
  http://cgi.ebay.com/HOT-INNOVATEK-V-490-i-Glasses-Virtual-VIDEO-HMD-MONITOR_W0QQitemZ200135343842QQihZ010QQcategoryZ67771QQssPageNameZWDVWQQrdZ1QQcmdZViewItem      
  Both say 26° diagonal FOV.
Don't even know if they can be fed dual inputs though.
     
  TODO: playbacks:
- record head track data
- allow custom music track (wav / mp3) so player can record head movements in time with the music (and just generally, record themselves playing to a score as it were) ?
     
  TODO: use the TrackIR camera LEDs for something (eg. low ammo warning / homing device?)      
  Camera details:
355x290, 120fps
     
  Installed the OptiTrack SDK.
From what I can tell, there are no licensing restrictions to stop me using it in the game.
     
  Started porting the alarmingly convenient Optitrack sample into CHeadTracker (HeadTracker.cpp & h)      
31-Jul-2007   3    
  Installed VS2005 SP1 in the hope that it would fix my macros ... it did!  YAY!
Had to load my macros project again after installing the patch.
     
  Added option category Debug
Added option Debug \ chugmaster
     
  Visual Studio macros are now kept SVN'd at:      
  file:\\C:\noctambule\VisualStudio\Macros\MyMacros.vsmacros      
  Just noticed a complication in the motion blur:
reflections, specular & shadows currently get blurred according to the receiver's screen-space velocity, not the caster's.
     
  Loads of improvements to ground.fx, which is now getting towards looking magnificent.
- improved the way the ripple/impact normals are combined with the ground normals (TODO: only lerp TS XY)
- impact normals are now coming through much more clearly, even on non-puddly ground.  That's what I want, nice & busy.
- patchwork normals are coming through true now, which strengthens the POM back to the way it should be, nice & rugged (flattened normals somehow reduce the apparent depth, a lot)
- TODO?: cheapen dimple influence in PSReadGroundTopology using the lerp TS XY method<-DONE (9.9.7)
- TODO: fix refraction-vs-POM glitch now visible around road paint (I think this would've always been there, just wasn't visible with the flattened
patchwork normals)
     
  As a result of the ground.fx improvements, specular patches are bigger and more ragged (GOOD).  This has a knock-on effect on the exposure control though (more light in the frame)
TODO: compensate
It also shows up the edges of the lighting geometry; TODO: can the mask texture be improved?
     
30-Jul-2007   2    
  Made a YouTube 'channel' for my game videos:      
  http://youtube.com/programmerart      
  http://fr.youtube.com/programmerart      
  Had a look at some TrackIR / Track-IR demo videos, looks like something I should start experimenting with:      
  http://youtube.com/watch?v=_AO0F5sLdVM      
  TODO: in the stereoscopic modes, make use of the real-world head positioning & tilt data, RAR!
TODO?: aim using head tracking (crosshair moves to point on screen being looked at)?
     
  Couldn't resist - bought a TrackIR 4 PRO and the head-mounted USB IR light thing which should fit nicely onto my beloved HD-25s.  Order info etc:      
  file:\\C:\correspondence\TrackIR      
  TODO: aim to get included on this list of free TrackIR-compatible games:      
  http://www.naturalpoint.com/trackir/04-community/community-free-game-demos-and-utilities.html      
  ...and this one:      
  http://en.wikipedia.org/wiki/List_of_games_supporting_TrackIR      
  FTP: Removed ReleaseLog.txt.  Will continue to use local copy for drafting though.      
  Fixed moblur jittering by generating the velocity image earlier.
TODO: fix the zbuffer corruption resulting from this move<-fixed (31st): GenerateVelocityImage currently has to be done before after CRainImpact::Prep to avoid corrupting the ground reflection.  Don't know why yet.  FIXME?
     
  TODO: previous frame persistence
TODO: get the light marker spheres included in the motion blur
TODO: deal with falling rain motion blur
TODO: try writing player mesh's velocity to MRT[3] so it can be cancelled out from the final screen-space velocity
     
29-Jul-2007   11.6667    
  Spent the day adding motion blur (based on camera velocities).  Still plenty to do, but it's looking cool and adds a sense of "urgency" to the action; hard to explain.
I'm going for eye-style motion blur rather than film style, the difference being that eye-style is continuous and requires that lights be able to trail seamlessly over several frames (the trailing is done in HD range which will allow lights to trail farther & brighter than everything else).
Film-style is much simpler, and it will be available as an option (motionBlur\type).
Later on, enemies and other moving objects might write their velocities to MRT[3] to be combined with the camera velocities.
     
  Added option category motionBlur
Added option
motionBlur\type
Added option
motionBlur\maxSamples
Added option motionBlur\velocityRT
     
  Added:
MotionBlur.fx
Velocity.fx
MotionBlur.cpp & h (CMotionBlur, an instance of which belongs to the environment)
     
  TODO: use FRAME ort (only used for deghosting) as MOTIONBLUR ort      
  DeferredLightingApply.fx: found a mul (mist) that should be moved into the VS instead (will require some rejigging/hardcoding)      
  MotionBlur.fx: When trying to use a texture sample to control number of loop iterations, got this (even with the sample saturated):

"c:\Noctambule\Source\HLSL\MotionBlur.fx(128,12): warning X3553: Can't use gradient instructions in loops with break, forcing loop to unroll
c:\Noctambule\Source\HLSL\MotionBlur.fx(126,2): error X3511: Unable to unroll loop, loop does not appear to terminate in a timely manner (1024 iterations)"

Fixed it by using a constant number of iterations and breaking out when the required number have been done.
     
28-Jul-2007   7.33333    
  TODO: get VS2005 SP1 (432 MB) and see if it fixes my macros, which still aren't working.<-(31st) it did, YAY!      
#revision 651 Ground water flow now working well; just need to add kerbside streams.
Flow is now framerate-independent and pausable.
Tried making the wind ripples follow the fluctuating speed of the wind, but it just looked downright wrong.  It's because it's a single rigid layer; when its velocity changes it draws attention to the fact that it's scrolling uniformly rather than actually rippling.
TODO?: procedurally animate the wind ripples texture?
     
  Nice to see that PNG compression does the sort of stuff I thought it did:
postCurve.png:
256*16 = 3.68 KB
256*1 = 3.57 KB
     
  Added option HDR\curve      
  below: started playing about with post-processing (currently just curves; independent R/G/B is crucial).
Took me a while to get the hang of it but it's now giving really powerful results.  The main thing I'll use it for is to increase the vibrancy of the scene.  When I take the post-processing off, the game looks dull and muddy in comparison.  The lights feel really dazzling now, as they should - and look how it brings out the rain.
PS - ignore the timers; the shot on the left is paused and the other one isn't.
     
 
       
27-Jul-2007   3.25    
  UINT % [+ve int constant] - [+ve int constant] = UINT !!!!      
  It's tricky, but the ground water flow is now starting to look promising.
- per-pixel UV scrolling based on vert normals; speed is multiplied by water depth
- to maintain texture cohesion, I'll use two short (< 1 second) cross-fading scroll periods
- there's also a wind ripple layer with uniform direction.  This fades in to 100% influence where the gravity flow has speed=0, to hide static ripples
TODO:
- get the cross-fading in<-done (28th)
- tie wind ripple velocity into wind system
<-no (28th)
- add kerbside streams (these will have their own velocities that override the gravity flow)
     
26-Jul-2007   2.3333    
  Now that's interesting.  I've been away on holiday for a month and now my Visual Studio macros don't work.
I search the devlog and see that the last time this happened was also after I'd been on holiday for a month.
     
  Anyway, I finally did my 'field trip' - yay!
It was mostly an experiment to see how I'd cope thrown into a French-speaking environment on my own - whether it would stress / frighten me or whatever.  But it went really well and I enjoyed it.
Would have liked more opportunities for conversation though.  My most-used phrases (especially round Pigalle) were "Non merci, NON merci" and "Désolé, je ne fume pas" ;)
     
#revision 647 Well, it's hacky, but I've added a way of specifying wrap/mirror addressing per texture.
If the texture's name contains #Um then the effect instance sets U mirror addressing on stages 0 and 1, otherwise it sets wrapping on stages 0 & 1.  Can't set the addressing on the correct stage when each texture is 'set' because the effect instances store pointers to D3D textures not CTextures (and that can't easily be changed).
This system could be extended later to include the likes of #Vm (mirror V), #Uc (clamp U), and any other attributes I wanted to control per-texture rather than per effect instance.
Added the # code info to TextureProductionRules.txt:
     
  file://C:\Noctambule\docs/TextureProductionRules.txt      
  Eg., the colour map of the 'kerbs' texture is now renamed kerbs_#Um.tga (&.psd) (only one of the maps needs the # code).
Its production folder is still just called 'kerbs'.
     
  Saw v12.0 running on M's new nVidia SM4 card.  No performance worries at all on that system, which is great to see :)
When it's running smoothly, it's just crying out for motion blur....
That card can blend to 2TTT targets (unlike the SM3 nVidias), which is also reassuring.
     
  TODO: Get the ground water flowing properly now.  Paint velocities into the dimple objects?      
27-Jun-2007   4    
  Thought it would be a nice idea to use the town aerial as a backdrop for the Max schematic view - so I know roughly where to find things.
Unfortunately Max is using some ridiculous method for displaying the zoomed image.  It's so chuggy I can't use it! >:(  In fact it runs out of memory if I zoom in and then try to pan around!  MA-AX!!  That would have been a really helpful feature.
     
  Max: When renaming nodes, don't forget about the LANDSCAPE_FRAMENAME_ defines!!
TODO: get rid of those defines and use some new properties on NoctambuleScenic instead?
     
  WordPad: Crash on ctrl+a, ctrl+f in leam.x      
  I think I need more RAM.  LOTS MORE.    
  MAX: FX exporter converts '#' in node names to '_'.  So don't use hashes in node names.    
  Got the world back into a working state.    
  (below) Got my prototype kerb texture applied.  Needs a few adjustments, but the patchwork system and its POM are both doing a fine job :)  The pic on the right is a reference photo.  I need more puddles!
I put a wee smidgeon of a curve on that grab to darken the bottom end.  This seems to be a very effective way of making game images look more real somehow.  TODO: apply a similar curve in post processing! :D <-done(28.7.7)
   
 
     
  TODO: some way of specifying wrap/mirror addressing per texture?  Mirror is good for kerbstones (as used above)<-done, 26th of July    
26-Jun-2007   2    
  Made some kerb textures.      
  TODO: get the John Street north kerb decals lining up<-done      
  TODO: nice wall chart reminding me how on earth that world file is built up! (it's a towering maze of Booleans and modifiers)      
25-Jun-2007   3.16667    
#revision 643 Yay, fixed the memory leak on reload.  Just had to release each enumerated CEffect before reloading it.
Noticed that the number of unfreed allocations wasn't multiplying with the number of reloads I did.  This turned out to be an indication that it was a 'reference leak' - might be worth remembering that for the future.
     
  TODO: merge-away GroundPOM.fx<-done      
  Another possible enemy type: SPIDERS.  I just evicted one the size of a horse!      
  Added option landscape\POM_LOD      
  Improved the wall POM LOD so you can hardly see it now (although it's very much there and doing a good job).      
  Got rid of GroundPOM.fx (now merged with Ground.fx using uniform variables)      
  Put the ground & wall mipping back the way it should be      
  TODO: ground POM LOD      
24-Jun-2007   8.25    
  Site: Spent far too long (logged) overhauling the release log.  My thinking is that it could be a good source of hits (mentions all the game's features in un-abbreviated form), so it deserves to have nice pictures and links.
Added subdomains http://releaselog.programmerart.org and http://download.programmerart.org, both pointing at the release log.  They don't seem to have popped into action just yet though....
     
  Dev log now links to main page, release log and mailing list.      
  Seems I'm running out of web space?  Had to delete some stuff.  I thought I had a couple of gigs or so, but I must've been wrong.      
  Had a nice idea that the phone box on Windsor Street could be the player's first 'objective'.  You could start the game clutching a rain-soaked piece of paper with phone number on it, and when you dial that number in the phone box you get a nice bit of voice-acting 'business' on the other end telling you what's going on and where to go.      
  Been thinking about audio quite a bit recently.  Would be great to somehow make use of the real location for recording....      
  TODO?: use key choice (WASD/cursors) to guess the handedness of the player?  Is there a way of asking Windows whether or not the mouse buttons have been swapped?      
  Eventually got mesh-material E&C working - eventually!  (in proper words that means I can now edit my scenery materials on the fly).
TODO: find that last little memory leak.  Something to do with effect instance buffers?
     
23-Jun-2007   11.6667    
  Wall POM is now lodded pretty much the same as the original ATi source.  Big speed-up!!      
  Changed the enumerated effects to use CEffect (same as the meshes).  This threw up unexpected device-object-handling hassles; eventually worked out the problem:
-DXUTCreate3DEnvironment creates the device; then the effects get created from this function
-OnResetDevice is called but no-one's home because g_game.pModeStack == NULL
-DXUTCreateDevice tries to reset the device; can't because effects haven't been freed

Shifted effect creation from the device-created stage into the restore-device-objects stage.
     
  DX control panel: 'Break on D3D9 error' works and is reet handy!      
  Direct3D9: (ERROR) :ps_3_0 shader can only be used with vs_3_0+ shader (SWVP or HWVP), or transformed vertices.      
  first frame, CModeEnvironment::RenderEye:
Direct3D9: (ERROR) :Viewport outside the render target surface
Direct3D9: (ERROR) :Clear failed.
     
  Lights can now only be toggled on & off while they're visible in the main draw (ie. not behind a wall)      
#revision 628 Removed a few zbuffer clears that weren't needed.  The main Z buffer is now only cleared in the following places (projectors use a private Z buffer) :
- CModeEnvironment::RenderEye (start)
- CModeEnvironment::RenderSubset (after generating reflection image; TODO: private zbuffer for reflections)
     
  TODO: rain impact frequency should vary according to the downwards rain speed and rain density.  Also try bending the rate of the audio loops to tie in with this.
TODO: varying rain density (scale the cells?)
     
  Decided to get E&C working on the landscape materials, since the recent POM work has been slowed-down by having to reload all the time.  This turned out to be fairly complicated because of all the nice cacheing of effects, handles etc. that I stole from the DX StateManager sample.
Had to change a load of mesh & mesh & material code, but this gave me a good chance to re-familiarise myself with it.  It should be almost ready for the E&C to work now...
     
  TODO: I'll probably spend a large part of tomorrow continuing my spring-clean of the landscape code.  I think there's a lot of stuff that can be merged together (there's two mesh systems there for a start)
- CMesh and CMeshObject
- CMesh::pEffectInstanceBuffer and CMeshObject::bufEffectInstances !
- CMaterial and CEffectInstance
     
  TODO: get E&C working on the landscape materials.  Get POM LOD option working.      
  TODO: if there's any time left over, get cracking on those wall patchworks (this will probably begin with a spring-clean of the patchwork code, but that's not too big or messy).      
22-Jun-2007   2    
  Changed my mind; I don't want to support different mapping scales as such.  If I want to make a texture bigger I'll increase the 'WS Graphic' dimensions on the material.  That provides the parallax PS with the information it needs to offset each pixel's position output.  Tested this on an enlargened version of the 'bumpyDefault' material.
So, to reiterate:
My UVW modifiers should use a width/height/depth of PARALLAX_REFERENCE_TEXTURE_DIMENSION, which is set to the default dimension for the UVW modifier, 1 metre.
     
  For the benefit of shadows, eg BC window pod, the POM offsets the pixels' positions OUTWARDS, otherwise a gap would appear where the wall pixels' depths are <1.  The rest of the POM effect works by pretending the pixels are pushed inwards, but there's no benefit to matching up with that here (the inwards thing is a weak point of POM and a source of artefacts).
TODO: consider getting all these POM surfaces to use displacement mapping on SM4.
     
  POM now influences depth output in WOWvx mode.      
  Shadows landing on the big chunky test walls now join badly with the ground (as they should).  Also the 3DTV depth joins badly for the same reason.      
  I really want to work on something meaty this weekend, rather than tweaking and polishing weather effects.
I want to work on wall patchworks, which lead onto texture patchworks (composite textures, like frozen orthographic patchworks) and, my favourite, posters (text surfaces)!  I'm getting a bit sick of all these untextured buildings with their silly bumpy placeholder walls.  Getting the wall patchwork system in place will let me start texturing buildings, at last.
A great thing about these patchworks is that you can start texturing stuff before the before the modelling's even done.  In the case of the walls, the patchwork texturing will help me mark-out the shapes that need to be modelled later.  A really back-to-front way of working, but I think this will be
loads easier than the conventional way of doing things.
     
  Or should I do the second pass on the shadows?      
  TOFIX: POM changes tonight have caused white depth flickers round the test spheres in WOWvx mode.  Some kind of clamping needed?  I think the same can be seen when very close against a wall (ie. shallow angles)<-FIXED      
21-Jun-2007   3.5    
  Unrelated to the code-signing lark, I also noticed that you can delete any of the game's files (even the exe) and it will put them back when you next run the game from the installed shortcut!  It repairs itself!
Doesn't repair any alterations you've made to files, just restores missing files.
It's something clever about the 'target' details of the shortcut.  You can put a copy the shortcut anywhere and it still works.  Running the exe directly doesn't do any of that.
     
  Removed unused sewage cover textures from graphics\final      
  Running the game from a file:// link, GetCurrentDirectoryA returns C:\Documents and Settings\user\Desktop\
But that's not the location of the exe or the web page containing the link (?)
If you run the exe from a
bat file, GetCurrentDirectoryA returns the location of the bat file.
     
  Running the exe from a Windows shortcut always works fine.      
  Out of curiosity, tried running from a bat file but hardcoding the current directory to C:\noctambule\source\debug.
This found gameroot.dat but crashed in CAnimUser::RestoreDeviceObjects() because this->pMesh->pAnimControllerToClone == NULL
???
     
  Well I don't see how I'm supposed to know where the exe is sitting if GetCurrentDirectoryA doesn't tell me this.  But there's no point wasting time this evening trying to work it out.
I've added a helpful fatal error message that's displayed if you try to run the game from a web link or a bat file.
I'll ask around and see if anyone knows how to find the exe's location.
     
  Shaders.sln - (project settings\FX build rule) optimisations are now enabled even in debug, to prevent the parallax glitch described on the 15th.  Was getting today this when using ctrl-F7 rather than shaderbuild.exe (F5)      
  Decided to get the POM affecting position output, since the flat shadows on bumpy walls had been bugging me for a while.
Slightly more complicated than I'd imagined (simply offsetting each pixel along the face normal according to height is wrong), but it's working now except that it doesn't yet take into account mapping scale.  And I do want to support non-unit mapping scale because it increases texture mileage and works fine with the POM.
Just need to decide how to communicate the mapping scale to the shaders....
<-see 22nd
     
 
 
     
         
  MAX: normals are always exported at unit length      
20-Jun-2007   3    
  Spent the whole evening trying to fix the "Publisher: Unknown Publisher" nonsense on my download dialogue.
Found out a bit about code signing using X.509 publisher certificates.
Managed to generate a test certificate and sign my installer using it, so I'll do that for future releases although you're not supposed to.  This gives a slight improvement: the 'Unknown Publisher' is now a link to the certificate containing some of my details (not sure how to prevent it saying "email: none" though.
I'm also timestamping the signatures using this address:
http://timestamp.comodoca.com/authenticode
     
  (below) Here's what I really want though - is it so much to ask???  As far as I can gather, this would require me to buy a publisher certificate from a certification authority like VeriSign / Comodo / Thawte.  And those certificates cost hundreds of pounds :(  I'm not even sure if an individual can obtain a publisher certificate, although MS's AuthentiCode docs say you can.
If anyone knows a cheaper way of achieving this result, please do get in touch!
     
 
 
     
  EXCEL: seems to set pictures to 150% size when you add them; scale to 75% to get them back      
19-Jun-2007   0    
  Got a failing assert( anaglyphDeghostingPairIndex != EANAGLYPHDEGHOSTINGPAIR_NUM )
when running a network copy of v12.0 via a web link.  Installed locally it worked fine, and I think the network exe worked fine if you ran it directly.
Can't see anything wrong with the code...
     
  Ah, right.  The game just doesn't support launching via a file:// link, simple as that.  Can't find any files if you do this.
I wonder how I fix that?  How do I make the exe always know where it is? 
TODO: investigate
     
Quadro FX 550 On SO's Quadro FX 550, the game crashed trying to create projector RTs.
Reducing numProjectors to 1 fixed this; the game then ran but apparently using software rendering (1fps) (?)
Reducing various render target sizes got it all working properly.
TODO: include a 'compatibility' profile with his settings or similar.  TODO: auto-detection stuff......
I've now replaced the projector RT assert with a more informative fatal error that points the player to Default.txt.
     
  Other than that, I think v12.0 is behaving itself.  Certainly works just fine on my quadro.      
18-Jun-2007   3.5    
  Removed ReflectedDeferredLighting.fx (switched to using a uniform 'reflected' parameter)
The FX file was actually already missing from Shaders.sln and SVN; a 'clean' made this apparent
     
  Removed DeferredLightingNoShadows.fx and ReflectedLandscape.fx
They weren't being used.
     
  TODO: find out whether or not 1920x540 is possible, for WOWvx mode (only a small saving since I'm already rendering to a 960*540 frame RT)      
  After cleaning the shader project and removing the unused effects, the volume lighting bug became consistent, happening from the debugger and in all configs.      
  CProjector::GenerateDepthImages now restores the previous value of CModeEnvironment::s_pCurrentRenderData before it returns.  This fixes the volume lighting bug.      
  Now unsetting unused render targets before generating volume lighting image.
(CLightManager::GenerateLighting)
     
  Removed all the deleted FX files from the installer.  Removed the MAX_ stand-ins from the installer too      
  Spent far too long making a new index screen.      
#version 12.0
#revision 624
Released version 12.0.  Will test this on the ol' Quadro tomorrow.      
17-Jun-2007   12.1667    
  Tried setting up a g_viewInfo.flags.flippedView, to replace the render-category tests in RenderSubset, to control the backface culling mode.
For some reason it wasn't as straightforward as I'd thought.  Will come back and fix this after the build.
     
  Volume lighting is now only generated for draws that include mist or rain (was previously being generated for reflections too).
CLightManager::GenerateLighting
     
  In anaglyph mode:
- volume lighting is now desaturated as required, in GenerateVolumetricLighting.
- the offscreen volume lighting image is now anaglyphic.  Originally this was so that rain could use both views of the volume lighting after the two environment draws, but (see below) now it just gets rid of an RT clear on the second eye.
     
  Ran into the problem that the stereo rain, being drawn after the two scene views, had a z buffer that was only correct for the second of the two views.
Fixed this by shifting rain into CModeEnvironment::RenderSubset where it logically should be (and this went alarmingly smoothly).  It simplifies & tidies things a lot, which I'm pleased about.
The HDR down-scaled scene image used by the rain is now the anaglyphic one from the end of the previous frame.  This is one of the rare cases where a one-frame lag is absolutely fine (I can't even spot it without displaying the RT).
     
  Rain (including its lighting & refraction) is now properly stereoscopic.      
  Started setting effect constants at the 'apply options' stage, where appropriate, which makes a lot of sense.
Added CRainFalling::ApplyOptions
     
#revision 622 Removed option stereoscopy\_3DTV_disparityPower
This was used in my initial quick mockup of the WOWvx format; it doesn't have any place in the actual format.
     
  Example WOWvx profile no longer disables tone mapping (this was a bodge to prevent blackouts on nVidia cards, which now seem to have stopped so I'm marking them as fixed in v12).      
  Added C3DTV (3DTV.cpp&h), which now houses all the WOWvx code.      
  WOWvx mode now follows the format specification in converting from view-space depth, to re-scaled z-buffer depth, to 'disparity'.  This means that walls will no longer appear curved (especially when viewing the screen from a side position).

Realised I could use my near and far effect distances as the clip distances in the disparity formula.
I think last time, I did it more longwindedly, using the actual clip distances and then converting out into the range I wanted - silly!
     
  3DTV: There's now a single placeholder header texture: header_custom.png.  But I've left the texture option in for now (stereoscopy\_3DTV_headerTexture), just in case it could still be useful.  E3DTVHEADERTEXTURE_CUSTOM is now the only valid value.
TODO: generate the header texture using player options.  Adaptive focal point would be real good (focus on the enemy closest to the crosshair if aiming; focus on crosshair collision point if facing a wall, etc).
     
  3DTV: header is now concealed as it should be (drawn with colorwrite=blue)
Current format for the header texture is PNG with header bits in the blue channel and masking in the red channel.  No transparency.
     
 
 
     
  Above: an example of the current depth data in WOWvx mode (ESTEREOSCOPYMODE_3DTV).
(NB: this is not the aspect ratio or resolution used when driving the display.)
Note the characters (right foot) and car connecting properly with the ground.
This grab has not been run through any curves in Photoshop.  The banding is an artefact added by Excel.
     
  SETUP: removed d3dx9_30.dll and d3dx9d_30.dll; added d3dx9_34.dll (system, permanent)
Fingers crossed...
     
  Argh, version 12.0 is halted at the last minute by a graphical corruption bug that's sprung out of nowhere.
The volume lighting image is static junk unless the game is run from the debugger :(
Grr.  Hopefully v12 will go out tomorrow night then.  Much as I'd like to start debugging the problem now, it's getting just a wee bit late...
<-FIXED (18th)
     
16-Jun-2007   8.58333    
  Added option shadows\groundCastsShadows (default = true)
This should probably be considered a 'luxury' option for now.  Need to time all those redraws of the ground.
Ideally I'd use low-poly replacement shadow meshes (just the vertical kerb faces in fact).  Need to find a way of generating these meshes automatically.
Having said all that, these ground shadows don't seem to be denting my framerate at all.
     
#revision 613 Removed PROJECTOR_DEBUG_DEPTH_IMAGES.  It's served its purpose and it doesn't work now anyway.      
  TODO: private Z buffer for reflections (see Projector.cpp)  Saves clearing the main (larger) one.      
  Fixed a bug that was causing ground patchwork decals to draw into projector depth images.
Removed MESHRENDERFLAG_SIBLINGS from MESHRENDERFLAG_DEFAULTS to prevent similar bugs in future.
     
  Updated CardCaps.xls from the June 2007 DX SDK:      
  file:\\C:\Noctambule\Docs\CardCaps.xls      
  It says that quadros can do 16* anisotropic filtering.  So why was this failing (with warning messages) on PC558?
Quadro listed in cardcaps.xls is a 4400....
TODO: get a dxdiag and caps report from PC558.
     
  Patchwork.fx: Set the mipping & filtering back to anisotropic for now.  Need to see whether or not my quadro reports D3DPRASTERCAPS_ANISOTROPY, in order to know what's the best thing to do here.      
  Deghosting is currently broken; checked that this wasn't caused by the colorwrite changes in zombie.fx / vertexcolour.fx.
Ordinary anaglyph is working ok though.
     
  Light marker sprites now appear in both stereo eyes.
(I had forgotten the 'g_game.cameraEye' parameter on 'pCamera->ApplyView' at the end of CModeEnvironment::RenderSubset.)
     
  To get light marker sprites correctly colour-filtered in anaglyph mode, moved the colorwrite restore from ApplyDeferredLighting to RenderSubset      
  HLSL: good habit to qualify uniform parameters with 'const'.
I'm also naming them 'uniform_...' to make it obvious that testing them is free.
Need to remember to test the uniform parameter and not the effect constant itself !
     
#revision 616 The reason the mist wasn't appearing in anaglyph mode was that the mist constants were being set on DeferredLightingApply.fx, not AnaglyphDeferredLightingApply.fx.
Fixed this by converting DeferredLightingApply to use uniform parameters controlling the effect version (normal,anaglyph,reflected) - instead of multiple fx files with different defines.
This allowed me to get rid of AnaglyphDeferredLightingApply and ReflectedDeferredLightingApply.
TODO: do the same with the rest of the FX file variants?  It's much neater, and the cost of switching the effect version is totally negligable.
     
  Collision.cpp: added IntersectLineCircle      
#revision 617 Made the mist properly stereoscopic (CMist::Generate).  It's great!  It strengthens the illusion of 3D by adding three layers of moving depth information.  Hopefully the rain will strengthen it further.
Tested stereo mist quite thoroughly.
     
  Light marker sprites now honour the 'sterescopy\saturation' option (was this the case in v11.1?).
CLightManager::DrawPlaceholderLightObjects
     
  Fixed zombie sphere-frustum culling (wasn't using correct centre point).
Also removed CZombie::visible.  It wasn't being used and it was misleading (it was set on every TestVisibility, even when drawing to projector depth images).
Added '#enemies in main draw' debug display; checked that the zombie sphere culling is correct.
TODO: zombie cullplane occlusion!!
     
  TODO: stereo falling rain <-DONE (17th)      
15-Jun-2007   2.75    
#revision 609 Trying to copy the whole Noctambule folder back from a DVD made at the office wasn't a great idea.  Looked like it was taking forever to just to get through all the pngs in the rain streak database!
I need to just transfer the folders I've changed.
Transferred Source, Profiles, and Docs
     
  Chcked that all the adjusted code I brought back from the office still works on my April 2006 DX SDK      
  Installed the June 2007 DX SDK.  Nothing new in the samples really.      
  Had a quick look at the open-source web tools at http://www.drupal.org/
TODO: Give them a try when I come to overhaul the site?
TODO: Also need to try Flash, which is likely to be a good thing to use.
TODO: Find out about making web pages using Photoshop
     
  Got rid of ESHADEREFFECT_GROUNDREFLECTION, GroundReflection.fx, totally OOD      
  Got rid of ESHADEREFFECT_PATCHWORKDIMPLEHEIGHTCOMBINE      
  TODO: in the replays, do that shot where you just see the monster's grotesque shadow creeping along a wall, you don't see the monster itself.
Also do the 'monster sneakup cam' bwahahaha!  It's going to be so much fun coding the 'cinematography' for these replays.
The replay system will be very useful for making gameplay videos too, and for benchmarking / optimising.
     
  Well, with the June 2007 DX SDK, with optimisations disabled on the fx compilation ( /Od ), my POM is broken (ground and walls in pretty much the same way).  I thought normally things broke when you switched optimisations ON?!
Doesn't matter a hoot though; I've now removed the switch in ShaderBuild.cpp.
If I'd been outputting and source-controlling the disassembly text like I used to, I'd be able to see what the difference was...
     
  TODO for version 12 (to be released this weekend) :
- deal with mipping/filtering (anisotropic) stuff
- deal with colorwrite (MRT) stuff
- ensure anaglyph modes still work (colorwrite)
- fix WOWvx mode (new header, Z-to-depth, depth-to-disparity)
- scratch head over HDR\finalMultiplier (quadro) discrepancy.  Need to check a 7900 or similar.  Should have tested floating-point lighting RTs on the quadro but forgot.
     
  THEN, get the basic replays working so I can record some "rain tech" videos ??  Like all the cool kids are doing? ;P
Also get the ground water velocities working (more urgent I suppose).
     
14-Jun-2007   2.66667    
quadro, PC558,
April 2007 DX
Had a dream that I was Captain Picard.  Shouted at an office full of people, then talked to Counsellor Troi.  Woke up feeling confident and in control.  Need to do that more often.      
  Severe rain this evening, so I put the camera on charge and bought some cling-film.  But as usual the rain stopped before it got dark :(
Had a good look at it though, and I definitely feel I'm on the right track with my rain effects.
- Streaks and impact splashes and were pretty much like mine.  Impact splashes were a bit smaller, maybe a bit more densely packed, and had a better draw distance ;)  As the water got deeper, there was more in the way of vertical spikes maybe 3-4" tall.  Maybe you wouldn't see these if it was windy.
- The flowing across all the ground looked spookily like my current rough version.
- Very non-binary puddles, same as I'm going for now.
- Lots of water-in-the-eyes.  Drips gather on the eyebrows & eyelashes (big blurring towards top of view especially) and drip off now & again.
There wasn't any real wind to look at unfortunately.
     
  Fixed the reflection glitches (freezing up/cutting-out, see yesterday) :
In CAnimMesh::DrawMeshContainer, the block at the end that draws non-skinned sub-objects was somehow causing it.  This would have been used for the zombies' eyeballs, which have not shown-up in game since like version 3 or something.
Checked that it wasn't just the SetTransform(D3DTS_WORLD, ...
     
  W00T! The fix above also fixes the bad zombie normals!! ^_^  I think that's actually the last of the quadro bugs!      
  shifted a zbuffer clear in CModeEnvironment::RenderSubset.  Shifted it to just after GenerateReflectionImage.
IS IT NEEDED?
     
  TOFIX: suspicious stutter every couple of seconds      
  Version 12 is very close now :)  ...Thank goodness; v11 looks really out-of-date now, without these weather effects.      
  Checked that a Master build works ok.      
  It started raining again after midnight, so I got some photos & videos around Bedford Court.
Cling-film worked ok for waterproofing, but got very blurred by the water.  Maybe try the umbrella next time:
     
  file://C:\Noctambule\Photography\Reference\14_6_8_wetShoot      
13-Jun-2007   3    
quadro, PC558,
April 2007 DX

Spent two hours (not logged) investigating a possible shader effect that would displace surface detail in such a way as to follow the curves implied by smooth vert normals.
Couldn't see a good way of getting the required information into the PS (face normal, UV offset from face centre) without breaking the stripping.
Other than that it looked like it would work.
     
  Fixed the bulk of the shadow junk by setting the backface culling mode depending on whether or not the view is flipped.  TODO: g_viewInfo needs to precalc and store this.      
  W00T! As a result of the fix above, managed to get PROJECTORSHADOW_DEPTH_BIAS down to 0 !!!      
  Projector.h:  changed PROJECTOR_ORT_FORMAT to a float format because the Quadro somehow didn't have enough depth precision for the shadows otherwise.  16Fs work fine.  NOTE: only red channel required.

Tried R32F but the quadro couldn't do it, wanted to switch to reference.
     
  TOFIX: looked as if road lines etc were rendering into projector images?!!!! <- FIXED (16th)      
  ZBUFFER JUNK:
- Only happens when characters are allowed to draw.
- Only appears on characters, cars and the sky
- happens even if zbuffer is cleared before drawing the thing (eg. player)
- happens even if zombie.fx and vertexcolour.fx use ztest ALWAYS

NOTE: no E&C on vertexcolour.fx

**** SORTED! ****
had to set
COLORWRITEENABLE = RED | GREEN | BLUE | ***ALPHA***;
in zombie.fx.  Otherwise the mistmatch causes a silent MRT failure on quadro.
Previously COLORWRITEENABLE wasn't getting set at all.

Made the same change in vertexcolour.fx for safety (otherwise I think it's relying on draw order).

***TODO***: make this change more global and anaglyph-friendly (currently I think it'll break anaglyph)
     
  TOFIX: reflections are flicking on and off on quadro, also occasionally freezing.  doesn't seem to have been caused by the fix above.
- happens even when paused (?!)
- happens with or without projectors
- only happens when characters are allowed to draw to the reflections
- remming-out the DrawFrame call in CAnimMesh::Render prevents it

<-FIXED (14th)
     
  TOFIX: zombie normals are coming out a bit wrong on quadro<-FIXED (14th)      
  Had to set HDR finalMultiplier to 1.f (rather than 2.f) on quadro to get it to look right(?)  Looks exactly right at 1.      
12-Jun-2007   4.666 6.30->  
quadro, PC558,
April DX SDK
Had to rename any shader functions called 'PixelShader' or 'VertexShader'.      
  Fixed the following error by using the [unroll] attribute:      
  C:\Noctambule\Source\HLSL\RainLighting.fx(109,13): error X6077: texld/texldb/texldp/dsx/dsy instructions with r# as source cannot be used inside dynamic conditional 'if' blocks, dynamic conditional subroutine calls, or loop/rep with break …      
  ... "These issues will be fixed in a future release of the SDK.
If you have a loop in your pixel shader, and the compiler generates error X6077 where it previously did not generate this error, try one of the following work arounds:
- Change the loop to the form for(int=0;i<cnt;i++)
- If possible, unroll the loop using the [unroll] attribute."
     
  Noticed some bizarre white pixels on the rain lighting image.  Fixed these by adding a 'max' to the returned RGB of DeferredLightingApply.fx (rain splashes).  A negative colour was being output because of the bit where the pixel's diffuse lighting colour is normalised (normalising black causes a db0).      
  Fixed the following errors, by changing anisotropic filters to linear.
Changed mips to NONE though; linear mipping on the road lines comes out bad.
Debug D3D, Patchwork.fx, FindNextValidTechnique:
NOTE: I'VE PUT THIS BACK TO ANISOTROPIC FOR NOW.  NOT SURE WHAT THE BEST THING TO DO IS.  DEPENDS WHETHER OR NOT MY QUADRO REPORTS D3DPRASTERCAPS_ANISOTROPY....
     
  … Direct3D9: (ERROR) :Unsupported mag filter.
Direct3D9: (ERROR) :Invalid texture sampler state value. SetSamplerState failed.
Direct3D9: (ERROR) :SetSamplerState failed.
First-chance exception at 0x7c812a5b in Noctambule.exe: Microsoft C++ exception: long at memory location 0x0012c9c8..
(etc)
     
  TODO: fix this?:
"Direct3D9: (WARN) :Stream 0 stride and vertex size, computed from the current vertex declaration or FVF, are different, which might not work with pre-DX8 drivers"
     
  Fixed the following, by changing SFallbackShadowVert.  TODO: test the 'lightPos' member now (see shader) :
"Direct3D9: (ERROR) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD,0) does not have corresponding usage in the current vertex declaration"
     
  (search for remmed-out 'V's on 'DrawSubset')
TODO: fix this:

"Direct3D9: (ERROR) :Vertex shader function usage (D3DDECLUSAGE_COLOR,0) does not have corresponding usage in the current vertex declaration"

drawing patchwork decals:
- roadDecal_johnStPatch
- bcPavement
- bcCarPark

drawing normally:
- Box06
- Box08
...
     
  zbuffery wierdness only happens when characters are allowed to draw.
Only appears on characters, cars and the sky
     
  TODO: why are the sewage covers not glinting properly on Quadro?  Because I turned mipping off?      
  Shadow junk is a backface culling issue.  No idea why it should be different on different machines.  But in theory I need to work out whether the view matrix is flipped or not, for each frustum face, to know which backface culling mode to use.      
  Maybe there's a difference in zbuffer precision (actually it does look that way), and it's working on my card by fluke?  The 'big white light' does show problems on my card....      
11-Jun-2007   3    
  Spent far too long getting a background image onto the front page of the site (+ lecauchemar.com)
Had to increase the 'target schema' to IE 5 for this (was on 3)
     
  http://lecauchemar.com      
  Got rid of some old data from the devlog file properties, which were showing up in the HTML: company name.      
  Improved the rain textures, and I'm more-or-less happy with them now.  It's glinting better and it has a nice motion blur.  Also tweaked the shaders; removed a couple of bodges now the streak texture is better.
Need to stop fine-tweaking now, it's taking up too much time.
     
  At the moment, I'm averaging about 50/60K rain triangles per frame (7 cells).  I'll put in timers before too long...      
  Downloaded a database of rain streak photos from cs.columbia.edu.  Interesting to see, but not directly useful for me as textures like I was hoping.      
  TODO: try breaking-up that mist texture      
  TODO: improve wind      
  TODO: is there some kind of lengthening I can do on the fallback shadows...?  Would need to take into account distance from the caster (no stretching at the point where the 'shadow' meets the ground plane)....      
10-Jun-2007   10.166    
  Decided to get the rain celled-up & moving before coming back to finish the lighting.      
 
Began by thinking about how to sync the falling raindrops with the rain impact splashes, since this could affect how I cell-up and move the rain.  A few possible approaches:
     
  1. Basically make the falling rain match the existing impact effects.  Arrange the raindrops into columns with an XZ area of 300*300 to match the impact tile.  Impacts are read from a LUT matching the falling raindrop positions.
Disadvantages:
- Rain cells would be smaller than I'd like; might be able to spot spatial repetition.
- Impacts would be temporally repeating
- Impacts would only match at the ground plane!
- Forces impact splashes to slide along the ground to match the rain movement; don't know exactly how this would look yet
     
  2. Completely new rain impact effect made by redrawing the falling rain triangles with different shaders.  Pixel shader tests the position buffer to form a splash as the triangle hits the scenery.
Disadvantages:
- I'd be starting from scratch again
- I'm reluctant to draw all those rain triangles again (or most of them; maybe upper cells could be skipped)
- How's each splash image going to be formed to account for view angle?  That was hard enough the first time.
- probably more expensive than the existing splash effect
     
  3. Use the existing impact effect, but replace the planar-mapped impact dots with 'proximity spots' on falling rain triangles.  The pixel shader tests the position buffer to generate a circular dot where the triangle is close to the scenery.  This then goes through all the same extrusion, lighting etc that I'm already using, to form a splash.
Disadvantages:
- Argh, the impact ripples won't match the impact splashes :(  That's no use.
     
  ...Nah, beats me.  I can't see an affordable way of making these raindrops match with their impact effects.
Doesn't actually bother me though; I don't think it'd be very noticeable anyway.  And I certainly wouldn't want to compromise the quality of the falling rain, or the impacts, to get the two to match.
     
  Got the rain celled-up & moving.  Looks great, and really completes the scene.
The fact that the drops don't match-up with their impact effects is pretty-much un-noticeable as expected.
     
  Gave the rain a touch of constant grey which really helps it in the darker areas (same as I did with the mist).      
  NOTE: In an array of VEC3, the elements are not 16-byte aligned.  The spacing is 12 bytes which is sizeof(VEC3)      
  Arranged the rain cells into a spheroid formation.
Now drawing back to front.
Now culling cells below the ground effect plane.
Streak texture now scrolls properly.
Refraction now decreases with distance from viewpoint.
     
  Added RainLighting.fx which forms the rain lighting image by blurring an HDR scene image and adding the volume lighting, onto a tiny 2TTT render target.
This lighting image works well.  Also removes a texture sample from RainFalling.fx (background and volume lighting are now combined into this new image).
     
  Improved the glintiness of the rain by brightening the refraction according to the Y normal.      
  TODO: Improve rain streak texture a bit.  Smaller/blurrier alpha?  Motion-blur the alpha?  Less crinkle-cut.<-done(11th)      
 
       
9-Jun-2007   9.833    
  HLSL: sampler_state: the brackets around the 'Texture' property value are manditory.  Why is that?      
  Got some practice at using paths in Photoshop.      
  (below) Got the rain textured and lit in a rough form.  Still trying to get the lighting right, not there yet.  There's a distinctive glinting I want to see when the drops pass close to the lights.
Refraction is offset down on the Y slightly to reinforce the rain impact splashes (eg. looks good on the cars).
TODO: separate rain-lighting image (MRT this in with the mist lighting to prevent duplicated shader work?)<-done(10th, RainLighting.fx)
TODO: give rain impact splashes the same refraction as the falling rain?
TODO: take into account player's angular view velocity when stretching the rain
     
 
       
8-Jun-2007   3.25    
  Got the rain triangles properly shaped & angled by the vertex shader.      
7-Jun-2007   4    
  Added CRainFalling (RainFalling.cpp&h), the main falling rain effect.  I'm reserving the name 'Rain.cpp&h' in case I need a rain manager or general rain code of some sort later.  Besides, CRain would be a bit of a vague name for any of the rain effects, even the main one.      
  Used a new neat format for RainFalling.fx, which I'll use for new HLSL effects from now on.  Till now, the effect files have been a wee bit messy, but I expect I'll do some tidying when I do my compatibility+optimisation pass (hopefully soon).      
  option weather \ mist now works properly.      
  Added option weather \ rainFalling.      
  Got the rain geometry drawing, currently just a bunch of simple triangles (lots, roughly a zillion).
This is the first effect of mine that uses a D3D vertex buffer.
     
6-Jun-2007   4    
  Decided not to persevere with the current flukey ground spray effect.  I'll hopefully come back later and do a proper one instead.      
  Also decided not to get too tied up with wind / mist turbulence just yet.  It's a bit robotic-looking at the moment but I'll get a better idea what it needs once some other effects have gone in.      
  So then - next weather effect.  And it's probably the most important one: falling rain.      
  Planned the falling rain.  Looked at a lot of reference.
I'm keen to avoid the familiar imperfections of the old-fashioned rain techniques (ie. I don't want to be followed around by some kind of 'scrolling lamp shade').
The current plan, stupid as it sounds, is to pour a zillion little triangles through the view frustum.  These will be batteried into huge triangle lists that don't require any update from the CPU.  All the wizardry of shaping, angling and texturing the triangles is done in the shaders.
This approach has a bunch of advantages; one of them is that I should be able to sync the falling raindrops with their own impact splashes & ripples !!!!<-(or not, 10th)  It will also play very nicely with stereoscopy, and bullet-time if I have any.
Got a plan for the texturing too that should look just right....
     
5-Jun-2007   2.75    
  Fixed a very slight (but annoying) brightness glitch that could be seen each time a mist sphere wrapped around on the Z.  Just had to increase the minimum sphere scale a bit.      
  Fixed the crazy polys over the screen in Master (silly mistake in GenerateVolumetricLighting).      
  Had a go at lighting the ground-level spray.  Bit more work needed here; not convinced yet that it'll be usable.
The waves of spray are a fluke effect, and I expect something deliberate will work better instead.
TODO: try a second pass in VolumeLighting which lights the spray with a single colour (no influence from the lights).
     
  TODO: consider diffusing specular highlights (or something) into the mist lighting image.      
4-Jun-2007   4.25    
  Added option category Lighting.
Added options:

weather \ mistLightingRTFavourFloat
lighting \ RT
lighting \ RTFavourFloat
lighting \ RTForceFloat
     
  Got the Z movement of the mist all working properly, tied into the wind and player movement.  The whole thing looks pretty convincing now; I'm reet pleased with it.  As well as being really valuable in this game, it's a handy effect to have in storage for the future.
Had to go up to 3 cubemap samples per pixel; 2 didn't quite cut it.
At ground level, there is now a pretty good rendition of those waves of spray you get during high winds and heavy rain (almost like sea spray).  TODO: try giving these some kind of lighting? (currently they're invisible because there's no mist lighting at ground level)
     
  Tidied render target setup (some were getting set up in Main.cpp rather than Options.cpp).      
  Got weird nonsense polys over the screen in Master.  This is new.  TODO: FIX THIS!!!<-FIXED(5th) (silly mistake in GenerateVolumetricLighting)      
 
 
     
  above: rain mist.  Not an effect that particularly likes having its picture taken; you have to see it moving.  The banding is an artefact added by Excel - it's nice & smooth in-game.      
  Mist lighting now uses 2-10-10-10 if available.  Otherwise, it uses float16s if weather\mistLightingRTFavourFloat, else 8888 (which I already know is usable for this effect).      
3-Jun-2007   5.25    
  SVN: Used 'update to revision' on the Noctambule folder and found it caused Noctambule.sln to lose its project.  This has happened before I think.
<-need to close visual studio when updating to an old revision
     
  Fixed the blockiness of the mist silhouettes, by reluctantly shifting the mist generation into DeferredLightingApply.
There is still a teeny bit of blockiness, from the volume lighting, but I can certainly live with it.  Anyone with frame time to spare can remove this remaining blockiness by setting weather\mistLightingRT to [/1].
     
  Lights can now be toggled on & off by shooting at them.  This is stand-in behaviour till you can shoot them out properly with weapons.      
  TODO: Exposure control becomes a lot more relevant now that the lights can be switched off.  Need a fix for the nVidia cards in v12.      
  Devised a means of blowing the mist into and away from the viewpoint (as well as just across).  Looks fantastic.
TODO: hook this up to the wind-minus-camera velocity.  Add a numMistLayers option?<-done(4th)
     
2-Jun-2007   7    
  Got the latest ATI Catalyst control stuff installed; it had sorta gone missing.  v11.1 is quite silky with the overclocking turned on.      
  Downloaded ATI GPU analyzer thing and CubeMapGen.      
  CubeMapGen: Z- is FR, Z+ is BK      
  Set up a Tools\CubeMapGen folder, containing the CubeMapGen example project which I'll extend to do whatever I need from it.      
  Tried using the ordinary CubeMapGen.exe in command-line mode.  Couldn't get it to import cube face textures; tried all sorts.      
  VolumeLighting.fx: now using squared falloff      
 
 
     
  Above: a lit mist image before it's blended into the scene.  Looks nice when it's blowing around.  The two parallax layers give a good impression of volume.  Texture is a bit solid in this example; TODO: try breaking it up using vertex colour on the cube map sphere in Max.      
  MAX: found out about reflect/refract maps, which render cube map faces for you - cool!  Saves me getting my hands all covered in MaxScript.      
  Got a beautiful cube map result from Max's 3D smoke map after playing with the parameters a bit.  Inverted smoke colour works really well for this mist, similar to how I was using Photoshop minimum filter before.  Makes it wispy.      
  file:\\C:\noctambule\graphics\smoke\smoke.max      
  Started dealing with the blockiness of the mist silhouettes....      
  TODO: maybe try directional lighting on the mist.  Copy unlit mist image to a small RT and generate normals from that.<-nah, looks fine without it, and I've got better things to spend my frame time on      
1-Jun-2007   2.75    
 
Got the volume lighting working on the mist, very nice.  Even the volume lighting image on its own makes a decent fog effect (below).
It definitely pays to think of fog/mist as a way of lighting the atmosphere, rather than a cloud of grey muck in the background.
     
         
  above: volume lighting image used by the mist, will also be used to light the rain and drips.      
  Noticed some accidental colour dispersion in the mist around some lights
TODO: should be easy to add deliberate dispersion in VolumeLighting.fx
     
  TODO:
- tweak mist lighting/blending<-DONE
- deal with ugly colour clamping in the mist lighting<-DONE (by moving mist stuff into DeferredLightingApply)
- fix blocky mist silhouettes? (might be too expensive to fix this)<-DONE (by moving mist stuff into DeferredLightingApply)
- fix mist texture(s), even if still just a placeholder<-DONE (by moving mist stuff into DeferredLightingApply)
- improve wind.  Wants to be more blustery.  Maybe something needs to be done in the VS/PS to make it more swirly, less cohesive.  Need to think about how the blustering rain is going to tie-in to the mist wind (maybe wait till the rain has gone in before tweaking the wind?)
     
30-May-2007      
  Went (well, crossed the road) to see 28 Weeks Later.  It was research!
Mmmm, that music would be great to use in a teaser video, I can see it now....
     
29-May-2007   0.5    
  Busy sorting holiday-related stuff.      
  Got another one of those lockup-reset crashes, similar conditions as before, game running in debug (windowed), behind maximised windows:
"Error Message: STOP 0x000000EA THREAD_STUCK_IN_DEVICE_DRIVER (Q293078)"
Tried to get latest Windows updates but this crashed explorer.exe.
     
28-May-2007   10    
  Added option weather\wind (true).      
  Added CWind (Wind.cpp&h), the wind controller.  I'm going to keep this nice and simple.  Currently just updates a single velocity vector, and I think that's all I should need.      
  Added CModeEnvironment::timeRunning, which should be used as the timer for all environment features.
This pauses when the game is paused.  It will reset to zero at the start of the replay.
     
  TODO: Use the mist (recoloured) as a dream effect for the intro.  This can fade seamlessly into the game.      
  Finally worked out why I have so much trouble with vertex formats:
VEC3 is 16-byte aligned.
Add 4 bytes of explicit padding after any VEC3 in a vertex structure (or better, pack something useful into the gap).
Use D3DFVF_XYZ
W with a VEC3.
Use D3DFVF_TEXCOORDSIZE
4 with a VEC3 (NOTE: still couldn't get this to work)
Never use D3DFVF_NORMAL with a VEC3.
Never remove the alignment from VEC3.
     
  Got the mist moving fairly nicely, more to do.      
  Mist lighting going well      
  TODO: fix up vertex formats, finish mist lighting      
27-May-2007   6.75    
  Added options weather\mist (true) and weather\mistLightingRT (small).      
  Moved the PC into a quieter room, which is loads better.  Can't hear my neighbour any more, yelling out of his window at passers-by, like a dog barking at other dogs.  That's the reason I got no work done yesterday - couldn't concentrate, and ended up in a terrible mood because of it.      
  Realised that the HDR system doesn't contain the data I need to light my mist (+ rain etc).  The luminance images are mono and I couldn't get anything but constant solid colour out of them anyway; dunno what I was doing wrong there.
So instead I'm going to form a small volumetric lighting image (ERENDERTARGET_MISTLIGHTING), and probably mix the HDR bright pass onto it.  Not going to think about shadows just yet...
     
  Added CMist (Mist.cpp&h) which controls the mist effects.      
  Devlog: Stopped jotting-down French vocabulary.  It was a useful place to put it, but with the devlog being public and all...dunno, looked a bit like weird haikus or something.      
  Added CNoise (Noise.cpp&h).  Ported from ATI SDK (perlin.cpp)      
  Got static mist in, already looking nice & eerie.  Currently using a 360x180 panorama texture.  A cube map would be quicker to look-up...TODO: see if a cube map would be worth the hassle (and seams).  If not, use that ol' vertical spherize (Photoshop) trick to remove an atan from GetPanoramaUV.      
  TODO: pack a different layer of mist detail into each of the texture's colour components<-not needed now, with the zooming system      
  TODO: get that mist a-swirling      
26-May-2007   4.5    
  More little improvements to rain splash lighting.  The normals now rotate according to the XZ view direction.      
#revision 550 about to start on fog/mist.      
  MAX: Grr, 3D maps display as 2D maps in the viewports.  Have to render to see them properly.
Is this a problem caused by the DX SDK trying to be helpful, or does Max just have no way of drawing them properly in real time?
     
  Tried Max 3D maps (on a sphere) to see if they'd give me good smoke cubemaps.  Couldn't get anything inspiring out of them.      
  Read up on some stuff on the Internet.  Started work on the mist.      
25-May-2007   4    
  Improved rain-splash lighting.  Made the lighting and the normal-generation much cheaper.      
  Remembered that deferredLighting.fx is THE most speed-critical pixel shader in the game.  Simplifying its rain-splash lighting gave a noticeable speedup.      
  Accidentally fixed the fluffiness of the rain impact splashes :)  They now look like proper rain spatters rather than lumps of cotton wool.  I'm no longer embarrassed to see them.
The gist is that their brightness is now weighted by the 0-to-1-packed z component of the splash normals (complete accident).  This gives the droplets that important bright outline effect, and it also hollows-out the shape of the splash.
     
  Experimented with a refractive version of the rain impact splashes, but it didn't look like it was taking me anywhere.      
  TODO: Looks like the fallback shadows are a frame behind?  Something definitely is, stand at the start point and look around, look at the ground highlights.      
24-May-2007   1.83333    
  Oops, v11.0 looks for fxo files in C:\noctambule\....  That's not going to work.
It was UtilCreateEffectFromFile.  Must've been a temp test I put in when shader E&C started playing up?
MUST ALWAYS TEST BUILDS USING A RENAMED C:\NOCTAMBULE FOLDER!!!
     
  v11 also had a few missing fxos and some weird duplicate texture entries, now fixed.      
  TODO: Find out why the lightsource sprites sometimes don't appear.<-hopefully that was the paths bug in v11.0      
#version 11.1 Released version 11.1.  Practically the same as v11.0 but without the startup crash.      
23-May-2007   0    
  got a blog at blogspot.com.  Just experimenting with it to see if it could be used for the devlog.      
  started a free trial of the non-public extremetracking.com tracker.  about £36 per year      
22-May-2007   3.25    
  Turns out the rain deadline in a week or so isn't THE rain deadline, which will be around October.  Just as well really!
This one's just a sorta progress check.
     
  Got a weird sudden black-screen lockup while the game was in a window, behind a maximised Visual Studio window.
Media Player was playing chunky wavs, if that's relevant.  It went into a buzzing sound.
     
  Rain impact splashes are now plotted in the correct positions, so they now match up with the impact ripples.
Previously most of the impact dots were going off-viewport.  This is because I had been pretty sure the viewport width was always the same as the display width regardless of RT dimensions.  Seems now this isn't the case; the viewport dimensions in GenerateImpactImage are the RT dimensions.
Halved the number of particles because it was very dense after this fix.
     
  Puddle ripples no longer move with the viewpoint.      
  Reflection lag: Fly cam only; I think it's the the ground plane data that are 1 frame behind.      
  Decided to leave the existing rain effects in their current rough state while I add the rest of them.
I reckoned it's better to have a full set in place so that I can get a feel for how they'll play together, which ones are most important, etc, making it easier to tweak and budget them.  It'll also look more impressive at the rain deadline to have a full set of rough effects than to have a partial set of polished ones; I'm sure of that (it's just like a painting).
     
  So then, next weather effect:
Start at the back. 
FOG / MIST.  This'll add a huge dollop of atmosphere & motion (includes wind).  Strongly tied into lighting too, as mentioned in the brief for the weather effects.  It's a good'un.
If it weren't for the deadline in a week or so, I'd probably do swaying streetlights first, but they're not as impressive to look at.
     
  FOG / MIST: Remember:
- wind
- parallax
- directionally lit
- diffuses the bright pass
- etc
     
  TODO: dimple normals influence puddle flow direction?      
21-May-2007   0    
  Site: Added the hit-tracker back (same login etc).  I think the script/ActiveX security message only appears if you view a copy of the page on the local machine.      
  TODO: Find out why the lightsource sprites sometimes don't appear.<-hopefully that was the paths bug in v11.0      
20-May-2007   6.33333    
  Lights now inherit from CNameUser and read their names in from the nwf.
IMPORTANT: CNameUser only holds a name string in DEBUG.
     
  CAUTION: when flipping a CullPlane, be careful not to flip any child objects with it!      
  Lights no longer use CullPlane exclusions.  It was causing some mis-culling of the BT lights (when viewing from behind the west BT wall).  The exclusion system is really just designed for buildings anyway.      
  CullPlanes: Removed upper plane bounds check (so the planes now extend upwards to infinity as well as downwards).  Might not be permanent, but it's great for testing cullplanes from a birds-eye view.  It also helps to cull the tops of streetlights.
TODO: reshape streetlight bounds to better match their (TODO) projection mask.
     
  Tweaked lighting again.  Found BRIGHT_PASS_THRESHOLD (HDRLighting.fx).
Disabled tone-mapping for now, because it's broken on nVidia cards.
     
  Added lights on Windsor Street and Windsor Place.  So in version 11 there's a figure-of-eight to explore.      
  Found that the north John Street test kerb paint had lost its 90° rotation round the spline (???)  Now fixed.      
  TODO: put one of those fancy drag-around maps of the town on the site (see Google Maps)      
  CullPlanes referenced by meshes & lights now work in non-debug builds (previously they were only holding a name in debug builds!)      
#version 11.0 Released version 11.  Plenty of things wrong with it but it's more impressive than the last build.      
  Stopped supporting the English-language installer.  Too much hassle for no real benefit.      
19-May-2007   7    
  Fixed the log converter (doubled the size of its text buffer, now 2 meg).      
  Decided not to make the buildings children of ground chunks.  It would make it awkward to change the chunk size or to use ground sub-objects.      
#revision 538 C:\3dsmax6 is now under version control.  Can't risk losing/breaking all those little scripts, plugins, settings files, etc.      
  Max: PointLight: now has a CullPlane property like NoctambuleScenic.
Got this working in-game.
     
#revision 540 Max: Macro_ObjectsLights.mcr: removed all references to an 'AmbientOnly' property that my PointLights don't seem to have (?)  Or that isn't accessible in quite the same way (?)
Prevents MaxScript error(s) when doing 'unhide all' with a PointLight selected.
     
  Max: PointLight: now has a 'Reverse CullPlane' option so that the 'facing' cullplane has to be backfacing for the light to draw.
Added this for the lights on the north side of Regent Street; couldn't see another good way of culling them because their ranges are too big to be blocked by the cullplane on the John Street side of those buildings.  They now require that cullplane to be backfacing (they start drawing as you approach Katie's Kabin / Voodoo).
     
  Windows: Changing 'theme' in Display Properties resets the 'sound scheme' to the default.  Sound schemes aren't saved with the themes either.  So any time I change my colours to read some text, I have to go and switch off all the default sounds.  Then I have to switch them off again after changing my colours back.      
  Had some CullPlane bugs, started fixing them
TODO: FINISH THIS!,<-cpRegentNorthWest was facing the wrong way, duh.
RELEASE v11
     
18-May-2007   0    
  Planned a field trip using Expedia.  This has been on my todo list since 10.1.6 (the 500-hour mark)      
17-May-2007   4    
  TODO: need to incorporate collision mesh generation into my pipeline.  At the moment, CLandscape::GetGroundHeight is spinning through up to 16,160 triangles per call.  The rejection is very efficient (four-or-less int compares as a bounds check), but still...      
  CLandscape::GetGroundHeight now just uses the first triangle it hits rather than finding the highest one (what was I thinking there?!)      
  Trying to fix this collision problem (Regent St. south pavement):
- not using D3DXComputeNormals; that rules out bad normal extrapolation.
- All outer edges of the collision mesh are showing collision faults (only some tris though)
- removing the triangle bounds check makes no difference
- when it fails, it's not hitting any triangle
<-Oops, I was still using some unsigned shorts despite having changed to 32-bit vert indices recently.  Fixed now.
     
  added functions Vec3Abs, Max3      
  Still had a few tiny 'cracks' in the collision.  For example:
At these coords, 'alpha+beta' in IntersectVerticalRayGroundTriangle was 1.0431895554065704
X: -11432.433
Z: 3418.2939
Now changed the function to to compare alpha+beta with 1.0666f (1+ALPHA_PLUS_BETA_MARGIN)
Haven't seen any problems since.  If the problem shows up again I should check the details of the triangle(s) involved...
     
  Max: Added a cutter object that removes the undersides of the pavements.  This was needed now that the ground collision returns the first hit rather than the highest one.  It also removed 3225 unecessary ground triangles.      
  Version 11 is developing nicely.  Will release this soon.  Exact date depends on when my rain deadline is.      
  TODO: work out why the north-side Regent St. buildings can cut out at certain viewpoints.  CullPlane problem?<-the cullplane wasn't a child of the building as it needed to be      
16-May-2007   3    
  Added lights and kerbs on Regent Street.  Editing in Max was painfully sluggish for some reason, but other than that the construction process is working well.
CullPlanes are working well too.
     
  TODO: work out why collision is failing on that south pavement<-fixed (17th)      
15-May-2007   2.666    
#revision 531 Tracked down yesterday's Max crash.  It was the #ifndef, #define, #endif wrapper in NoctambuleInclude.fx (#included from Patchwork.fx in version 528 which caused the crash).
I have no idea why it would cause a problem; fxc never mentions it when I compile.
It doesn't actually need to be there, so I've removed it now.
I think I'll get out of the habit of putting those wrappers into hlsl headers now.
I'm very glad that header was version-controlled!!!
     
  Working on puddle improvements still.  Looking nice.      
  TODO: add loads more lights now!!  They don't have to be in the right places yet, just need to get the right sorta number of them so the lighting will be more realistic.<-done (16th)
This will open up Regent Street for v11, w00t!
     
14-May-2007   1.666    
  Parallax.fx, ground.fx: Removed g_vTextureDims, not needed now.      
  Improving puddles.  Making them less binary.      
  Max started refusing to open the town (crashing).  Luckily version 507 loads fine (after rolling-back the whole Noctambule folder)
TODO: find the latest working revision.<-all sorted now (15th)
     
  Took down the brightness on my monitor quite a bit to make it more like the one at work.      
13-May-2007   7.08333    
  Max: Schematic view: 'include only visible objects' seems to be broken at the moment; shows me just six loose objects and nothing else (?)      
  I'm finding that POM heightmaps benefit from being halved in res; makes the protrusion edges work more easily.
Also makes the surfaces look wetter (gives the impression of water surface tension I suppose).
     
  REMEMBER: No E&C on patchwork.fx!!  Still don't know why.      
#revision 527 Reached a workable compromise with ground POM: only patchwork height is now used.  Dimple parallax was doing too much damage to the kerb/kerbside texturing.  Cleared away PatchworkDimpleHeightCombine.fx; last revision it appears in is 527.      
  Ground.fx: now using a better (hopefully correct) view vector for PSGetPOMTexCoords.  This removes the squidging I was seeing when close to the ground, phew!      
  Added option Landscape\groundPOM.  Default = true
Added option
Landscape\groundPOMMaxSamples.  Default = 8
     
  Added GroundPOM.fx (just defines GROUND_POM then includes Ground.fx)      
  Got the puddles refracting (ground.fx), looks lovely.
- Not geometrically accurate (would be downright foolish to pay the cost involved, considering that these are dirty puddles seen at night).  What's important is that it offsets in the right directions, takes into account perspective and water depth, and LOOKS right.
- Borrows some data already calculated for the reflection distortion.
- Patchwork system, little gem that it is, eliminates the need for a screen copy like you'd normally need when doing refraction.
- Works very nicely in conjunction with ground POM.  Strengthens the illusion of depth, because you can see the bases of the protrusions (deep) refracting farther than the tips (shallow).
- Shadows are refracted by offsetting the ws position output.  Doesn't match perfectly but I think it'll pass.  I think it's matching in direction at least.
     
  Checked that the game still runs fine in 16bit colour.
Checked that it survives a change of colour depth (through Display Properties)
     
  DVD due back on Sunday the 20th; they're open till 11 apparently.  I don't trust them though.      
12-May-2007   9.25    
  Managed to remove two muls (and some other junk) from the existing ground.fx PS code, by optimising the clip-space UV stuff.
Didn't have to multiply the UV by W in the VS because that multiplication seems to be included in the world-projection muls...(?)
     
 
       
  (above) Spent the day getting POM working on the ground.  This upgrades ground.fx to the status of Ludicrously Expensive.
Added PatchworkDimpleHeightCombine.fx which combines dimple height onto the patchwork height buffer.  This combined height drives the POM.
     
  The biggest problem with the ground POM at the moment is that it pulls the kerb textures out of alignment with the kerbs.  Kerbsides need to have deep dimples so that puddles form there.  The puddles themselves will help to hide the misalignment I suppose....      
  Maybe need to make mid-grey the non-displaced height (currently it's white).      
  I'm not 100% won-over by this ground POM yet.  I expect it'll prove its worth when more chunky ground textures go in.  But that's if I can get it house-trained.  See how it goes tomorrow.      
  I'd be very interested to see what one of those newfangled model 4 cards makes of all this.      
 
 
     
  TODO: puddle refraction<-done (13th)      
11-May-2007   4.4    
  Made good progress with the ground POM (carefully restructuring the code so ground.fx & parallax.fx share what they can, h_GroundPOM.fx).  It isn't working yet though.  Been getting some very weird compiler errors....      
  Remembered how well-behaved the rain impacts are when you see them from a shallow (low) angle.  Tasty.
It's just the downwards angle, looking straight against the normal, that looks naff.
TODO: Needs to be more thin, broken, strandy.
     
10-May-2007   3.5    
  Got the rain splashes lighting again.  I'm not impressed with them at the moment though; they need work.
TODO: get them presentable.
     
  Got the brickwork looking good.  It was good to get some practice at taming the POM, getting the wetness right, getting the right texture sizes, etc.      
  Made new road textures.  In the height map, using 'minimum' filter and curves helps to give the impression of water gathering in the troughs of the surface.      
  TODO: Use Jpegs wherever possible.      
  TODO: fix Photoshop normal map exporting action (currently goes wrong if the alpha channel is blank to begin with).      
9-May-2007   0    
  Oops, overtime.      
8-May-2007   5.33333    
  DIMPLES: Remember - can't do any bold contrasty height detail using dimples.  The three height samples are ten centimetres apart, so a spot of pure white on black would appear as three separated blobs of extreme normal.
<-improved this a fair bit so bold stuff works better, and reduced sample spacing.
     
  Improved dimples; I think they were sampling from the wrong ground position, because I'd approximated a plane intersection vector.      
  Improved CMeshFrame::PreparePatchworkDecalRecursive to account for the enclosed ground now being removed.  This fixes the disappearing patchwork objects seen yesterday.  Asserts if ground can't be found beneath the object.      
  Reminder: for ground patchwork / dimples:
local normal: positive world Y
local binormal: negative world Z
local tangent: positive world X
     
  Made new brick textures.  TODO: neaten, reduce to 512...  Comically, without realising it, I chose brick-for-brick the same piece of wall that I used the first time round!      
7-May-2007   4    
  Despite my new rule about not doing any overtime, I went into work and spent seven hours today tracking down a bug that I still don't understand.  The deadline was non-flexible so I didn't have a choice; still, I didn't mean to spend that much time on it :(      
  Realised that the smoothing on my kerbs was causing crazy normals across large areas of the raised ground.  Fixed this by adding another level to the bevel to 'absorb' the smoothing.  As a result the kerbstones will all have a bit of an exaggerated roundedness, but that doesn't really bother me.      
  Started making preparations for the ground POM.  Improved dimple influence.      
  TODO: find out why the BC pavement (decal) is cutting out.<- fixed (8th), see CMeshFrame::PreparePatchworkDecalRecursive      
  Ground contained by buildings is now Booleaned-out to reduce the number of polys and (very expensive) pixels.  This is driven by a single line object, very neat :)      
 
 
     
  (above) improved kerbs, road bow.  New pavement texture is 512*512 and currently 100cm².  Works well but I wouldn't want to go any lower than that.      
  TODO: ground POM.  "It is time."<-done (12th)      
  TODO: normal/height maps to use new format (XYH) since Z is now extrapolated by ground.fx.  XYH format also allows the possibility of XYHA targas, if needed ( patchwork shader would use min(colour a, normal a) for the normals ).      
6-May-2007   13    
  Max: Can't put a WSM PatchDeform on a spline???      
  Max: Groups: Use Attach to add new members to the group.      
  Max: PatchDeform gizmo on a group jumps to the centre of the group's bounds.  Since transform type-in is unavailable for the gizmo, it has to be lined up with the patch by eye.  Shouldn't cause a problem though.      
  Max: Kerb lines are now in a group.  This allows each loop to be a separate path for the benefit of PathDeform.<-now using a Connect object containing all the pavements      
  KERBS: can only deform to coarse ground patch.  This is because the final ground patch has horizontal vert adjustments.      
  XForm modifier for scale (on a patch) : BEWARE: This has been seen to cheekily bake itself in above the modifier stack.  Avoid using it where possible.      
  Max: Lines: To ensure mesh kerbs etc. match with path deforms: un-tick 'optimize' but don't tick 'adaptive'.
No need to use Normalize Spline and it's best to avoid it for my purposes.
     
  All kerbs are now smoothly bevelled :)  The highlights that this creates along the edge of the kerb are quite valuable, and I can see the same highlights in my reference photos.      
  Max: Learned about Groups, fell out with groups, learned about Connects, Connects rock!      
 
Made some textures for the pavement outside Bedford Court.
     
         
  (above) Smoothly bevelled kerbs, new paving tile texture.      
  Spent all day sorting out Max stuff, finding the best ways to proceed with building my town.  Very time consuming work (and lots of hangs and crashes) but I think it's really important to get it right early on.      
5-May-2007   10.3333    
  Max:
- removed Transform Gizmo Toggle key (X).
- removed Render To Texture key (0).
     
 
       
  Had an idea that maybe something like an Edit Normals modifier on the ground patch could stop it deforming ground verts horizontally.  Instead it broke the deformation altogether (and was quite chuggy).  Edit Normals turns the patch into a mesh it seems.  Tried slapping a Turn To Patch on top of that but it then told me it was an "Illegal patch" for the deformation.      
  Tried all sorts of things to solve this problem of PatchDeform shifting verts horizontally.  Couldn't find a good solution.  Could do some stuff using Conform, but it's not very future-proof because anying Booleaning onto the ground has to do so post-Conform.
All I need is a simplified version of PatchDeform that only acts on the vertical axis.
     
  Decided to continue using PatchDeform as before.  It's possible (but pretty unlikely) that a simplified version of the modifier could be found or written later on.  Till then, I'll just make do with the fact that changing the ground slopes will shift kerbs and other Booleaned objects horizontally by a foot here and there.
Might not be a big deal anyway - maybe I'm approaching this modelling lark too much like a coder.
Just need to remember not to leave any crazy test humps in the ground patch.
     
  PatchDeform: This has a pretty serious limitation in that it can't deform to a patch on which any splitting of edges has been done (even if the splitting results in a perfectly clean grid formation).      
  Workaround for the problem mentioned above (splitting patch edges breaks PatchDeform):
To add more resolution to a patch without breaking PatchDeform:
- PatchDeform a new higher-res patch onto the existing one
- Collapse the new patch's stack; this turns it into an Editable Patch
- Delete the old patch; deform the objects to the new patch.
I've tested this to make sure it works.
     
  Another reason why Normalize Spline is needed is so that long lines can deform accurately to the ground patch.      
  Got the roads realistically bowed now.  'groundPatch' is a flat patch apart from bulges down the road centres (and whatever else I want to use it for).  It's patch-deformed onto 'groundPatchCoarse' which contains the slopes/hills.  Got rid of 'groundPlane'.  The ground chunks now Boolean straight out of 'groundPatch'.      
  I'm now deforming all kerbside road lines by the coarse ground patch.      
  Made and applied textures for the Bedford Court car park.  Looks great. Really needs a gloss channel though, hmm....      
  TODO: use a single meshified reference of the kerb line for all patchwork Booleans, don't let them keep private references as operands.<-done      
  TODO: work out how to path-deform onto the second loop of the kerb line; if it's not possible then the kerb Booleans need to stack up....<-now using a Connect object containing all the pavements      
4-May-2007   5    
  Managed to deform some paint along the same line used to raise the kerbs, with W's help.
Found I had to apply a Normalize Spline modifier to the line to get it to match the deformed paint.<-No, just un-tick 'optimise' in the line's 'interpolation' panel.
     
  Learned a bit more about using references & instances, and how modifiers work with them.      
  The PatchDeform on the ground mesh actually shifts vert positions slightly on the horizontal axes, which was bringing the kerbs out of alignment with the ground patchwork.  To fix this, I'm now putting the kerb lines through the same PatchDeform, which works well but makes it slightly tricky to position road lines up against the kerbs.      
  Kerb extrusion: can't un-tick Cap Start (it would break the Boolean), so I have to make sure the 'start' (base) is slightly under the ground.  Otherwise the Boolean can get really puzzled, doing loads more work than it needs to and making a horrible mess.  Got several hangs & crashes resulting from that.      
  Kerbs: I'm sinking the extrusion 10cm into the ground, otherwise it doesn't reliably intersect the ground.      
  Tried using Vertex Weld to stitch up the kerb joins; couldn't get it to work right.      
  TODO: Try lofting the kerbs and using the Bevel deformation.<-now using Bevel modifier, much easier      
3-May-2007   5    
  Had a bit of a breakthrough: realised I could use Booleans to split up the ground into flexible (adjustable) chunks.
I had always been a bit worried by the question of how to split up the ground mesh (if at all), but it looks like it's going to be a doddle.
Currently just using one chunk to save me having to make the changes to the collision system just yet.
     
  also...
I HAVE KERBS!!  Flexible spline-based kerbs (Boolean'd onto the ground plane pre-PatchDeform) are working brilliantly.  This is great.  It's like Christmas this evening.
     
  The collision system didn't much like the Optimise modifier I tried putting on the ground chunk (polys too big I suppose).
TODO: find out why this causes a problem.
     
  Tried path-deforming some road paint round the kerb lines (as a test to see how this'll work with kerb textures).
Couldn't quite make it work because:
- the line needs its Extrude modifier to work in the Boolean with the ground plane
- the line needs its Extrude removed/disabled to work in the Path Deform for the paint
- can't seem to make one reference of the line have an Extrude and one not (without losing the 'connection' between the two references).
I'll ask around and see if anyone has any ideas.
     
2-May-2007   4.83333    
  Experimented with possible methods for road & kerb creation.  Learned a lot more about using Booleans and other compound objects.
Using a combination of stuff like Booleans, Patch Deform and maybe little local FFDs to squish the kerbs, I should have no problem at all keeping the ground mesh flexible, which is a big relief.
For the large-scale undulations of the ground, it'll probably be best to use Patch Deform rather than an FFD (which wouldn't allow me to adjust the resolution without resetting the deformation).
TODO: would be brilliant if the patchwork kerb objects could drive the Boolean that raises the pavements to form the kerbs.  That way I won't have to worry about keeping the patchwork kerbs aligned with the mesh kerbs (which is going to be a nightmare otherwise).<-all sorted :)
     
  Max: FFD: changing the number of points resets the volume >:(      
  Max: Conform: To direct the projection: "Activate the Top viewport. In the Parameters rollout > Vertex Projection Direction group, choose Use Active Viewport, and click Recalculate Projection"
This seems to be the easiest way of doing it.
Won't be using Conform for the ground though, because it flattens the wrapped object (or certainly seems to whenever I've tried it).  Also doesn't seem very user-friendly.
     
  Started adding the proper ground-shaping and road-cutting objects into the world.  Going OK so far.  Still not sure how I'm going to paint water velocities onto the ground this way though (in a future-proof way).  TODO: look for a modifier that will allow this - surely there has to be one.      
1-May-2007   5.25    
#backup Backed-up the repository and the working folder onto DVDs at the end of last night, using DeepBurner.      
  Max: children-of-lines problem: The lines aren't exporting, even though I'm asking the exporter for dummy objects as well as geometry.  As a result, children of lines are jumping up to the root of the hierarchy where they're no use to anyone.
What can I do?  There are no other options on the exporter; the lines aren't hidden in Max...
Just going to have to avoid making anything a child of a line.
     
  Max: double-clicking an object selects it and all its children      
  Max: Lines can be children of the objects deformed to them, but this connection has to be made before the Path Deform modifier is applied, otherwise Max complains about cyclic dependencies.      
  Max: Schematic view: always move nodes slightly before disconnecting them, otherwise they'll jump off to the other side of the schema, even if 'always arrange' is off.      
  Road lines: Don't attempt any overall transform on the splines themselves; this breaks the path deformation.  Move the points around instead.      
  Got a Max crash when Windows was expanding the virtual memory.  Now locked the virtual memory size so it hopefully won't do it again.      
  Max: Crash: Putting a VertexPaint modifier onto a multi-selection of lines (by accident)      
  TODO: need to use the non-lollipop lighting shape for reflected lighting.      
  Spent most of the evening arranging the ground patchwork hierarchy.  Needed doing - much nicer now.
Each road line is now the child of one of the decals deformed to it.
Found that it doesn't make any difference which object is the root object of its area - doesn't have to be the biggest or most central object.  That's because the frame's mesh sub-frame has its own bounds like any other child.  For example, 'generalLandscape' doesn't draw its little building (down Augusta Place) unless that building is genuinely visible.
For that reason, I'm glad I have those weird empty container frames.
     
  Thought about roads & kerbs...      
  Played with cutting a road into the ground using ShapeMerge.  More experimentation to be done here... (leamRoadTest.max)      
30-Apr-2007   4.83333    
  MAX: any time a shader is reloaded and doesn't compile, all of the material parameters are reset to defaults.
Thanks Max.
That's why it's safest to check that the shader compiles before reloading it in Max.
     
  MAP SCALER:
- Unfortunately Map Scalers work relative to the object's edge not its pivot/centre.  As a result, UV adjustments will be needed on the object in most cases (use either the Map Scaler's offset controls or an XForm UVW).  NOTE: this adjustment depends only on the shape of the object, not the position of the graphic (phew).
- Although Map Scaler isn't perfect in this respect, I think in most cases it'll be preferable to using 'loose' UVs.
     
  Max: Remembered about the FFD(box) modifier.  This is ideal for distorting road lines.
Set it to something like 2x32x2, and remember to pull
pairs of control points around because there's two layers of them vertically.
     
  TODO: Max: Since path-deformed objects are so difficult to select with the mouse, and for other reasons, could do with a custom road-line modifier for the splines themselves.  This could include:
- 'select all paint' button
- maybe some way of giving the paint random noisy vert colours & alpha?
     
  TODO: Try using alpha thresholds on the road paint, so it'll break up nicely according to its vertex alpha.      
  Grrrr, decals don't currently show up in the game if they're children of lines.  They do export, but do they get parsed properly by D3DX?  I'm hoping it's just my code that's at fault.  TODO: FIX THIS!      
  Finally sorted out the Max UV discrepancy (27th), properly this time.  The h_generalPOM parameters are all doing their jobs properly now and allow texture portions to be upgraded, repositioned and rescaled without any edits being required on the objects themselves.      
  Patchworks: Had an idea that certain patchwork objects could be given a tick to say "bake me and my children onto a texture and replace us with a textured quad accordingly".  In this way, bits of patchwork that are getting too busy can become texture-patchworks without any faff.  That will be a beautiful way of working.
If I had all the time in the world, I'd probably want to make the game decide which objects to bake based on how long they took to draw etc...but that's just crazy talk really.
     
 
       
         
  (above) The new spline-based road lines, plus dimple & puddle improvements, and the minimal-screen-area ("lollipop") lighting.
Lollipop Lighting™.  Because you're worth it.
     
  TODO: get the decals drawing when they're arranged as children of lines.  Otherwise the hierarchy will become a complete mess.<-can't (limitation of the X exporter).  Managed to get the hierarchy laid out neatly nevertheless.      
29-Apr-2007   3.25    
  My biggest (only) loss of time nowadays is the overtime I do for Work.  I need to sort this out:      
  RULE: NO OVERTIME TILL THIS RAIN DEMO HAS BEEN DONE.  NO SNEAKING INTO THE OFFICE AT WEEKENDS TO CATCH UP WITH WORK.  IF IT SLIPS IT SLIPS.  THIS PROJECT IS MORE IMPORTANT.      
  If I can get into the habit of never doing any overtime ever, and keep that habit up till the end, the benefit to the project will be massive.  I need that time to achieve the level of quality that is planned.      
  Road lines: DON'T USE SCALE!!      
28-Apr-2007   5    
  Doesn't look like Leamington is on GetMapping's recently-flown 12.5cm res coverage :(  If only they'd gone right a bit.      
  WS PathDeform: use X as the deform axis for ground decals.      
  Max: Road lines: use a modifier stack like this:
- Path Deform WSM (path deform axis X.  Set 'rotation' to 180° if a flip is needed)
- [Edit Mesh],
if totally necessary.  Caution: topographical dependancy.
-
VertexPaint (even an unused VertexPaint modifier fixes uninitialised vert colours)
- [Turn to Mesh]
-
FFD(box).  Set it to something line 2x32x2.
-
Noise (Y axis, for slight wiggle)
- UVW Xform (mostly for t-page offset, might use scale in some cases though)
-
Map Scaler OSM (scale 1m, no offset, wrap=no)
-
Plane (long 'width' and lots of 'width' segments)
     
  TODO: Scaffolding (if there is any): try using a LATTICE modifier, which basically makes scaffolding for you.      
  Max: Found the Visual MaxScript editor thing in the Utilities panel ('More...')
Should try using that for interfaces next time.
     
  Max: Lines: Remove nasty sharp joins using the 'fillet' control.      
  Patchwork decals can now use vertex RGBA (patchwork.fx)      
  (below) Added some smashing road lines, winding all the way down John Street.  The process above works brilliantly.  Adjusting road lines is now literally as easy as editing a spline :)
TODO: paint-up the car park a bit.
     
 
 
     
  Max: Sticking a VertexPaint modifier onto an object (without even using it) seems to magically fix uninitialised vert colours - yay!  I did it on a hunch and it worked.      
  Max: Don't un-tick split mesh on a displace approx modifier.  Max will run out of memory and crash.      
  Photoshop: Learned how to use layer masks.  Handy!      
27-Apr-2007   5.16667    
  Added a doc for my texture production rules, otherwise I'll forget them:      
  file://C:\Noctambule\docs/TextureProductionRules.txt      
  TODO: puddle edges wobbling slightly as they ripple in the wind?      
  Fixed a bug in CLight::TestVisibility which was allowing nearly all lights behind the camera to draw.  Nothing sinister, just me being silly.  Got a tonne of frame time back, phew!      
  Found & fixed another CRAZY mapping discrepancy (this one is Max's fault).  I just hope it happens consistently rather than being a bit random.
See h_GeneralPOM.fx \ VSProcessUV, #ifdef _3DSMAX
     
  Max: Found out about the WS PathDeform modifier which is ideal for road lines...  TODO: put a bunch of road lines in.      
  Made a combined road-paint texture as a (future-proof) placeholder till the texture patchworks go in.      
  TODO: work out where 'posters' fit into the building patchwork / texture patchwork system.      
26-Apr-2007   4    
  Fixed yesterday's UV mapping discrepancy:
CTexture::Create now uses D3DX_DEFAULT_NONPOW2 instead of D3DX_DEFAULT as the Width and Height parameters for D3DXCreateTextureFromFileEx.
The bug was made more confusing by the fact that I thought my texture was 1024*256 when it was actually 1024*156.
     
  Started planning my workflow for texture production.  The conventional process of packing graphics together onto a composite texture is sensible but seems faffy and makes it difficult to upgrade each graphic afterwards.  So here's the plan:      
  texture patchworks (procedural textures): all the 't-paging' is done using geometry in Max.  Every texture file will just have a single graphic on it, and there's no faffing about with resizing.  I can then change individual graphics fire-and-forget style.  Importantly, the texture-patchwork approach makes it easy and efficient to create variants of textures (using decals same as on the ground).
Normal/height-map generation for texture patchworks will be done at game startup using a material on the texture-patchwork component graphics that specifies the WS width & height of the graphic.
     
  Here's the difference between patchworks & texture-patchworks:      
  Patchworks are rendered view-dependently on the fly and are only suitable for plane-ish surfaces.  They'll mostly be used on buildings (as well as the ground) and will probably team-up well with CullPlanes.  When they're small on screen, they can freeze 'as-last-projected', be held on a small ORT and continue to be mapped correctly onto the surface.  This might have to sync with a switch of material technique for the receiving mesh.  Imagine the efficiency of freezing them like this!!  A whole side of a street sitting on a single perspective-inclusive little texture.
Unlike the ground patchwork, building patchworks will be applied using explicit uv coords (Unwrap UVW).  This is for continuity around doorways, alcoves etc.  Do need to make sure that the overall mapping lines up with a planar map though, otherwise we'll see bad screen-edge artefacts.
     
  Texture patchworks are rendered orthographically (top view), the first the time the game is run (during install would be nice) and then saved as textures.  They'll be used on patchwork decals and general objects.  Texture patchworks can be multi-textured onto an object to provide multiple layers of detail ranging from say, a crisp h-tiling brick formation to low-res muck and brick-colour variation.      
  TODO?: Can the kerbs maybe use a sort of mirrorred-mapping trick where the sampling pos moves back along the outwards kerb normal?  They can be flagged as kerbs using channel mapping.  Still have the awkwardness of lining-up the kerb texture with the edge on the mesh though.      
  Er, didn't get much rain done tonight :/  TODO: make that combined road-paint texture as a (future-proof) placeholder till the texture patchworks go in.(<-DONE)  Then do some rain!      
25-Apr-2007   3.5    
  Patchwork now uses MRT again like it originally did.
patchworkColourRT and patchworkNormalsRT are now replaced by groundPatchworkRT
     
  I've got a weird mapping discrepancy between Max and the game, on these road lines.  The material properties are coming through fine to the shader code; it's as if maybe the exported UVs are wrong.  Happens even without any mapping modifiers.  TODO: FIX THIS<-FIXED (26th)      
  Patchwork height now comes through to ground.fx and contributes to puddle depth.      
24-Apr-2007   4.16667    
  MAX: Found out about the WS Map Scaler modifier.  Thought this might fix my old mapping problem, but it doesn't.      
  MAX: Create > AEC Objects > Wall.  Handy!      
  Need a way for some patchwork decals to be colour only or normals/height only.  TODO: maybe separate colour/normal alpha multipliers in the material?  Maybe colour-only and normals-only versions of the material.      
  ImageAlign Pro no longer works (wants me to register).  That's annoying.  TODO: find out how to achieve the same stuff in Photoshop.
<- LENS CORRECTION!  RAR!  That's about the best thing ever.  ImageAlign who?
     
  (below) Made a proper double-yellow lines texture.  Quite an encouraging result - you can see that it's going to look great when I start putting all the proper road markings in.      
 
 
     
  Had a think about wall/object patchworks, having kinda realised that using conventional texturing methods on the buildings would involve an awful lot of learning and practice (and probably more time than I've got).  Very keen on patchworks, will decide exactly what I'm doing with them tomorrow.      
21-Apr-2007   4.83333    
  Noctambule.sln had no projects in it when I opened it this evening (thereby differing from last night's check-in) - how on earth did that happen?  Now reverted and ok.      
  Reloading has stopped working on Patchwork.fx.  Surely this has got to be something to do with the textures having moved????      
  NOTE: POM material properties such as texture dimensions and texture aspect ratio, they really are for the TEXTURE not the graphic.  A material using a 100cm square graphic occupying one quarter of a texture should specify that the texture WS dimensions are 200*200cm.  For a 70cm square graphic occupying a quarter of the same texture, the material would specify that the texture was 140*140cm.
Really need to compile these rules into a doc (notes are gathered in the file below)
     
  file:\\C:\Noctambule\docs\POMRules.txt      
  Decided against the idea of patchwork heights influencing puddle flow (ie. bumps casting proper little wakes into the stream).  The number of texture samples I'd need to get it looking good would be [very] excessive given the relatively low visibility of the effect.  The velocity map results weren't far off, so I'll go back to that.      
  Had a long think about the scale-type properties on these POM materials (planning how the ground will work with POM).
All that's needed in order to sync the normals with the depth is:
- a ratio between the texture width (NM height scale) and the desired depth
- an aspect ratio between the texture width (NM height scale) and the texture height.

In some cases I'll know the actual WS dimensions of the texture and fill-in the material properties accordingly.  The rest of the time, I'll just leave the WS dimensions at the default of 100*100 (if the texture's square, else...) - the depth property is then just a percentage.  No harm in working that way at all (and no awkward changes required for existing patchwork objects).
Irregularly-stretched UV mapping is the only thing to avoid, but I don't have much use for that anyway.  *Regular* UV scale works a-ok; the depth scales with it.
     
  TODO: get to the bottom of that weird UVW Map scale problem I always get in Max (get road line objects properly mapped)      
20-Apr-2007   3.75    
  Added Photoshop action Export Normal+Height Map to export a normal+height tga from a layered height-map, via the optimal 16-bit route.      
  All height PSDs will now live next to their TGA output.  Started setting up a proper texture folder hierarchy, to facilitate batch processing later on (and just to help keep track of the textures).      
  * From now on all GROUND normal maps will be generated using the same rules for normal-map scale as the wall POM maps (SCALE IS THE TEXTURE X RESOLUTION).
* I'll add some multipliers to the patchwork material, probably the exact same ones as parallax.fx.  These will have to be adjusted whenever the textures are combined-up (t-paged), that can't be avoided.  Make this adjustment at the same time as applying the UVW XForm modifier to each material involved in the change - that way there's no guesswork involved.
* Ground will use POM (after the rain deadline), and this will be beautiful.  The POM caveat about joins/decals disappears totally when using the patchwork system (YAY PATCHWORK SYSTEM!!) and this is one of the reasons why I keep thinking about wall patchworks too...
     
19-Apr-2007   4    
  Max: Grr, texture can't be shown in Edit UVWs interface for DX9 shader materials.      
  Max: UVW XFORM modifier is going to be my friend.  With this, I can initially texture objects using loads of individual prototype textures, then *later* t-page them up any which way I feel like.  I'm guessing this might be common practice, but it's all new and clever to me!
(Use 'select by material' in the material editor, add a shared UVW Xform modifier onto this multi-selection)
     
  TODO: Make Patchwork.fx use MRTs again - will be a load faster (made it non-MRT as a build bodge for compatibility on an old nVidia 5xxx I think)<-DONE 25th      
  Dimples now support vertex colour & alpha.      
  Did a load of dimple experimentation in Max - checking I haven't overlooked anything major.  All looks good.
     
  TODO??: would like a way of controlling the degree to which the peaks of each dimple material smooth the patchwork heights&normals.  Could have this as an RGB channel on the dimples RT (ground.fx can read it straight from there), but this means adding another sampler just for that purpose.  Alternative would be to steal an RGB channel from the dimple normals RT and reconstruct it in ground.fx.  Neither sounds good.
NOTE: This is a pretty minor wishlist thing so don't bother if it's going to have a significant cost.
     
  Max: Found out about the VertexPaint modifier, which is a great way of setting or painting vertex colours (or channels) across multiple objects.      
  TODO: Finish getting patchwork heights written so they can influence puddles and puddle flow (patchwork.fx).  Er, I suppose this will involve stealing the patchwork normals Z channel and paying a sqrt to reconstruct it in ground.fx.  Needs to be done one way or another though.<-DONE 25th      
18-Apr-2007   0    
  en plus de ca      
  Reserved bebo pages in case I want them at some point in the future:
lecauchemar.bebo.com
programmerart.bebo.com
     
17-Apr-2007   4    
  Added CLandscape::groundEffectPlaneMatrix.  TODO: remove point & normal.      
  Got dimples working properly.  They're great, and already give that car park the same ruggedness it has in real life.  Now uses three texture samples per pixel instead of 8.  These three height samples are offset from each other by world-space vectors now, so the normals are consistent regardless of viewing angle & viewing distance.      
  TODO: light marker sprites are only drawing to one stereo eye; fix this.      
  TODO: test stereoscopy with convergence=1.  Doesn't look the way I remember it...      
  TODO: back to flowing puddles, using patchwork heights...      
16-Apr-2007   0    
  work      
15-Apr-2007   0    
  work      
14-Apr-2007   2.58333    
  Changed meshes back from using 32-bit vert indices, because it was causing some holes in the ground collision (absolutely no idea why).
I expect I'll have to fix it at some point, but not now.  Search for D3DXMESH_32BIT - I've left all these in but remmed them out.
     
  une question qui brûle les levres      
  Max: After rearranging the dimple hierarchy (so the tile layer is the root), the dimple objects were all distorted.  Fixed them by multi-selecting all of them and just clicking 'reset transform', nothing else.      
  Patchwork and dimples all drawing again now.       
  CMesh: Added member decalOrderingY (see comment) because centre positions are shifted up to the ground collision and therefore can't be used for ordering.  CMeshFrame::QSortCallback_VerticalDepth now sorts using this.      
  Multi-monitor: Would be very cool to support multiple monitors properly.  From glancing at a DX FAQ it looks like each monitor gets a separate adapter object and you create a device for each of those adapters.      
  TODO: Finish overhauling PatchworkDimpleProcessing.fx<-DONE      
13-Apr-2007   3.5    
  Changed meshes to use 32-bit vert indices (needed when testing a subdivide modifier on the ground mesh).<-changed them back; see 14th      
  Spent most of the evening trying to tune the flowing puddles after changing them to follow the ground velocities.  Didn't manage to get it looking as sweet as it should be...  Last night's results were pretty flukey I think, and I don't like effects that work by fluke, for this very reason that they're difficult to tame - I could spend forever tweaking these numbers and it might never look quite right.      
  So I'm going to step back a bit and try to work out how to base the ripples on the patchwork heights because that'll be pure gold if I can get it working.  This should make the velocity map redundant, and produce the same magic but better.
The deeper the puddles are, the less they'll be affected by patchwork heights and the more they'll be affected by wind.
Refraction of the ground beneath will be the icing on the cake, and it's made really simple (and pratically free) by the patchwork system (YAY PATCHWORK SYSTEM!!)
     
  X m'a fait cadeau de Y      
12-Apr-2007   3    
  MAX: Added a 'Materials' layer to contain dummy objects that keep hold of materials (Max material libraries are not compatible with DX9 shader materials).      
  Started making the puddles flow using a velocity map.  This looked gorgeous straight away, and I'm quite excited about it.  I'm probably going to apply this technique over the whole scene...      
  Started painting per-vertex water velocities into the ground mesh using vert colours.  These will combine with the tiling velocity map.      
  TODO: get flow & impact ripples combined again (ground.fx).  Combine with per-vertex ground velocity.<-done      
11-Apr-2007   4.16667    
  en garde à vue - in custody      
  au garde-à-vous - standing to attention      
  en première ligne - on the front line       
  à vol d'oiseau - as the crow flies      
  une vue à vol d'oiseau - bird's-eye view       
  un terrain de foot - football pitch      
  hors terrain - off the ground      
  terrain de jeu - playing field / playground      
  sur le terrain - in the field      
  lancer une bouteille à la mer      
  SVN: removed .suo files because they were making a nuisance of themselves following a rewind.      
  SVN: Close the devlog before doing a rewind!!!      
  Made normal maps that will scroll over/into each other to provide a foundation of wind-blown ripples in the puddles (and possibly also distort the shape of the impact ripples).  The *impact* ripples are now relatively small and quick.  Their job is just to reinforce the impact splashes.  Being small and quick means they're cheap and they can now be used on the non-puddle ground (everywhere) too, which will add a lot.      
  Got a new favourite puddle reference video which concurs strongly with my choices regarding rain impact and rippling puddle effects :)  Gives me a nice feeling of security that does.      
10-Apr-2007   3.83333    
  Normal service resumes.  Got as little as a month and a half left to do these weather effects.      
  Removed all the fxo's from source control, they were getting cumbersome.      
  TODO: CMeshFrame::PreparePatchworkDecalRecursive is currently causing a problem (changing the decals' Y order = draw order).  FIX THIS<-done (14th)      
  TODO: CMeshFrame::QSortCallback_VerticalDepth needs to sort by frames' OWN centre/bottom pos (not centre/bottom pos including children).<-done (14th)      
  TODO: change dimples to generate a world-space normals image, not ground-effect-plane-space.  NOTE: dimple normals currently only affect reflections, not lighting!  Reduce the number of samples used to create the normal map.  Dimple normals only need to be coarse.<-DONE      
  Think I've worked out how to make the ripples look good.  TODO: get this working.      
9-Apr-2007   0    
  Work-work      
8-Apr-2007   0    
  Work-work      
7-Apr-2007   0    
  Work-work, although I didn't get much done unfortunately.      
  à vie - for life      
  le rendu - rendering      
  Roughed-out my CV in shaky French.  Pretty happy with the form I've chosen (basically listing what I did on each game that I've worked on).  I'm also trying to imitate the ANPE examples to prevent it looking clumsy/unconventional to the person reading it overseas.      
6-Apr-2007   0    
  Work-work      
  rédiger - write-up, compose      
  agir - act (behave) / take effect.  Lots of compound forms to learn.      
  auprès de - near / with / at / in collaboration with      
  un atout - asset      
  convenir à - suit, fit, agree with      
  convenir que - agree that      
  au format PNG      
  un brouillon - draft (rough copy)      
  soigner autant X que Y - give X as much care as Y      
  un réalisation - accomplishment, achievement       
  Read through anpe.fr's guide to writing a CV, and grabbed their examples (C:\Noctambule\CV).
Will start on that quite soon.  I think it wants to be a web page, for easy viewing on the site.
     
  Discovered the forums on wordreference.com.  Looks like there's some really useful translation-type discussions to be found there.      
5-Apr-2007   0    
  Catching up on work work.  This is necessary to get morale back up to a sensible level.  Normal service will resume shortly.
     
  Found some great general-rain reference in Hollow Man 2 (1:19:46 -> 1:23:11)
TODO: Try adding a couple of layers of fine scrolling speckles/noise into the rain impacts image?
     
  Added a 'PowerDVD Grab' Photoshop action.  Crops the image and fixes the aspect ratio.      
4-Apr-2007   0    
  ill      
3-Apr-2007   0    
  ill      
2-Apr-2007   0    
  Holiday      
1-Apr-2007   0    
  Holiday      
31-Mar-2007   0    
  Holiday      
30-Mar-2007   0    
  Mr. O's leaving doo, he's off to Paris.  The way he described the application/interview process made it sound way too easy.
Told me about other vacancies there too.  Very tempting, but I don't feel ready yet :/  I know I'm being cowardly.
Mr. B offered to help out by putting in a good word for me at Montpellier...  I need to visit these places - the sooner the better.
     
29-Mar-2007   3    
  à la toute fin - at the very end, right at the end      
  ça a pas mal changé - it's changed quite a bit      
  Had another look at Empire of the Wolves which has some excellent rain reference.      
  DOCS: Added reference.txt, for keeping note of DVD reference footage (time points).      
  Tweaked rain impact splashes to look a lot more dense.  They were too laid back, as were the ripples - these need to be very busy-looking (see EOTW 0:44:00).
The rain needs to feel unpleasantly severe, rather than decorative.  It should feel like it's attacking the player, so that finding shelter feels rewarding.  VERY important to appropriately change the rain & wind sounds when in shelter.  Done properly, this should affect the player at the instinctive level.
TODO: rain-in-the-eyes effect when you look up / sprint / face into the wind?
TODO: wind affects player balance and movement speed?
     
28-Mar-2007   3.33    
  ça a l'air de dire que - that seems to suggest that      
  je m'appercevais que - I found that / noticed that       
  supplanter - supersede, override      
  rapprocher - bring closer, come nearer      
  se rapprocher - approach, close in      
  OPTIONS: renamed weather\rainSplash -> weather\rainSplashes
added weather\rainRipples
added weather\rainImpactNumParticles
added shadows\fallbackShadowsOnGroundOnly (prevents fallback shadows on walls etc)
     
  STRING TABLE / OPTIONS:
- won't go down the ultra-automated route.  Options will continue to be manually parsed and manually added to the menus.
- string table will not contain any menu-item data such as types, ranges and visibility conditions.  It's just a collection of strings.
- option string names will contain the corresponding option member name, for my benefit.  Eg. "GFX_shadows_destRT".
- option string names will not be case-sensitive
- options don't have to be grouped in the same way they are in the profile files.
- enumeration strings will be named exactly like the enumeration entries, but with the prefix "ENUM_", eg. "ENUM_ESTEREOSCOPYMODE_NONE".  They will be gathered and used automatically.  The string names will replace the likes of COptions::s_stereoscopyModeNames.
- enumeration values will appear in the order used in the string table, not the enumeration's order.
- menu strings will be kept short, and information tips will give full explanations.
     
  Bit more work on the string table file.      
  Noticed that fallback shadows make the non-specular rain splashes disappear.  TODO: fix this!!<-fixed, just a colour-write conflict      
27-Mar-2007   4.25    
  Considered using a triangle list for the ripple sprites, decided to use quads linked by degenerates instead.  Simpler for me, probably (academically) less work for the gpu.
For future reference, if the sprite graphic fits into a circle:
The right-angled sides of the triangle are the width of the quad * 1.7071067811865475244008443621048.
The triangle area is 1.4571067811865475244008443621048.
So about 1.5 times the number of pixels, half the number of verts.
     
  au mieux de sa forme      
  D3DFVF_TEX0 MEANS **NO TEXTURE COORDINATES**.  IT DOES NOT RELATE IN ANY WAY TO TEXCOORD0.
D3DFVF_TEX1 MEANS **ONE SET OF TEXTURE COORDINATES**.
     
  Remember: One quad (joining either side using degenerates) is 6 triangles in a triangle strip.  Not 8.
AND YOU SHOULD DRAW FROM VERT INDEX [1] AND SUBTRACT TWO FROM THE TRIANGLE COUNT!
     
  Finally got the puddles rippling.  Looks sweet.  Took all evening to get those sprites to behave though.  Mostly me being clumsy with vertex formats...      
26-Mar-2007   0    
  Lazy film nite, ice-cream and all.      
25-Mar-2007   6.66667    
  enlever - remove (or kidnap)      
  un film à la Mad Max      
  merci d'avance      
  TODO: for lights & fallback shadows:
- anisotropic specular lighting
- cross-fade between projector & fallback shadows
- fade aft lights in & out with visibility
- place more lights
     
  Decided to leave the above until I've worked on puddles & dimples.      
  Ground.fx: got rid of the stripy artefact (changed normals sampler to 'point' filtering)      
  Made good progress with the rain ripples.  Added a very rough dimple base layer, TODO: improve      
  Can't seem to pipe colours or any other data into a vertex shader when drawing point sprites.  I get the impression only position and UV come through (generated by DX).
TODO: Change rain impact dots & ripples to use manually-plotted sprites now :(  Consider triangle list.
NOTE: Colours DO come through when using fixed-function pipeline.
     
24-Mar-2007   4    
  Fixed the fallback shadow problem case (22nd) using depth feathering.  (The ceiling in the BT pillar area was putting a hard bottom edge on those highlights.)      
  Fixed viewport clipping for lighting verts.
Specular tail is now included in area count (for projector priority)<-nah, less jumpy without this
     
  le format      
  exigeant - demanding, exacting, strict, fussy      
  monter sur scène / en scène, quitter la scène - go on stage, leave the stage      
  épars(e) - sparse      
  un sous-produit - by-product      
  Crikey, the 'useLightRange' problem (ie. not working) in DeferredLighting.fx was just that I was using a struct {float,float} instead of a float2.  From this and previous experiences, it seems a good rule of thumb is:
Don't use even vaguely fancy syntax in shader code - it probably won't compile properly.
     
  Got the light mask textures working nicely.  These increase the urgency of improving DeferredLighting.fx to give anisotropic specular highlights.      
  Improved light visibility testing to take into account the specular tails.      
 
       
  (above left) The signpost reflection/shadow on the wall is a nice by-product of the fallback shadows.  It's unreliable though, and is glitchy in many cases.  Too much glare here, obviously.
(Above right) Fallback shadows again, and the new feathering fixes clipped edges previously caused by that low ceiling.
     
23-Mar-2007   2.666    
  Memory leak detection doesn't seem to be working at the moment (tested with CProjector::s_instances - changed from g_projectors).      
  Related to the above, I seem to be using this convention for the 'p' prefix:
CItem someItems[10]
CItem* someItems
CItem* pSomeItem
CItem* pSomeItems[10]
CItem** pSomeItems
     
  Added option 'shadows\numProjectors'.  Made sure this can be safely set to 0.      
22-Mar-2007   3    
  Late start because I had to faff with some stuff at work.
From now on I'll be getting in the habit of starting no later than 7 on weekdays - guarantees four hours a day.
     
  From now on I'm going to make a habit of keeping the radio on while I work, to help with the French.  I reckon it'll distract me less & less the more I get used to it.  I'm also going to jot down words here in the devlog to help me remember them.  Notated in whichever syntax I find most convenient/helpful case-by-case.      
  se chevaucher, un chevauchement - overlap      
  un seuil - threshold      
  vecteur, vectoriel(le)      
  le produit scalaire - dot-product      
  le produit croisé      
  Added CLandscape::GroundReflectPosition & GroundReflectDirection      
  Got the specular tails bodged nicely.      
  Started fixing a problem case with the fallback shadows, TODO get this working (in GenerateFallbackShadowImage)
<-(23rd) nah, the fix was as bad as the glitch.  Did a bit of tightening-up to the way they work though.
<-(24th) fixed nicely using depth feathering
     
21-Mar-2007   4.333    
  Remember: Two disconnected quads (joined by a degenerate) are 8 triangles in a triangle strip.  Not 6.      
  Last night's work turned out to be no good because I had overlooked the fact that one of the vectors, relying on the result, needed to be normalised.  The outcome of that is here:      
  file://C:\noctambule\specHighlightsEqn.png      
  I can't solve this specular tail plotting problem.  It has beaten me.  I just don't have the experience in maths to know how to approach this one.  There are people at work who could fix it for me, but that doesn't get to the root of the problem and I'm sure they've got better things to be doing anyway.
I've spent far too long on it already, so I'm going to bodge it, move on, and start studying maths in my free time as soon as I get free time (which will be at the very least several years from now).
In the mean time, I feel like a complete failure.
     
20-Mar-2007   1.75    
  I think I've sussed the equation for the specular tail corner positions now, but it took an embarrassing amount of time to get there.  I wish I had time to learn more maths (this is definitely on my todo list somewhere).
Thanks to MB for advice.
     
19-Mar-2007   2    
  SVN: head revision is currently 0.99/1.01 GB; repository is currently 975/978 MB.
Need a bigger memory stick and/or some way of burning DVDs.
     
  Tried to calculate the corner positions for the specular tails.  But it's one of those equations that doesn't wan't to be solved for the variable I'm interested in (the reflection position).
Need to talk to someone who knows more about maths to find out how to deal with this kind of problem.  By all means I could step through a range of values and use the one that fits most closely, but surely there's a better way.
     
18-Mar-2007   9.25    
  Remembered about SEnvironmentRenderData::pOriginalRenderTarget      
  fallback shadow image:
Firstly form a global ground-fitted reflection position image (small RT):<-done
- draw ground with un-distorted reflection position image glued into place on it<-done
- where ground is z-blocked, mask value is written (fallback shadow can't appear here).<-nah, works better without masking (wall tops etc. need these shadows too).
Form this image once the environment has drawn but before it has been lit.<-done
Z-testing done manually using position buffer.<-works better without masking
     
  renamed 'pvp' -> 'cMainViewpoint' to prevent confusion.  It's NOT always the player VP!  It's the principal viewpoint that is seen in the final frame (ie. never a reflection/projector viewpoint).      
  Added CCamera::GetDirection and CViewInfo::pMainViewDir (complements CViewInfo::pMainViewpoint).      
  Added CViewInfo::pMainCamera and SetMainCamera, which records the variables above.
Note this is only called in one place: CModeEnvironment::RenderEye.
     
  Lost about 6 hours by going out last night (up too late and tired this morning).  It's nice to socialise etc, but I need to remember that it does take a hefty bite out of my schedule.      
  Got fallback shadows behaving nicely.  They're sweet.
They're only used to block specular.
Need to fade as discreetly as possible from projector shadows to fallbacks as you walk around.  Technically the cross-fade will be easy, just hope it's not too obvious.
     
  I think I've got too used to looking at these fallback shadows - the perspective on the real ones looks weird now.      
  TODO: Disabling landscape backface culling improves the fallback shadows in some cases (where a building should be occluding a highlight but the highlight is higher than the ground...)
So maybe include a landscape backface culling option (currently always backface-culled).
OR, build downwards-facing 'floor' polys into the buildings??  That would be cheaper.
NOTE: Parallax.fx currently doesn't appear in backfaces, ie. it hides them.
     
  TODO: Use ProjectorShadow on the lighting geometry, rather than covering the whole RT.  It's not a cheap shader<-done      
  Projector: TODO: use a minimised (narrowed) version of the view frustum which points at, and fits around, the light's range sphere?      
 
       
  TODO: Finish specular tails      
17-Mar-2007   8.41667    
  Max: Noticed you can drag a material onto an individual selected poly?  Experimentation needed there.      
  NOTE: Rotation is not yet supported on collision rectangles - don't use it!      
  Did a bit of modelling/placement: walls, cars, collision      
  ATI QueryLightFlare sample (debug) drops from 16/1700 fps to 13/1400 fps when you reduce #queries from >1 to 1.
Would stand to reason that it would be far more severe in a detailed scene, but I haven't tested this.
This is just to reiterate what the doc says, that hanging around waiting for recent (this frame's) queries to finish is a bad idea.
     
  Realised that the reflection position buffer can be used to form a pretty respectable fallback shadow image for lights without projectors.  Began setting this up...      
  SFallbackShadowVert: Couldn't get D3DFVF_NORMAL (VEC3) to work for the light position, no idea why.
D3DFVF_TEXCOORDSIZE3(0) looked more like it was working but it wasn't........??????
     
16-Mar-2007   2.75    
  The nVidia Quadro card in the Vista machine at work exhibits the same zbuffer artefacts that M gets on 7900.  Will remote-debug this some time.  Also suffers blackouts like the rest of the nv cards.  Can fix these two bugs together.      
  Added CLight::GetProjectorPriority, which is really doing the business now.  Mostly thanks to 'mainDrawClipSpaceArea' which is a great indication of how much a light needs a projector.
Number of projectors currently set to just 3, yet it's enough to cover the scene nicely 90% of the time :)
     
  TODO: Fix the 'useMaskTexture' thing in DeferredLighting.fx      
15-Mar-2007   5    
  VEC3: Added wrappers Vec3Add and Vec3Sub.  Because 'D3DXVec3' is quite an obstacle course.  Also good to have consistency.      
  Maths: Added GetClipSpacePosition and GetClipSpaceSphereDimensions.  Found that these aren't appropriate for working out lights' screen bounds, but they work as intended and they're handy functions to have.
Also moved-in GetDistanceAlongLineOfSight from Util.
     
  Maths: Added GetClipSpaceSphereCoverQuad.  The calcs were slightly wrong (couldn't figure out how), so I simplified them to something that is perfectly suitable for the lighting bounds (and far less wonky).
The version that I thought *should* have worked is in stuff.cpp.
     
  Upped the number of projectors, and was reminded how much rendering work each one does :|  Second pass of the shadows should definitely finish with an optimisation spree.
TODO: Arrange projectors so they only generate their depth images for the first of the two eyes.  They do each have their own face RT's in readiness for this.  NOTE: common depth images but unique shadow images.
     
  Lighting 'head' quads now plotting nicely.  Remember that these fit the light's bounding sphere not their range.
TODO: apply mask texture.<-done.  Mask texture works an absolute treat.
     
  added lightMask.png      
 
 
     
14-Mar-2007   1.83333    
  CProjector::GenerateDepthImages now uses a private z-buffer.  This allows light marker sprites to draw after the lighting (main z-buffer would previously have been mangled by the projectors by that point).
Requesting D3DFMT_D32 returned D3DERR_INVALIDCALL; now using D3DFMT_D16 instead.
     
  debug rendertext prevents alt-enter TODO fix<-done      
  Got light marker sprites drawing properly at last, phew.      
13-Mar-2007   6    
#revision 423 **** ALWAYS USE FOUR-ELEMENT VERTEX POSITIONS ****  Vertex declarations seem to expect this, even if you tell them FLOAT3.      
  Vert types with vertex declarations can store their members in any order, as I'd expect.      
  Setting a vertex declaration causes it to take over from the current FVF.  No need to use DEVICE->SetFVF(0).      
  DON'T USE ANY POINT SPRITES IN THE GAME SCENE.  They're not aspect-ratio-friendly and they're basically unsuitable for world-space stuff.
If you do want them to scale automatically for perspective, you have to set up D3DRS_POINTSCALE_A, D3DRS_POINTSCALE_B and D3DRS_POINTSCALE_C, which are
screen-space sizes.  Also set D3DRS_POINTSCALEENABLE.
     
  D3D: No quad-list prim type??      
  v10.2 zbuffer mess: Looks exactly like what you get if you write to the zbuffer but not the position buffer.
TODO: Check that the position RT will definitely be set when the zombies draw.
     
  Spent the whole evening getting these placeholder light marker sprites working.  Took a long time because it's the first sprite stuff I've done in DX.  Learned plenty from it though.
Working now, just need to find a good point to perform the draw.
     
12-Mar-2007   4.66667    
  Lighting geometry can't benefit from z-testing (objects in front of the bounds always need to be able to reflect specular).      
  NOTE: All the functions in Debug.cpp take vector references rather than pointers.  This is because it's handier for when you want to pass in say this->position+this->normal*100, not having to wrap stuff up in brackets and ampersands.
Everywhere else in the code, I'm sticking to vector pointers which matches with DXUT.
     
  Got debug spheres working again.  Now used for light debug.  Now take a colour param so I can tell different lights apart.      
  Put a load more lights in.  This is great because it has the effect of opening up new scenery to explore (albeit shoebox scenery).  v11 should look a lot more impressive than v10.
Really impressed by the cleanness of the shadows cast by small lights close to the viewpoint (eg. Bedford Court west wall).
     
  Improved sequencing of projector work - they were a frame behind.  Also improved allocation of projectors to lights TODO: improve this.<-done      
  TODO: Get that lighting geometry plotted!
Realised that the specular 'tail' isn't necessarily connected to the head part, but I do need to make sure they don't overlap.
     
  Noticed that a big part of streetlight bounds can be covering empty sky.  TODO: use stencil testing to reject these pixels before they get to the PS (I assume that's the order?)      
  TODO: Streetlights don't really cast upwards.  Surely I can use that to optimise the shape of their lighting geometry.      
11-Mar-2007   5.91667    
  Got some flickering lighting by accident...  Realised that electric-blue sparking lightsources will look great in dark areas as a complement to the peachy/orange streetlights.  Maybe the enemies should spawn The Terminator Way or have some kind of electrical effects associated with them?
I've got blue energy weapons in my head too.  Blue light is very sci-fi and other-worldly.
     
  Also, streetlights cutting out as the enemies approach, that could be really scary.  The more the enemies and weapons can mess with the environment the better.      
  Renamed Vector3... & Vector2... -> Vec3... & Vec2...      
  Can't breakpoint 'goto' lines, even in a debug build.      
  NWF: Hidden lights no longer export.  Checked this works ok with referenced light nodes.      
  Added CCullPlaneUser which meshes and lights now inherit from.  Characters will do as well.
Lights now have sensible culling.
     
10-Mar-2007   8.5    
  This weekend I'm doing/starting the second pass on the lighting (not fixing the shadows, that's a separate task).      
  I thought it was important to get the lighting more decent before carrying on with the rain effects.  Otherwise I'd be constantly asking myself "yeah but how will this look when there's more lights in the scene?".
After lighting, I'll do puddles and ripples.  Then the falling rain.
     
  Had a little think about how lighting and reflections want to play together.
Decided that neither one risks becoming redundant, but that each one should be able to pull its own weight if the other one was switched off.  Providing options for the number of lights and reflections will be grand.
The indications so far are that the two effects are good at covering each other's faults, and they certainly don't conflict in any way.  A light object with a corresponding actual light can be hidden from reflections (or reflected un-luminous) if that looks better (eg. because reflections can't cast shadows).
     
  TODO: try running the blurred shadow image through a squaring curve:      
  file://C:\Noctambule\Photography\Reference\19_2_7_wetShoot\DSCN2625.JPG      
  (below) Planned the geometry for the lighting.  Lollipop shapes made from a square 'head' (encompassing WS bounds*0.XXf, diffuse+specular) and a tall 'tail' (specular).  The shape will be feathered by a single mask texture matching the lollipop shape.  Specular tail width and height are governed by a nominal max ground normal deviation (global, deviation from the ground effect plane).
Lighting system needs to self-regulate the number of pixels it draws (pre-emptively please), by shrinking the WS bounds of lights that are farther away but big on screen.
Sniper scopes though, they were always going to be a bit of a problem.  Not going to think about them till I have to.  I'd like to include them, but not if they're going to be more trouble than they're worth.
     
 
 
     
  C:\Noctambule\Photography\Reference\19_2_7_wetShoot\lighting.psd      
  Light ranges are now read in from the NWF and applied to projectors and to DeferredLighting.fx (via texcoords).      
  Lost a heap of time today because of the shouting.  I've worked out that it's someone next door screaming at the football, which is a big relief.  The sound of someone picking fights at the top of their voice is not a good sound.
If I can work out which team(s) are causing the problem, maybe I can plan around it.  Or buy him some tickets so he can do his yelling in the stadium.
     
  Terminology: I'm using Render (rather than Draw) for more 'final' rendering (even if it's still off-screen), eg. CLight::Render.
Using
Generate... for intermediate off-screen rendering, eg. GenerateDepthImages, GenerateShadows, GenerateImpactImage, GenerateReflectionImage.
     
  Added CLight; dispersed CProjector::DrawAll into CLightManager::Render, CLight::Render and CProjector::GenerateShadows.      
9-Mar-2007   0    
  Night off (knackered from last night).  Curry and film.
Film due back Fri 16th.
     
  This weekend I'm working on puddles and ripples      
8-Mar-2007   7.5    
  Options: Replaced 'general\aspectRatio' with 'realWorld\displayAspectX' and 'realWorld\displayAspectY'.
Checked that these work properly (checked shape of spheres).
     
  g_game.aspectRatio now replaced by g_game.options.realWorld.viewportAspectRatio      
  Stereoscopy no longer disables HDR bloom & glares.  I don't know what I was thinking there - the post effects actually make the stereo image much *less* confusing at the moment.      
  3DTV: Paint Shop Pro, Windows slideshow etc, they all fail to give proper pixel-to-pixel full-screen views of images - they add nasty little borders.  These borders stop the TV switching into 3D mode because the header pixels land at the wrong coordinates >:(      
  42" WOWvx TV: display width: 93.26 cm based on 107cm for the 'diameter'.      
  Options: End-of-line '//' comments work fine.  Maybe support full // and /* */ coments later, although when the menus go in you should never have to edit the text files manually, unless something goes wrong.      
  Checked that my 3DTV colour and depth sides are matching up pixel-to-pixel.      
  Added stereoscopy options
_3DTV_nearDist
_3DTV_farDist
_3DTV_disparityPower
_3DTV_headerTexture
Checked that these all work properly.
     
  3DTV: Had a load of trouble with header pixels not coming through at exactly their original colours.  Turned out to be D3DXCreateTextureFromFile; found this explanation in the DX help:
"Filtering is automatically applied to a texture created using this method. The filtering is equivalent to D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER in D3DX_FILTER."
     
  Finally got the 3DTV mode working.  Just crossing my fingers that it'll *actually* work tomorrow.<-It does - YAY!      
#version 10.4 Released v10.4.  This has the 3DTV mode in it.      
7-Mar-2007   4.5    
  Been clearing a path for the 3DTV mode which will be in a 10.3 build very shortly.  Improved and rearranged various code for this (options, stereoscopy, hdr).      
  3DTV mode currently forces:
fullScreenXRes:   1920
fullScreenYRes:   1080
frameRT:   [/2, /2]
Need to remember to omit the header pixels when windowed.
     
  v10.2 has tone-mapping blackouts on nVidia 6800 & 7800.  Moving the mouse and alt-entereing a few times gets you past this, till the problem area (whatever it is) comes back into view.  There must be a divide-by-zero in a pixel shader somewhere.  Anything to do with the sky?  Should go through all the shaders at work fixing potential db0's.  Would be nice if the DX software emulation could trap these for you somehow?      
  NOTE: g_game.GetDisplayWidth returns the display width not the current RT width.  However, this is also the viewport width, regardless of the RT dimensions (this is evident in CRainImpact::GenerateImpactImage).  Same goes for GetDisplayHeight.  Maybe rename these?
<- Doesn't seem to be the case now; see 22.5.7
     
  Options: ReadBool now accepts t/f, y/n, v/f, o/n, yes/no, oui/non, vrai/faux.  Only the first letter is checked.  Not case-sensitive.      
  Options: Added 'HDR\middleGrey' and 'HDR\finalMultiplier'.  The latter is especially useful if tone-mapping is disabled (set it to 100 odd).  NOTE: applies before bloom and glare, doesn't multiply those.      
  Remember '\n' works in UtilFatalError etc, all the message boxes.      
  Tone-mapping now pauses when the game is paused.      
6-Mar-2007   3.333    
  Fixed the anaglyph stereoscopy.  POM looks great in stereo, although at the same time its intrinsic artefacts become more obvious.
Would love to get POM pushing outwards rather than inwards, that would be 'the future'.  Need to look into that.
   
  Rain splashes look ok in stereo, I had nothing to worry about.  The shapes in each eye don't match but the positions do which is the important bit.    
#version 10.2 Released v10.2.  Stereoscopy working again.
Custom.txt profile is now 'permanent' meaning that the player's customisations persist between versions, yay! (provided the option/category names don't change).
Default.txt profile is now read-only because it should never be edited.
     
5-Mar-2007   4.83333    
  SVN: Got into a real tangle after using 'update item to revision' instead of 'revert changes from revision' :/
Darned prepositions.
   
  Finished the splash blending.  I'll leave it to soak now, ie. get on with the rest of the rain effects and come back to it later to fix anything that bugs me about it.    
#version 10.0 Released v10.0.  Stereoscopy is unavailable in this build.      
4-Mar-2007   8.5    
  Just noticed the RenderMonkey 'FireBall' sample (Fire.rfx), which is really quite tasty and very simple.  Might have a look at that again when I'm ready to do explosions.    
  (below) Rain splash blending going well, nearly finished.  Looks really nice pitter-pattering and catching the lights - adds loads :)  Doesn't lend itself well to being screen-grabbed though.    
 
 
   
3-Mar-2007   11    
  Got some decent footage last night, including puddle videos.  The rain still wasn't as heavy as I'd like though, but better than last time.  Last time it was 'light', this time it was 'moderate'.  I want 'heavy' or 'severe'.  The waterproofs were a good idea.    
#version 9.1 Uploaded private test v9.1 for M.  This disables HDR multisampling - just in case that could have been involved with his zbuffer problems.      
  Noticed that the (SetRenderTarget, Clear) pattern is used in lots of DX samples, so I assume it's the right way to do it (rather than using ColorFill).    
  ProjectorShadow.fx: Tiny shadow improvement to stop landscape getting a dark inner fringe when set against the sky.  It was an early 'clip' so should serve as a good optimisation too (er, when you're looking at the sky ;)    
  Had an embarrassing bug with a for loop.  A semi-colon and a comma had ended up swapped, so that a variable was getting re-initalised as part of the condition each time round.  D'oh! :|  Would've been easier to spot if I hadn't been faffing with FVF codes / vertex declarations at the time.    
#revision 363 Animated the rain splashes, also improved their shape a fair bit.  That's the first time I've EVER used point sprites (for the impact dots), but they were definitely the tool for the job.
There's currently only 48 dots, covering a 3x3m tile.  Render target is 512 like the stand-in texture was.
TODO:
- maybe use a displacement map (some tesselating pattern) to shuffle up the planar mapping of the impact dots over the environment.  You can see the tiling at the moment, but maybe the lighting/blending will hide that.
- noise normals need to account for viewport dimensions, aspect ratio, etc.
- need to prevent big tall impact streaks appearing down the walls (tricky because of the normal mapping)
- maybe try scrolling the noise normals down to make the droplets fall?  Or upwards to make them jump?  Or maybe one of each?  Just so you don't see droplets hanging in the air.
   
  So, onto the lighting/compositing of these splashes then...    
  REMEMBER: Non-enumerated FXOs are not yet reloaded by Reload!!  That confused me for a while, tweaking SolidColour.    
  Tweaked the lighting again to get the place looking dark & wet for the splash compositing.    
#revision 365 Fixed a bug where HDR glares/bloom were going missing on Reload (needed to set some effect variables in the restore).    
 
       
         
2-Mar-2007   4    
  The errors yesterday were because I had re-enabled multisampling in the HDR system at the last minute before building v8.1 I think.  RT and D/S surfaces have to match in terms of multisampling.  My RTs don't use multisampling so they were conflicting with the D/S buffer set by the HDR code.  In order for me to get any benefit out of FSAA, I think I'd need to enable multisampling for all four MRTs used for the main rendering.  I get the impression they would need to be created using CreateRenderTarget not CreateTexture, and to use them as a texture I'd have to StretchRect them onto one.
I might come back and put FSAA control in later.  I don't want to waste any time with it now; I've disabled it in the HDR code again.  Stuff like motion blur & DOF should greatly reduce the need for FSAA anyway...
   
  SVN: What on earth does 'incomplete' mean? (Noctambule & Source folders).  Reverting doesn't fix it, nor does cleaning.    
  Added the CRainImpact class which updates and renders the rain impact effects.  Belongs to the Environment.    
  There's proper rain out tonight.  Hopefully more where that came from.  TODO: flash photography of impacts on various surfaces (puddle/car/road/pavement/brick) in the same heavy shower, for splash shape/animation tweaks.    
  Considered breaking away from the project's prescribed coding style to experiment with C++ rectitude and develop more thoughtful conventions.  Then chickened out.  It's not that I don't want to learn the most correct ways of doing things.  It's just that I can't afford to lose any time being indecisive about code, and since I have no idea what exact style would best please the target audience anyway, I'd rather give them the impression that I can stick to whatever style guide I'm given.  By all means if there were to be an Exhibit B, it would be good to use a contrasting coding style for that...    
1-Mar-2007   4    
  Slightly worried about stereoscopy for these rain splashes.  Currently they'd be very inconsistent between the two eyes (can't test at the moment).  I'll wait & see how they look in stereo once they're lit & animated.      
  Spent more time faffing with device handling stuff, and got annoyed.  Still isn't completely clear.  Alt-enter does not destroy the device like the docs suggest it would, so the destroyed-device situation has never been tested and would probably crash?
Ordering is a big part of the problem too.  The code implies assumptions about when things are going to happen to the device in relation to when things are going to happen to class instances.  Every time I deal with this stuff I get annoyed, because it doesn't feel like it progresses the game at all, just feels like a horrible waste of time.
     
  InitDeviceObjects / OnCreateDevice: (The device is ready)
- Ready to create managed resources, ie those in D3DPOOL_MANAGED.
InvalidateDeviceObjects / OnLostDevice: (Device has become unavailable)
- Get rid of pointers to tetxures, effects and render targets, except those in D3DPOOL_MANAGED.
RestoreDeviceObjects / OnResetDevice: (Device has come back again)
- Get pointers to textures, effects and render targets, except those in D3DPOOL_MANAGED.
DeleteDeviceObjects / OnDestroyDevice:
- Must now delete managed resources, ie those in D3DPOOL_MANAGED..
     
  Tried changing CRenderTarget over to use D3DPOOL_MANAGED but the D3DXCreateTexture failed with D3DERR_INVALIDCALL.  No idea why, it didn't tell me.      
  At least now the zombie material is set up properly so it supports tweaks while the game is running.      
  Spent the whole evening doing faffy housekeeping stuff :(      
  TODO: Fix all the Debug-D3D errors that I'm now getting (when did this start?)
eg. On DEVICE->Clear.  This kind of stuff:
"Direct3D9: (ERROR) :MultiSampleType between DepthStencil Buffer and RenderTarget must match."
Could this have anything to do with M's v8.1 glitches? <-v9.2 will determine this
     
28-Feb-2007   2.75    
  TODO: blow these splash extrusions around according to wind - that will be lovely.  Bonus points for a 'wave' effect when it gusts.    
  Experimented with multi-pronged splashes but it was too hard to disguise what was going on.  Instead I fattened up the dots on the placeholder texture and broke up the splash tips with a noisy normal map.    
#revision 351 (below) Pretty happy with the splash shape now, so I'm going to move on.  Tossed a coin as to whether to animate or light it next - animation it is!    
 
       
27-Feb-2007   4    
  Got the rain splashes projecting out away from the surface normals.  Tried having them reflected by the normals but it looked cack.  It made the problems more obvious, made the splashes twice as bendy which I don't want.
Artificially 'flattening' the splash direction seems to work better, keeping the length the same (ie. making it less vertical)
   
  From now on I'm making sure that normals are always normalised before being written to the normals buffer.  Saves me having to worry about it in the deferred shaders.    
 
 
     
#revision 346? (above) That was a bit flukey, the breakup is caused by the ground normals.  Shows promise though.
TODO: Try to recreate that shape in a more controlled way (use a fine random-noise displacement/strength map, affect far ends of the splashes more).<-done
   
26-Feb-2007   2.83333    
  tex2Dgrad is a nice cheap way of doing anisotropic blurs.  Could be useful for the motion blur.  Or for the falling rain even?    
  D3DXComputeNormalMap, eh?    
#revision 341 (below) This is *just* using tex2Dgrad with dy*30 - I'm not doing any of the work there, tex2Dgrad is!
Those are single texture samples!!
I like tex2Dgrad.  It's good.
   
 
 
     
  EXCEL: Can't ctrl-V images into the sheet, if you do they export as giant EMZ files even after you've told Excel to compress them & reduce resolution.    
  EXCEL: Need to remember to tell it to compress all images.  Use "web/screen", "compress pictures" and "delete cropped areas".    
#revision 342 (below) Early test with a (literally) v-shaped filter.  You can see where I'm going with it.    
 
       
25-Feb-2007   10.998    
  WEBSITE: added subdomains 'devlog' and 'lecauchemar'.
Devlog file is now devlog/index.htm
     
  Automated devlog image file handling.  There's now just a single 'devlog' folder for me to copy up each time, and I can (hopefully) skip the overwriting of the image files, unless I've gone back and changed/resized old pictures or that.      
  Added a NoctambuleShaders project by copying the main project and deleting everything but the shaders.      
  FXOs are now built to source\debug, source\release and source\master, depending on config.  This is tons better.      
  Tidied-up effect loading.  Doesn't do any searching now so should be faster.      
  Rain impacts not extruding in Master - what's that all about?<-(26th) was using an increment variable in a for loop that did texture samples.  Which is something that doesn't seem to compile properly.  Had the same problem with ShadowBlur.fx on the 27th Jan.  I haven't looked at the disassembly yet; the important thing is to remember to avoid doing it.      
  NoctambuleShaders.vcproj: Needed to set project type to 'exe' otherwise $TargetDir was empty (so FX build rule compiled to the wrong place).      
  TODO: support reload of zombie material (CAnimMesh needs an InvalidateDeviceObjects)
Currently that material is skipped in the reload<-FIXED
     
  Made a Shaders.sln because it didn't seem to be possible to compile FX files while the game was running, unless they were moved to a separate solution.  This is working now :)  Seemed to cause a couple fo GPU hangs/resets but now seems to be behaving again...
Shaders.sln contains all the FX files (set up to build exactly as before), plus a ShaderBuild.vcproj which, when run, builds every FXO in every config.
   
  Added a CNoctambuleApp::Reload method which is called on gain-focus and on spacebar.  Currently re-loads all the enumerated shader effects.  Will add re-loading of leam.x and leam.nwf later.  TODO: add an option ('debug' category) to prevent HDR re-init (this causes a gentle tonemapping burst which could be awkward when debugging something visual).<- sorted, see g_game.flags.fakeDeviceLossForReload.      
24-Feb-2007   12    
  TODO: Support Max 'groups'.  Currently, grouped scenics don't show up in-game.      
  Try to remember that ZENABLE means 'Z TEST ENABLE'.  I wish they'd named that properly.      
  Fixed the reflections of cars and zombies cutting out - vertexcolour.fx wasn't zwriting/ztesting so reflected skydome was covering them up.      
  MAX: Tesselate modifier is tons neater than Subdivide.  Now using it on the cars.      
  CONTROLS IDEA: hold space to crouch; tap space to jump?      
#revision 317 Made a really important fix in Mesh.cpp: compensation for normals that are crushed by irregular object scale (I had kind-of imagined Max would fix this for me but it doesn't).
Cars' lighting was very broken this morning but now it looks lovely :)
     
  Had to reset the scale/transform on generalLandscape, otherwise rotating the test objects made them shear.      
  TODO: move projector::drawall into environment::rendersubset<-done      
  Spent an embarrassing amount of time trying to work out why my rain splashes weren't filtering.  Turns out UtilDrawScreenQuad was forcing the filtering to POINT.  That'll do it.
CHECK THE OBVIOUS!!!
     
  Used the CTexture class (for the first time) for the rain-splash dummy texture.  Nice & easy to use.      
  Rain splashes going very nicely.  TODO: use tex2Dgrad to counteract the ellipsing of the impact dots?  Can maybe then switch back to lower-res (fixed-point, filterable) source RT.<-done and done, works a treat.  Had to turn off mipping now I'm biasing the lod though.      
 
 
     
 
Realised I could add pictures to this Excel doc.  Pictures in a dev log are good - I'll probably automate the file handling of this tomorrow.  Here's some pics of my placeholder cars and the beginnings of my rain splashes.  The two spheres are Wet Ball and Dry Ball; they show the min and max gloss levels.    
         
23-Feb-2007   4.75    
#revision 314 That revision is a safe copy of the early parallax rain impact test.
I'm not going to use that method because although it can look great, it really works by fluke and could therefore be difficult to tame.
I've gathered some valuable info from resurrecting it though, which I intend to use in the proper version.
Eg. using the splashes/droplets as a screen-aligned height map for refracting the lighting/scene.  The gist of the effect was really just those cute blobs & plips refracting the radial ripple highlights behind them.
     
  Came up with a plan for rain impact splashes.  Found good reference videos at www.lucidmovement.com      
  Added some placeholder cars to help test the rain effects.  Gave them the dimensions of an Audi TT because they kinda turned out that shape.      
22-Feb-2007   3.666    
  Rain impacts going fine.  TODO: consider sorta v-shaped screen-space splash filter.  Use a downwards-offset sample of the position buffer to determine the distance of the splashing surface, for perspective.<-doing this stuff now      
21-Feb-2007   4.1666    
  Learned about SVN tags and branches.  I'll create a branch for every version of the game.      
  Branched v9.0 and made a couple of tiny fixes (missing files, literal path).  9.0 gives M exactly the same bug as 8.1 did.  9.0 and 8.1 both work fine for me at work though.
I'm not going to investigate this till after the rain milestone.  It's not like it's crashing or anything, and the rain is URGENT.
     
  SVN: MERGE: Select Merge from the DESTINATION folder, not the source.      
  MAX: Can't save DX shader materials to a material library - it doesn't remember the textures and uses the FX's defaults instead.
Also If you try to explicitly load a library containing a DX material (rather than just putting it to the default 3dsmax.mat), you get this crash:
Error loading ParamBlock2 / Invalid file - only partially loaded
     
  So I'm just going to have to 'make do' without being able to safely store my materials.  Anything I especially want to keep, I'll just have to map it onto a non-exporting dummy object >:/
It's bad, I've already lost some materials.
     
  Got some slightly more encouraging results with the rain impacts...      
20-Feb-2007   3.25    
  TODO: REALLY NEED TO IMPROVE SHADOW CULLING.  Many objects' shadows go out of view when the object is out of view, but currently the shadow is always still being generated in this case.      
#version 9.0 Released test version 9.0 en to the M.  Not public.      
  v8.1 exhibited zbuffer problems chez M.  Made some code changes in the hope of fixing this (v9.0)      
19-Feb-2007   2    
  Did a general reference shoot in light rain this evening (properly dark).
Well worth doing, lots of useful stuff to keep me going till it rains properly.  No real rain effects this time, but plenty of wet surfaces and lighting/shadow reference.  Plenty of nice water on cars, but my camera wasn't good enough to capture it clearly :(
Cling-film for waterproofing worked ok.
   
  Corrected my registrant details (at nominet.org.uk) for all domain names except the .org (which they don't deal with).    
  TODO: have a think about light that bounces off windows and then casts out to light the scene.  A few of my photos from this evening show this very clearly.  Could be one of those effects that adds a suprising layer of realism, and my gut feeling is that it's very doable.    
  Made a nice de-oranging make-it-look-the-way-it-actually-looked filter in CS2.  Fixes my photos nicely (testadjust.psd).    
18-Feb-2007   10.2497    
  TODO: parallax.fx: deal with g_vTextureDims - this can be neatly driven by the 'texture res aspect ratio' property.      
  POM shearing was caused by irregular U/V scale      
  Could HDR blackouts have been anything to do with those luminous CRUK windows?  Now hidden so they don't export.      
  Backface culling is definitely the wrong way round on PZ shadows.<-FIXED, TODO: neaten/investigate.
Still doesn't allow me to get PROJECTORSHADOW_DEPTH_BIAS down to ~zero.
     
  POM: To prevent shearing, textures must always be mapped with REGULAR SCALE; any irregular scale needed (to match the texture's natural world-space aspect ratio) should be effected using the material's 'WS Texture Width' & 'WS Texture Height' properties.
Can easily add a Width Factor / Height Factor later if it's useful, but I wouldn't want to add it without good reason.
     
  NOTE: 'Scale' parameter in nVidia normal map filter is height map scale in texels.
My system is now such that normal maps must always be exported with the 'height scale' set to equal the texture x resolution.  ALWAYS ALWAYS!
Also remember to use the 'wrap' option.
     
  Photoshop: Converting from Greyscale to RGB Colour degrades the image unless you switch to 16bits/channel FIRST.
TODO: Make a photoshop action to convert from a height map right the way through to a normal map, via the optimal route.<-DONE(20.4.7)
     
  Can't find 'Noctambule Actions.atn' (Photoshop actions) must've left it at work.->nah can't find it there either, ah well, it didn't have much in it, just a few tests really.      
  NOTE: there is no problem with converting non-square height maps into normal maps, as long as the texture ends up mapped at its natural world-space aspect ratio (as it should do with the system I've put in place).      
  TODO: Max_Parallax.fx: free up some arithmetic slots so that PSProcessTangentSpaceNormal can be called.      
  Remember when testing specular POM results that the deferred lighting positions don't yet take into account the POM (need to sort out shadow stuff for that to work).      
  Colour map alpha is now gloss level.  This is multiplied by the parallax material's 'gloss range' property.
TODO: Might want to map 'illumination colour' to control bumpiness at some point?
     
  TODO: Set up a Max material library so nothing gets lost.      
  MAX: when you create a new mesh, you have to 'initalise' its vert colours by tweaking them a bit, otherwise they'll be random nonsense in the game.
Non-mesh objects will have uninitialised vert colours in game :/
     
  Parallax material now shows vertex alpha and vertex gloss, both in Max and in game.      
  TODO: What scale should my UVW modifiers be using???
<-UVW modifiers should use a width/height/depth of PARALLAX_REFERENCE_TEXTURE_DIMENSION, which is set to the default dimension for the UVW modifier, 1 metre.
     
  Spent most of the day getting my normal+height map system nailed.  Extremely pleased with it - the normals ending up in the WS normal buffer are now the ACTUAL, CORRECT normals for the surface, based on the POM extrusion, the UV scale, and the natural world-space dimensions of the texture.  Getting the normals exactly correct is far more important when using POM than it is when using 'bump mapping' or squidgy 'parallax mapping'.
TODO: chuck together a no-frills document explaining the mapping system (partly so I don't forget it all), and put it on the site.  Might be useful for people at work.
     
17-Feb-2007   11.834    
  Now using the prefix 'c' for shader constants.
Some of the constants in any shaders I export from RM will be like '__SpecularPower' etc, that's so the RM FX exporter knows which semantic to give them.
     
  MAX: Why on earth do UVW modifiers sometimes inherit a scale that the object doesn't have??!
- tried resetting object's transform & scale before adding the modifier
- tried converting to editable mesh before adding the modifier
     
  Noticed that I had a typo that was saying vertical fov = aspect ratio each frame!  Fixed.      
  Fixed auto-fov.  Gives a much lower fov than fps players will be used to (in fact they'll probably hate it), but I think it brings you more into the scene, as if it were real.  I also think a low fov is particularly well suited to a dream environment because...well that's the way I dream - a bit tunnel-visioned, more concerned with details than periphery, never knowing what's round the next corner.
Plus it will balance better with the degree of detail that I want to show off in this game.  And it *totally* justifies the POM.  Placeholder brickwork is currently set to 1cm, yet the benefit is strikingly visible.
     
  Got a GPU hang in fullscreen mode after fixing the fov (POM not benefitting from mipping as much, etc).  Used the reset button.  When I came back to it it was in the dos startup saying 'DISC BOOT ERROR, PLEASE INSERT SYSTEM DISC'.  Powering off and on again fixed this.      
  Reduced the number of samples in the POM, seems happier now.  Still getting up above 90°C (fullscreen) though, with no overclocking at all.      
  Added some useful properties to the parallax material.  These future-proof against changes to textures (of which I'm sure there'll be many).  TODO: keep these in a header for all landscape materials to use:
Natural world-space measurements:
- texture width
- texture height
- texture depth (height map distance range)
Other measurements:
- texture res aspect ratio
Adjustments:
- depthFactor
     
  MAX: Can't choose DDS files for dx shader materials?!      
  Colour-burned sharpen for wetting effect?      
  TODO: support the PROJECTOR_ENABLED define being 0 (currently gives black screen)      
  TODO: support tone mapping being disabled (currently super-dark)      
  Found that a lot of my landscape tangents & binormals were knackered, hence the POM faults and the faults I used to see with non-deferred lighting.
Tried exporting leam.x with 'optimize mesh' set to normal / none - made no difference.  Usually set to 'optimized'.
The ATi POM demo loads all surface vectors from the model file, which is in some format of their own.
     
  <- FIXED.  Just had to pass true for the bSplitVertexForOptimalTangents parameter of CMesh::SetVertexDecl.
Trees pom is still weird even though their surface vectors were fine all along (only 'square' stuff had bad ones).
TODO: investigate
     
  I'm going to carry on using subdivide modifiers, but only very MILD (coarse) ones.  There are some genuinely bad polys in the landscape.      
  TODO: couple of Max scripts:
- one that exports leam.x & leam.nwf
- one that adds the selection to 'buildings' layer and connects it to 'generalLandscape'
     
  TODO: bumpiness (normal) control?  Tie this into DepthFactor?      
  Sketch in diary in 28th May shows vertex shader requirement for protruding POM.      
  Still got some minor shearing on my pom bricks.  TODO: Get to the bottom of this!!!!<-fixed see 18th      
  Made some improvements to the lighting model, including a Fresnel term for the specular.  The power for this is dependent on the gloss level (less glossy = higher power = more "reluctant" to show specular highglights).      
16-Feb-2007   2.41667    
  PAYPAL: Withdrawal (transfer to bank) charges: Free over £50, else 25p      
  Noticed there is a 'MySpace Film' network now.  Registered the addresses 'lecauchemar' and 'programmerart', just in case the site is stable enough to be worth using in a year or two.  I hate MySpace.
Login details are in the 'archive' folder for now - need a neater place to file all correspondence later on.
     
  FX and FXO files still live in Source\HLSL.  FXO location isn't set in stone, makes no difference to the build process after all.  But I don't want the FX location to ever change:
IMPORTANT: Moving the FX files resets all the material properties in leam.max!!
     
  NOTE: next dxsdk install should automatically install the plugins for CS2, I'm hoping.  Till then I'll use Photoshop 6 for likes of normal-map generation.  TODO: maybe sorta 'hide' photoshop 6 when I install dxsdk?      
  Still playing with the parallax shaders and planning the rain impacts....      
15-Feb-2007   3.166    
  Got the shadows back into a decent state.  I've made all the depth images backfaces-only, which makes the shadows connect properly with their casters (was previously a big nasty gap).
For some reason PZ shadows still don't connect properly - TODO: FIX THIS!<-FIXED, TODO: neaten/investigate
Wasn't able to reduce PROJECTORSHADOW_DEPTH_BIAS much (glitches, not sure why), but it doesn't seem crucial to do so anyway.
     
  Had another bash at getting the FX files building neatly, still couldn't do it.  I'm not sure if I'm wasting time by even trying to make it work - might just not be possible full stop.
Found that I can compile a multi-selection of FX files though - that might be helpful in some situations.
Had a look at the DX samples but they cheat totally by not setting any build tool on the FX files.
     
  ...Eventually managed to make *some* progress on the FX build situation.  It now knows which FX files have changed and only compiles those.  Unfortunately it still only compiles one file per build, but it's still better than it was.
Found that skipping the assembly txt output speeds up the compile a lot.
TODO: finalise FX & FXO locations; get the game code to find the FXOs in the right place!->done see 16th
     
  Removed CLandscape::RenderGroundDepthMask into stuff.cpp      
14-Feb-2007   4.25    
  Fixed one of the shadow problems (h_Projector.fx \ ProjectorDepth_PixelShader, DEPTH output was being re-divided by the projector distance range).  This fixed the new(?) glitches on east lamppost and west tree.
#revision 272
     
  TODO: FIX: Noticed that zombies are not receiving landscape shadows!!<-FIXED      
  Rearranged the HDR stuff into class C_HDR (hdr.cpp/h).  Tidied out junk.  Moved the magic to be around the environment draw, not the entire game draw.
TODO:
- Get the HUD back, it's become hidden now
- move stereoscopy to be inside the HDR magic (around env draw) rather than around game draw
     
  Realised that only the BACKFACES of objects (need to / should) write to the depth images.  This allows a smaller (0?) PROJECTORSHADOW_DEPTH_BIAS (^_^).
TODO: GET THIS WORKING!!!<-see 15th
If doing self-shadowing POM, need to draw the front faces too, but only the backfacing pixels thereof.
     
13-Feb-2007   3.75    
  Can't get any blackouts now (at home) what's going on?  Removed the 'saturate' in deferredlightingapply
TODO: Test for blackouts at work
     
  Found that tweaking the HDR 'key value' is probably the best way of brightening/darkening the scene.  TODO: put this into an option.<-done      
  Started planning raindrop impacts, got some photo reference...........      
  Ported the DX parallax mapping and parallax occlusion mapping shaders; got both effects working nicely on my placeholder brickwork.  The POM is adding a lot, makes the walls feel chunky and tactile.  Can't wait to use it on proper textures.
Adding a temporary subdivide modifier to bedford court cleaned up the results a lot, but there's still some odd polys.<-FIXED see 17th.
     
12-Feb-2007   2    
  Sent out the first news letter.  Took ages, which is one of the reasons why I won't be making them very frequent.  Not sure how to log the time spent on stuff like that (or on the website for example).  I'll log it like it is for now - it is time spent on the project after all, kinda.  Maybe improving my pace on that kind of thing is something I can work on.
Don't use HTML next time, too many glitches.
   
  Added a 'Newsletters' folder to archive the news letters.    
  The v8.1 download works just fine on the 7800 at work, phew.    
11-Feb-2007   5.66667    
  Got my charity account working in PayPal finally, set up a donation button on the site.  Doesn't accept payments from me (error 3005), but hopefully it works for anyone else(?)
NOTE: do not set up bank funding for (or "confirm") a savings account!!  That's 'crossing the streams', apparently.
     
  Noticed that puddles are changing size/shape depending on viewing distance.  What's that all about?  Mip-mapping?  Fogging?      
  TEMP BODGE: Added a 'saturate' at the end of DeferredLightingApply - this completely prevents blackouts, and doesn't currently look bad.<-removed now      
  Got the test for floating-point blending working - FOR THE MACHINE AT WORK.  On my ATi the test query result says it can do float blending (in all device configurations) but it can't.
So I'm now just using 2TTT unless the query says that the card can't blend to it (options.cpp).
     
  Tone mapping is very unresponsive at work - like, it barely changes.  Much nicer on mine for some reason.      
  TODO: get rid of the 'UI' folder!      
  Noticed some of the shadows are suddenly worse than before (eg. east lamppost, west tree)->FIXED #revision 272      
#version 8 Released version 8.  labelled the commit "version 8"      
4-Feb-2007   11.833    
  Cyan & green look practically the same through the red filter, at any brightness.  Green leaks into red tons more than blue does.  In fact red blocking blue is the only filtration any of these glasses manages to get right :(      
  Got deghosting working in all the anaglyph combinations (using defines), although it currently forces cyan to blue.      
  Added some more example profiles.      
  7800: seems I can create 2TTT targets just fine but not blend to them.      
  LCD monitor at work filters slightly more cleanly than my CRT at home.  In particular the green & blue filter out very well (blue looks just like black).      
  failed an assert one time when starting up the master build: assert(cameraEye==centre)      
  got a few blackouts.  At work they don't fade back up so you have to alt-enter which fixes the blackout instantly.      
  7800 does do float blending, phew.      
  Caps viewer reports 7800's memory as video:256, texture:512      
  more parts of the image make it into the HDR high pass for some reason (eg. diffuse patch on bedford court).  Worrying.      
  managed to remove several zbuffer clears.  Added a new one into projector::drawall (needed to otherwise frame size < screen size caused zbuffer junk)      
  remmed out 4 setrendertarget(0,NULL)'s because this is illegal (they were just crazy random tests anyway)      
  Can't seem to prevent blackouts by clamping luminance any more, hmm      
  Blackouts are getting really annoying, but easily reproducable at least.  Shouldn't really put a build out till I've fixed them.  See note above,  that's odd.  More tinkering required :/
Might be a divide-by-zero in a pixel shader somewhere...
     
  Fixed the crazy feedback in the ground reflections (looked like the world's lamest fire effect and was therefore a show-stopper).
Had just been using the ordinary deferredlightingapply rather than the reflected one.
     
  This green fill colour means I'm at work using an nVidia 7800.      
  Couldn't manage to test for floating-point blending support...  Asked on the work forums...see if anything comes back.
CheckDeviceFormat with D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING always returned D3DERR_NOTAVAILABLE, no matter what format I checked
     
  Tweaked the lighting so it looked decent on the 7800, no idea what it'll look like at home...      
  Failed to put version 8 out the door :(  Won't be able to do any more for another week (Leeds gig).      
3-Feb-2007   6.83333    
  Found the wxdebug 'REMIND' macro and adapted it to suit.  Eg:
#pragma REMIND("temp test")
outputs
c:\noctambule\source\options.cpp(201): REMIND: temp test
     
  This game, formerly codenamed Project 'Noctambule', now has a name:
Le CAUCHEMAR
Checked with Mr. B that this didn't sound totally naff or anything.  It's quite scary choosing a name for something as important as this, especially a name in a foreign language.
The letters have a nice shape to them, I'll enjoy doing the titles.
I've only heard of one film with this exact name, and it was made in like 1893 or something!  I'll have to watch it some time.
     
  Bought lecauchemar.com from the usual place.  Got it for 3 years.  All the other domains are free as well, surprisingly.
lecauchemar.com currently points to programmerart.org/lecauchemar.
All mail ^lecauchemar.com goes to ^programmerart.org
     
  I'm almost hitting my VRAM limit :/  Was crashing when I upped the patchwork colour RT to screen-size.
Need to sort this out...
     
  Got rid of the 'FRAME' RT in monoscopic mode.
TODO: Can do the same for anaglyph but not when deghosting is enabled.<-done
     
  Merged AnaglyphFrameCopy into DeferredLightingApply, using an ANAGLYPH define.      
  Added an ambience component into the lighting - looks good.      
  Fixed the blockiness that had started with the shadows (needed to clear the source RT to full 'diffusion' (green).      
  Wasn't on great form today, need to pick up the pace tomorrow to get that build out.      
2-Feb-2007   2.5    
  Got the game compiling and running at work (didn't need to do anything except make sure all me files were in SVN).
Was pleased to see the reflected lighting corruption is fixed now.
     
  DXUT: command line: use eg. "width:320 height:240", not '='.      
  Added a 'Custom.txt' profile that ships and always overrides Default.txt.  The player is advised to edit Custom rather than Default.  Also added some example profiles for the player.      
  Got the "fullScreen", "fullScreenXRes" & "fullScreenYRes" options working.
Also added "windowXRes" and "windowYRes" which are working nicely.
     
  BUG: Mouse pointer appears in full-screen mode when res is extremely low (like, 320*240)      
  The game looks like it's well on target for a version 8 release this weekend, probably early Sunday evening.      
  TODO for version 8:
- Compatibility work on nVidia 7800 (lighting fixes)
- Optimise lighting for cards with floating-point blending?  Still haven't found the caps flag for that yet.
- Spruce the place up a bit.  Put new bulbs in the streetlights.  Build some ground detail, don't be shy! (pull textures from Photography\Texture\TextureShoot_17_9_5).  This process should tell me whether or not I need to buy a new camera (probably should).  Do that 'texture dimensions in the VS' thing??
- Improve & optimise PatchworkDimpleProcessing.fx?

- Fix remaining anaglyph modes and get ghost reduction working for all of them.
- Give the project its final title (and buy the domain)?
- DON'T try to make any shadow fixes.  Lighting tweaks are ok though.
- Was thinking about putting some parallax mapping in for the buildings.
     
1-Feb-2007   4.16667    
  Pragma'd-away some warnings (Global.h).  Using push&pop for constant conditional expressions (at least trying to - the compiler seems to be ignoring me (?)).
Not totally clear on C4238, which I've disabled for now ("nonstandard extension used : class rvalue used as lvalue").
     
  Noticed that DX HDR sample has a flash of over-exposure whenever you resize its window or alt-tab/alt-enter.  Also just after alt-entering / alt-tabbing, you see a one-frame flicker like I get on mine (no visible corruption in the flicker though).      
  Options are now re-applied when the game regains its device (so window size changes / alt-enters work properly).      
  DX HDR sample, when set to startup full-screen, also does the initial 640*480 black box thing that I get on mine.  I get the feeling it's harmless.<-Nah it doesn't if done by the command line, hmm      
  NOTE: Apparently if you use the desktop resolution for fullscreen it avoids a slow mode change.      
  Nearly got the "fullScreen", "fullScreenXRes" & "fullScreenYRes" options working.      
  Added "language" option.  Need to work out a better way of doing the two different installs though.  Having two totally separate install projects is crazy (keeping them both up to date as I add files).  The only file that needs to be different now is the Default.txt profile.      
31-Jan-2007   2    
  Distorted ground reflection now draws to its own float RT which is used as a texture in DeferredLightingApply.
So good to get rid of that banding I had before - phew!  Gets rid of a nasty buffer copy too.
     
  Started using a nice easy method for FX variations, eg. reflected & non-reflected.  The reflected version is just two lines that say
#define REFLECTED
#include "TheEffect.fx"
Job done!  No faffing with headers.  Should've thought of this earlier.
     
  Having the enemies only visible in reflections & shadows looks quite scary, hmm...      
  TODO: should be able to use the ground reflection (source) image as an environment map for weapons etc, if I'm careful about it.      
  TODO: work out why the reflected landscape render is covering-up the reflected zombies (was the same yesterday I'm pretty sure.
<-(1.2.7) Could not work this one out - used a horrible bodge for now (enemies are placeholder anyway; their render will change)
"pMesh->DrawSubset" (for the landscape) was the line that was causing the zombies to get hidden - exactly as if the zombies hadn't written to the zbuffer (which they do, of course)
     
30-Jan-2007   2.666    
  Looks like the reflections are lagging 1 frame behind?      
  The 2TTT specular buffer is not up to the job of holding the ground reflections and specular on the same scale - the banding is fatal.
So here's the plan:
TODO: Make a new float RT for the ground reflections to render into (needs to MRT-in with diffuse+position+normals).  After the deferred lighting has applied over the scene, add the floating-point reflections, which are already weighted by ground gloss.  Remember to use the nice clean version for cards with float blending.<-done
     
29-Jan-2007   2.83333    
  Got everything sorting properly again.  Right mess at the moment though, needs a cleanup.
TODO: TIDY UP THE ENVIRONMENT RENDER!
TODO: GET REFLECTED LIGHTING BACK
     
  Quickly tried 'wetting' my placeholder tarmac-type textures.  Instantly gave the effect I needed, making the road paint stand out as it should.
The new lighting model is lovely, a zillion times better than what was standing in for it.
She's actually looking quite pretty at the moment; version 8 should be quite the looker :)
I can safely say that this game is starting to take on the look of the far-fetched mental screenshots that inspired it.
     
28-Jan-2007   8.5    
  The first parameter of device->Clear is NOT an MRT index!!!  Clear clears all surfaces of the multiple render target.      
  Did a test to see if interlacing two anaglyph halves would reduce ghosting (mockups\anaglyph).  It didn't, on my CRT monitor.      
  Realised that the glitches in my new lighting system were being caused by (LACK OF) floating-point blending.
Grrr why didn't they support it?!!!  We NEED that!!
     
  Noticed that the nVidia 6000 and 7000 cards support floating-point blending (with format restrictions, eg. maybe only FP16).
My card doesn't seem to support it at all.  It can sorta attempt the blend but this causes corruption (flickery speckles, missing lines, weird colour cutoff) :(
     
  Upped the warning level to 4.      
  TODO: for reflections, look up D3DPTEXTURECAPS_PROJECTED.  Might be able to take some maths out of the shader.      
  Got a series of really nonsensical crashes trying to run the game.  Restarted the PC, rebuilt all and it's been fine (???)      
  Blending to D3DFMT_A16B16G16R16 (HIGH-PRECISION INTEGER) buffers is not possible, on my card at least.      
  ...but it CAN blend to D3DFMT_A2B10G10R10.
So maybe the best I can do is use 2TTT for ATI cards and FP16 for nVidia ones.  For the lighting buffers I mean.
TODO: Should put the FP lighting buffers into an option, for debugging/cheapening.
     
  Fixed another possible cause for the reflected lighting corruption: a needless OnResetDevice for the ground effect, in CLandscape::RestoreDeviceObjects.      
  Got a couple of nasty hangs, GPU resets etc. Not overclocked, but ATITool might have been running on each occasion, not sure.      
  Got the distorted ground reflection rendering into the specular buffer (via the final-frame buffer, so it can MRT-in with diffuse+position+normals).  (TODO: skip that detour if floating-point blending is supported).
TODO: Sort the sorting!
     
27-Jan-2007   9.75    
  Remember to convert shader effects in ported code into ESHADEREFFECT entries, otherwise compiler settings will be wrong!  HDRLighting suffered this, fixed now.      
  Blackouts hadn't gone away at all, I had just been hiding them by clamping :(  Back to the drawing board then.      
  I've re-enabled hdr multisampling and I'm not going to clamp the blackouts for now.  Don't want to risk skewing my tone-mapping results, plus I want to get used to the blackouts to see if I can spot a pattern.      
  tone mapping currently quite well-behaved with *10 specular.  *100 it's very glitchy.      
  Noticed that the HDR code is always using 'device->ColorFill' rather than Clear.  Is it faster?      
  Added HDR options.      
  There's now a 'Debug' profile that only loads in _DEBUG config (overrides 'Default')      
  New lighting model (DeferredLighting.fx):
- "gloss" is drawn into normals.a.  Gloss allows DeferredLighting to control specular intensity, specular power, diffuse/ambient intensity.  Gloss allows ground.fx to control reflection strength.  The wetness-darkening disparities between say tarmac and road paint will be done by editing the textures / patchwork vert colours.  Puddles have a gloss of 1.  A rough or absorbent material, say wood or concrete, might have a gloss of 0.5.  A manhole cover might have a gloss of 0.75.
- Reflections will now draw to the specular buffer, where they will be added to by specular from lightsources.  Reflectiveness and specular intensity will therefore become the same thing, a result of gloss.
- Puddles (rippling etc) will be the job of Ground.fx.  The rippling will determine normals, and the height will influence gloss.  Gloss must not influence water effects, since it's used for dry shiny surfaces too.
     
 
- Raindrop spatters can be animating decals of normal and gloss.
- Env maps will write to the specular buffer, so they don't get treated as diffuse colour.  A pure chrome object would have black diffuse (for no diffuse lighting), gloss=0 (for no specular lighting) and would then be coloured purely by its env map in the specular buffer.
- Rain running down a windscreen would be drips/streams of gloss and normal.
     
  CModeEnvironment::RenderSubset: made a possible reflected lighting fix (lighting strength channel might not have been getting cleared)    
  Made good progress on the new lighting system.    
26-Jan-2007   3    
  fxc: I gather the /Vd (disable validation) flag controls whether or not the compiler enforces the shader model's instruction count limit.      
  the define '_TEST' is now reserved to mean 'in the Test build config'      
  Read up on vs2005 build rules.  Improved my FX rule to take custom parameters so that FXC's optimisations are enabled on release & master.  Also passes the config define through rule parameters.  Had to make the ConfigDefine parameter non-'inheritable', otherwise, bizarrely, the files didn't inherit the value from the project (??)
Ground.fx went from 139 instructions to 85.
     
  ShadowBlur.fx was failing to blur the shadow image if FXC optimisations were enabled! (ie. if /Od is removed).
Fixed this by removing an algorithmic optimisation from its 'for' loop (revision 218)
     
  Got another instant-reset crash, when pressing F5 in visual studio, with hdrlighting.fx open.  Bootup message said ATI drivers as usual.      
  ...and again, at the beginning of game startup by the looks of it.      
  Installed latest ATI drivers.      
  Installed CS2      
  Stopped getting blackouts.  Had a suspicion they might have been caused by overclocking, but I can't get them to happen now even with vicious overclocking.  Drivers??  (((ShadowBlur.fx????)))
Re-enabled HDR multisampling, working fine.
     
  Dare I say it ... PHEW!      
25-Jan-2007   4    
  blackout hotspot (viewpoint, look down):
  x -10151.694
  y 757.61230
  z 9094.2930
     
  The blackouts were 'caused' by spikes of CalculateAdaptedLum\fCurrentLum which would normally be somewhere well below 2.  Spike values are very large, probably infinity or something.
Added a bodge to kill off the spikes.  Obviously I'd like to know where they're coming from but I can't be bothered spending any more time investigating it at the moment.
I'll come back to it later in the project when it's hopefully fixed itself ;)
     
  The 'spectral' glares look best on white objects, can be slightly mucky otherwise.      
  Noticed that I've been compiling my FX files with optimisations and preshaders turned off.<-fixed      
  Fiddled with the build rules again, still can't them working properly.      
  Really have to set up my proper lighting model now (see 11 dec); the current purely-additive setup is really naff.  And get it behaving nicely with the tone mapping, blue-shift, (& glares?)      
  FX build rule(s) currently broken      
24-Jan-2007   5    
 
- disabling projectors now makes the glares appear
- removing the createtexture keeps the glares and some lighting appears, as do the blackouts
- multiplying-up specular ALWAYS causes blackouts
- *10 caused a blackout, but it seemed more reluctant than 100
- blackouts still happen when flycam is underground
     
  rt/depth size warning: CProjector::GenerateDepthImages      
  Some run-time warnings/errors to investigate:
- Direct3D9: (INFO) :No render target available for the given RTIndex.<-think this is from GetRenderTarget, who cares.
- Direct3D9: (WARN) :Can not render to a render target that is also used as a texture. A render target was detected as bound, but couldn't detect if texture was actually used in rendering (RenderReflectionImage\CProjector::DrawAll)<-was silly ordering in CModeEnvironment::RenderReflectionImage.
- D3DX: ID3DXEffect::EndPass: EndPass called while not in a pass (RenderReflectionImage\RenderSubset\pLandscape->Render)<- invalid texture filter modes (anisotropic) in bumpy.fx
- Direct3D9: (WARN) :Cannot compute WNear and WFar from the supplied projection matrix (GenerateDepthImages)
     
  Added ".r" to some places in HDRLighting where it seemed sensible (was a getting a warning in max debug mode)      
  Still can't figure out this one (bumpy.fx).  Doesn't seem to cause a problem:
D3DX: ID3DXEffect::FindNextValidTechnique: No subsequent valid technique found.
Gives no warnings at UtilCreateEffectFromFile.<- invalid texture filter modes (anisotropic) in bumpy.fx
     
  shadow dest, index 1      
  got an instant-reset crash (doing a silly temp thing with ORTs)      
  turned the blackouts into a 1-frame flicker, might be a bit more helpful.
FIX THE BLACKOUTS!
     
23-Jan-2007   4    
  Ordered 5 x Red-Blue glasses.  Asked them to give me a mixture of RB and RG but I don't know if they will...
Update: YAY, they did!  Bless 'em.
     
  Started getting this error:
failed writing c:\Noctambule\Source\HLSL\assembly_Zombie.txt
Project : error PRJ0019: A tool returned an error code from "FXC compile: c:\Noctambule\Source\HLSL\Zombie.fx"
Tried a different output text file but that made no difference.  The compilation is always succeeding though.
     
  Something about the projector RTs is causing the missing patchwork base and hdr blackouts (the zbuffer clear in CProjector::GenerateDepthImages was blatting over other stuff).
Reducing projector RT size from 1024 to 960 fixes those problems and the wacky polys (crikey).  It's not running out of vram, definitely not - I can create 12 projectors and it's happy.  Tried a bunch of RT formats but nothing changes it except taking the dimensions down.
It's to do with the HDR's multisampling.  Now disabled (temporarily) to get round the problem.
TODO: fix properly!!  blackouts still present but ground ok
     
  ORTs bigger than the screen don't have full z-buffer coverage.  ORTs don't automatically have private zbuffers either.      
  Not a fun evening :(      
22-Jan-2007   3.33333    
  Ported the DX HDR sample pretty successfully :D  The streaky glares are showing a lot of potential.      
  Try alt-entering a couple of times for different glitches.      
  Trying to track down the 'blackouts':  Could they be related to the stray polys?
- not bad deferred lighting pixels
- not bad ground pixels
- happens when you look around or move
- happens in fly cam too
- setrendertarget z-buffer clear in CProjector::GenerateDepthImages was blatting over other stuff; device z clear stopped some  blackouts.
- doesn't happen in flycam when you face west
- got to be some kind of float overflow/negatives.  Try clamping it to a sensible (but high) range when copying the frame RT<-no it's not, I tried this
     
20-Jan-2007   11.75    
  LogConverter updated for VS2005 and now only writes out the first 30 entries (Devlog.htm was getting far too big).
A better solution for the devlog is needed in the future.
   
  Didn't mean to, but I spent most of the day working on anaglyph ghost reduction.  Came up with a pretty effective technique (AnaglyphGhostReduction.fx), but obviously it can't change the laws of physics so I'm still hindered by the slackness of the filters in my glasses.  My method accounts for a couple of details I learned today:
- Through the cyan filter, red is much brighter than black, but yellow is no brighter than green (see 'testPower' param).
- There's a non-linear relationship between how bright a foreign component is and how much that pixel should be darkened (see 'power' param).
- Adding some brightness gives the deghosting more of a fighting chance.
Currently hardcoded for CYAN-RED.
I'll come back and tie-up the deghosting once I've tried getting hold of better glasses.
TODO: Order red-green and red-blue glasses (that website kept telling me "session expired").  Try splicing-up some green-blue ones too.
Deghosting is currently hardcoded to black-out the blue channel.  btw this makes it look kinda like a hologram.
   
  Added a 'stereoscopy.convergence' option to help with ghosting and focussing problems.    
  Got all the effects working properly in fly-cam mode.  This *really* needed doing.    
  Did some housekeeping in the camera department.    
  Got thinking about that particular type of anisotropic specular that I want.  Haven't quite figured it out yet.  Checked if there were examples around of the effect I need, but couldn't see any.    
19-Jan-2007   3.5    
  Had a look at nVidia's 'PracticalPSM' (perspective shadowmap) sample.  I'm kinda relieved that it has its fair share of glitches and limitations.  Really I should've found out about this sample before diving into my own technique.
In particular theirs REALLY doesn't like casting shadows from behind the viewpoint out in front of the viewpoint.  The sample also seems to be taking great advantage of the fact that the casters are discrete objects far apart - very unlike my town scene.  To be fair though, in some situations it looks very clean, plus it all works with a single scene redraw (single depth image).  Must be tons cheaper than mine too.
I'm think I'm sticking with my own shadow technique though.
     
  TODO: Right now I'm going to get the HDR system in place, because I think it'll save a load of faffing with colours & brightnesses (lighting, reflections, rain) if I can put the tone mapping in place now.      
  Airborne/entoptic light requirements: TODO: Finish planning this
The direction for the game is REALISTIC and HUMAN-VIEWED.  Film/photo camera effects are a nono, as are game clichés ([bloom/DOF/lens-flare]-for-the-sake-of-it).  Above all, keep the scene CRISP not smudgy!  That's not to say there's no mist, there is!
- Use (very) blurred HDR screen image (tone-mapping by-product) to contribute to the lighting of the rain (/&mist).
- World-space haloes around light sources, revealing rain & mist.  Ideally reveals a shaft of rain/mist all the way from the light to the viewpoint.  Use a sort of pointlight refraction shader for this?  Nice colour dispersion (redder towards the outside).  This shaft is necessary even with the blurred screen image influencing rain/mist lighting.
- Razor-sharp eyelash haloes from light sources, preferably also from reflected light sources & specular highlights too (thresholded fullscreen star-type filter for the little ones?).  Nice colour dispersion around the spikes.  Nice counter-rotation as the lightsource moves across the screen.  Blinking effect?  Subtle blinking effect?
Eyelash haloes are non-rain-related and therefore lower priority.  They need to be unique to each eye.
- Drips ideally want all the same lighting as raindrops.
- Mist should take the form of waves of vapour in the wind.
- All these effects need to look good in stereoscopic modes.
     
  Rain: TODO: Finish planning this
In order of rendering:
- Lit rain close to each lightsource, in its halo.  Influenced by blurred screen image, and is also lit by its one lightsource.  It's a world-space cluster around the light + drips in the halo, eg. underside of street light.
- Rain around viewpoint (foregound rain), lit by/refracting blurred screen image.
- For each lightsource, apply deferred lighting to the foreground rain in the screen bounds of the halo.  This can be toggled by a player option.  TODO: what about occlusion here?

     
18-Jan-2007   8.1666    
  Got anaglyph saturation working properly, was just a silly mistake.      
  Started using the C++ 'override' keyword.  It's something I've wanted since I first started using virtual functions.      
  Split-off a base class from WorldParser: BlockFileParser.  This is reused for the options profiles.      
  Got partial options profiles loading successfully :D      
  ALL options are now read in from the profiles :D
ORT formats aren't included in the profiles [yet] though.
     
  Got a nice framerate (like, same as mono) in stereo mode by halving the width/height of the frame RT in profile 'phil'.
The current bottleneck is very clearly pixel shaders.
     
17-Jan-2007   3    
  Visual Studio macros are working again.  No idea what that was all about.      
  g_viewInfo.pMainViewpoint is now generally to be used instead of PLAYER->pCamera->GetPosition().
Removed g_viewInfo.pMainCentralViewpoint.
     
  Shadows now work correctly in stereoscopic mode.      
  DXUTBuildValidDeviceSettings: Now defaulting to double-buffered rather than triple-buffered.  This fixes the 'stereoscopy.laggingApproximation' option.
I don't currently know what the advantage of triple-buffering is (?)<- (2.2.7)performance gain apparently; switched it back to triple 
     
  Noticed something weird about eyes.  If I look at a distant object in stereo mode, then tilt my head (almost on side even), the displacement of the two perceived crosshairs is still perfectly horizontal across the screen!  Seems your eyes are quite happy to 'converge' almost VERTICALLY if they feel the need!  Makes no sense that they should know to do that (???)      
  Deferred lighting now draws to the 'frame' ORT rather than the screen itself.      
  Added an 'stereoscopy.anaglyphSaturation' option.  Still isn't quite working somehow - FIX THIS NOW<-done      
16-Jan-2007   4    
  Been away on holiday for a month.      
  All Visual Studio macros stopped working.  Can't even run them from the Macro Explorer.  TODO: Investigate!      
  Got the anaglyph stereoscopy working beautifully.  Only bug I'm aware of at the moment is that the shadows are monoscopic.  TODO: FIX THIS IMMEDIATELY.<-Done      
  TODO: the 'stereoscopy.laggingApproximation' option doesn't seem to be producing the correct result at the moment - fix this.<- reducing number of backbuffers from 2 to 1 fixed this      
  This week and next I'll continue with all the bits & bobs I want to get done before I start on the rain.  From the 27th onwards I'll be practising for the Leeds gig on 9th Feb.  Immediately after that I'll get cracking with the rain effects which are due to be presented in "late May or in June".      
13-Dec-2006   1.666    
  Made a couple of tiny changes to reflecteddeferredspecular in case they could help with the corrupted reflected lighting (which they won't).
v7.3 gives different corruption from v7.1/7.2.
TODO: take the code into work and debug it there - I'll be wasting time trying to fix it remotely by guesswork.
   
  Thinking again about parallax mapping, having been reminded how easy it can be.  No excuse for not putting this in.
TODO: protrusion/relief type shader that includes cheap parallax mapping, sharpened protrusion edges and per-pixel self-shadowing.
About the edge sharpening though - my placeholder wall textures are very low-res - maybe I should see what the final res looks like first?
The self-shadowing, er...would have to be done inside the deferred lighting so it works for multiple lightsources.  Need to have a think about that...
   
12-Dec-2006   2    
  Bit of lighting & shadow work.  Reflected lighting now uses a separate effect (ReflectedDeferredSpecular.fx).
Lighting currently has a distance range, but it's just a test.
     
#version 7.3 Released version 7.3 (*might* fix the corruption in reflected lighting). Labelled the commit "version 7.3".      
11-Dec-2006   2.75    
  Found that v7.2 actually doesn't fix the corruption in the reflected lighting on my machine at work :(
I'm hoping the new dedicated reflected lighting FX will fix it (currently ReflectedDeferredSpecular.fx)
     
  Found and disabled the thing that was switching my keyboard into French (see language bar 'key settings')      
  Changed the FX exporter to include h_Global.fx, which defines _3DSMAX etc.      
  Put the soft shadows back to using a simple fade between the source and dest images.  They look great that way, but it makes DeferredSpecular more expensive because of the extra texture sample involved.      
  Added ambient & diffuse elements into DeferredSpecular, which look nice.  I'm about to try changing the specular power channel (alpha of position buffer) to be a sort of 'shininess' / 'gloss' channel, partly because I don't have a spare channel with which to send diffuse data.  This also has the advantage that the interpretation of the gloss is all controlled from DeferredSpecular rather than in the separate surface materials.  Seems very sensible to me.      
  TODO: DeferredSpecular wants to add specular to one buffer, while adding diffuse & ambient to another.  Once all the lights have contributed, the diffuse/ambient layer wants to multiply over the (full brightness) scene, then the specular layer wants to add over the scene.  This will look the business.  It will also allow the likes of a torch, and light-casting weapons etc to work beautifully.
Gord, maybe soft-focussing the ambient-diffuse image would give a nice real-time radiosity impresion??  Sitting underneath the specular and the rain effects, it could be very hard to see how that's been been done.  Could look gorgeous.
     
  P.S. - Yes, I will be having a 1000-hour celebration "field trip".<-done (june 2007)      
10-Dec-2006   5.5    
  Noctambule's rain (/& weather) effects have been made the task for my next 'personal review' at work.
That *should* be due 6 months from now, say 11th June 2007 (added to Outlook calendar).  Would be good to repeat this 2-birds-1-stone trick next time, since my previous review task stole 90 hours from the project :(
     
  Options.h: had to name all the sub-structs to get rid of this link error (??):
LINK : .\Debug/Noctambule.exe not found or not built by the last incremental link; performing full link
Options.obj : fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '??0<unnamed-tag>@COptions@@QAE@XZ'
     
#version 7.2 Released version 7.2 (should fix the corruption in reflected lighting). Labelled the commit "version 7.2".      
  With shadowblur.fx in RM, I was getting a blank preview when I set the PS to SM3.  Started working again when I upped the VS to SM3.  So maybe it's a good rule to keep them matched?  TODO: check if the problem is the same in-game.      
  Experimented with shadow softening.  The current code blurs from the source to dest ORT, then reduces the range of the blurred colours in deferredSpecular.fx according to proximity of the surface with the caster.
Can look nice, but I won't be using this version, because it does too much damage to the shapes of distant shadows close to their casters (eg. wall detail shdows are pretty much ruined).
     
  So then, that's the thousand hour mark passed.
Sounds like a huge amount of time, but it's "only" 6.3 months worth of office hours.  And there's only one of me, and I had no pre-written engine or toolchain.  So it's not so bad.
Far more worrying is fact that I'm almost exactly half-way through the project's available time.  I started three years ago! :/
My pace now is far healthier than it was though - I just need to keep it that way and things'll be fine.
My average pace over the past 3 years was just under an hour a day, which is terrible.
     
6-Dec-2006   3.5    
  Made a good start on the string table.  I think it's a good thing to do because it forms a sort of design spec for the menus etc. which I should start adding before too long.      
  MAX: Added the Map Channel Info command to the Tools menu.      
  Got the hang of channel-mapping my shaders in Max.  VertexColour is working properly now, even displaying vertex alpha in Max (alpha is currently forced to 1 in game, needs work).
Can't seem to use object colour unfortunately; the 'display vertex colour' check has no effect when using a shader.
     
4-Dec-2006   3.83333    
  Started getting this link error (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/lnk1179.asp):
Options.obj : fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '??0<unnamed-tag>@COptions@@QAE@XZ'
Tried fiddling with the 'function level linking' and 'incremental linking' settings on the project but they didn't change it.
     
  Added a nice 'render target options' system that will later allow the player to customise ORT properties from the pause menus.      
  Disabled warning 4482 ("nonstandard extension used: enum 'CRenderTargetOptions::EResolutionMode' used in qualified name")      
3-Dec-2006   6.33333    
  Tried v7.1 on my machine at work, and all the reflected stuff had crazy corrupted lighting.
Found and fixed an uninitialised texture parameter for deferredSpecular.fx (if drawing reflections) which might hopefully account for it.
Screenshots of the problem are in the 7.1 build folder along with a dxdiag.txt.
     
  Started thinking about bug tracking.
Installed OnTime2006, which required me to install Microsoft SQL Server Express, but I still couldn't get it working so I uninstalled them both.
I'll ask at work about Bugzilla...
     
  Found that there's a load of documentation on the web for Max DX9 shader materials.  Why didn't I search for docs before?!!
Saving these docs in 'docs\3dsmax'
     
  Installed Max 8 and the latest Panda exporter.  Still crashes same as before.
There is now a version for Max 9, which I'm guessing wouldn't crash.
Here's the info from the panda site:
"Advisory: Dx9 Materials exported under Max8 and Panda DirectX Exporter may crash due to a bug a 3ds Max 8.  Contact Autodesk for details on a fix for this.  This bug also affects other exporters using IGame."
     
  Tried the KiloWatt X exporter for Max 8, but it makes no attempt to export DX shader materials >:(      
  TODO: Get Max 9 and try the panda exporter.      
  Added whitesquare.tga.      
  Managed to figure out vertex colour display for dx9 shader materials in max; see vertexcolour.fx.
Unfortunately Max doesn't set up object colour for non-editable mesh objects as vert colours (so you can't see vertexcolour.fx on a geosphere node for example, would have to be solidcolour.fx).  It would work on the game side though.
     
  Played about with different ORT sizes for the effects.  NOTE the patchwork doesn't use MRT, that's why the different targets can have different dimensions.      
  Remembered just how ludicrous patchworkDimpleProcessing.fx is.  Addressing this (and keeping its ORT small) will give a huge speedup :)      
  Max sometimes just shows random vert colours with vertexcolour.fx...      
  ...then Panda started playing up...  I'll sort this stuff out tomorrow.
<- it doesn't seem to like being given a full long file path?  Browse to the folder then just give it the leaf name.
     
  That corruption in the dimples was nothing to worry about, just the manhole cover dimple object was using default.fx which I don't include in the game.  Fixed now.      
28-Nov-2006   0    
  Spent ages sorting out my email setup.  The compilcations were as follows:
- 123-reg email forwarding is unavailable because I have to use web-mania's nameservers for the site to work neatly.
- web-mania email forwarding is to one address each.
- can't access pop3 mail accounts at work because the ports are closed, etc.
- if sending mail through gmail, there is no way of hiding gmail's presence in the from field (it does that 'on behalf of' nonsense).  Changing the name in the pop account settings doesn't change that.  Changing the SMTP server to the programmerart one doesn't fix it either.
   
  Email now works as follows:
- all my selected names ^programmerart.org get forwarded to allusers^programmerart.org.
- allusers^programmerart.org forwards to programmerart^googlemail.com.
- programmerart^googlemail.com forwards to the office.
- at home, I pop3 to programmerart^googlemail.com as an incoming-only account.  I've disabled outgoing mail through gmail and btinternet (should be able to restore this by ticking 'use same settings as incoming mail server' in the ougoing mail tab).  So mails sent from that account by accident will sit in the outbox and cause an error message till I change them to use the correct account.
- from home, I send and reply from pop3^programmerart.org using whichever alias I want (phil^programmerart.org is the default / could use info~programmerart.org or whatever).  pop3^programmerart.org (as phil^programmerart) is my default account at home.
- at work, I can reply to ^programmerart emails from the gmail site, whereupon the sender will appear as
"programmerart^googlemail.com; on behalf of Phil Palmer [phil^programmerart.org]" which isn't too bad.
   
  MSN: when adding a contact, be sure to un-tick the 'auto-update this contact' option.  Otherwise it'll send those request thingies.    
  Spent ages faffing with MSN to try to change my email address.  Got it sorted eventually.    
27-Nov-2006   2.83333    
  Trying to suss this leam.max crash.
- most recent revision *was* working, so it's not the max file itself that's wrong
- now versions 127 onwards crash
- ok, version 126 of the HLSL folder makes the latest leam.max work
- it was SolidColour.fx, which had been set to SM3
- REMEMBER: MAX D3D9 MATERIALS CAN ONLY GO UP TO SM2!!
     
  Worked round the above problem by using the _3DSMAX define to limit the platform to SM2 & exclude the SM3 code.      
  FX: Can't use defines in FX code, eg. can't do
#define PS_TARGET ps_2_0
PixelShader = compile PS_TARGET MyPixelShader();
     
  Started working on shadow softening      
26-Nov-2006   9.25    
  Deleted ModeSystem.cpp & h because they weren't being used.  Still in SVN if I ever need them.      
  NOTE: 'array' is now a C++ keyword.  It's a shame, because that was a useful member name.      
  Corrected the zombie walk speed (there was some update in the prep)      
  Implemented a pause mode (P), see ModePause.cpp/h.      
  Missed some serious rainfall early this morning - woke up at about 6.15 by which time the sky was starting to brighten which would be no good.  The forecast sunrise time was 7.43 - seems the sky brightens long before sunrise.      
  Zombie.fx now (properly) shares code from ProjectorDepth.fx.  PS is selected according to an effect variable, while VS dynamically branches to call a function in h_Projector.fx, depending on that same variable.      
  Renamed the most up-to-date tubby version to tubby.max (renamed old tubby.max to tubby_pre_walk.max)      
  Had a look at getting the zombies walking out of step.  The problem is that they're all sharing the same CAnimMesh instance, and that's where the bone matrices are kept.  Would ideally move the bone matrices into CAnimUser, but that'd be fiddly.
I've decided it's not worth fixing this yet because the current enemies are only placeholder and will be replaced before too long.
     
  Had to remember to put an (empty) virtual destructor into CGameMode so that each mode's destructor is called when ptrs to the base class are deleted.      
  The player now has a model (currently the zombie model).  It animates, receives light & shadow, casts shadow, and reflects in the ground.      
  Got a crash trying to load leam.max - TODO: investigate!!!!      
  Had a nasty bug where there was a function-scope variable with the same name as a for-loop variable.  After the 'for', I was using the variable for another 'for', and it was picking the wrong one - no warnings.
TODO: Find the setting that will give me warnings for that.
     
  Added VERY SCRAPPY placeholder zombie-zombie and zombie-player collision.  Just stops all that character overlapping that looks terrible.      
  TODO: check I've got shader optimisations on in master builds.      
#version 7 M tested version 7, working as expected. Labelled the commit "version 7".      
  I had somehow lost my _DEBUG and _MASTER defines from the project settings (along with whatever else was in there).  No idea why that would be.  Could it have been the changeover to VS2005???  The likes of _UNICODE/UNICODE are inherited.
I've just put the defines back in now, and I'll keep an eye on them.  V6 and V7 were missing the _MASTER define, so they allowed fly-cam to be activated.
     
  Noticed the download size jumped up a lot between versions 6 & 7; todo: investigate.  The only new file was Zombie.fxo.      
  Brightened the scene back up a bit (M said it was too dark), and made sure the flycam was unavailable in master.      
#version 7.1 Released version 7.1. Labelled the commit "version 7.1".      
25-Nov-2006   6.4167    
  Added a SHADER_CODE define (defined only for the shader compiler).  This allows shader code to be placed in headers also used by the game code, where necessary.    
  Projector: Got rid of the PROJECTOR_USE_SHADOW_MATRIX define (now always true).    
  Finally got the zombies animating again, with lighting and shadows.    
  Got rid of that memory leak: CAnimMesh::pBoneMatrices    
  Bought some waterproofs, ready for some heavy-rain photography action.  And as a by-product:
I have a cool design for my player character!!
Having the player dressed in waterproofs will be ace - wonderfully simple and sensible.  Can't wait.
They'll be like, "I wonder what I look like, I wonder what I'm wearing" and they'll go and look at their reflection in a window and say "Of course, I'm wearing waterproofs, because it's pissing down with rain.  That's genius." 
   
  Possible HUD font: "Glass Gauge"
Alarm-clock-style font: "LCD" / "Quartz"
DVD-style subtitle font: "MS Reference Sans"
   
24-Nov-2006   1.5    
  Started getting a memory leak, don't think it was there on the 20th.  Something to do with the change of skinning version for the zombies?:
{261} normal block at 0x010BD7A0, 656 bytes long.
 Data: <                > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD 10
<- fixed (CAnimMesh::pBoneMatrices)
     
  Trying to get the zombies animating again; dug out the skinning code from SkinnedMesh.fx and planted it into Zombie.fx.
TODO get this working (genuinely too tired tonight).
     
20-Nov-2006   3.75    
  Fixed the forwarding for my new domains - it was non-framed forwarding that I wanted.      
  NOTE: For zombie animation, search for this line in AnimMesh.cpp:
DEVICE->SetTransform( D3DTS_WORLDMATRIX( i ), &matTemp );
     
  TODO: NEED TO DESIGN THOSE ENEMIES.  NEED TO KNOW WHAT THEY'RE GOING TO DO AND HOW THEY'RE GOING TO MOVE.      
  TODO: in bumpy.fx / solidcolour.fx / zombie.fx, WS positions & normals have to take into account the OBJECT MATRIX!!!  This is currently only needed for the zombies.
<- done for zombie.fx
     
  Don't press F12 in fullscreen!      
  Eventually got the zombies receiving deferred specular lighting, as well as casting and receiving shadows (this includes self-shadowing, yay!)  Looks cool; they look like silver statues at the moment.
It's currently a pretty messy test code-wise - todo: tighten it up a bit.
     
19-Nov-2006   6.25    
  Ran into some kind of too-much-stuff-going-on sorta problem with ground.fx.
Had to keep ground.fx's inverse surface vector calculations in the PS because of this.
NOTE: Had to change ground.fx STransferData::normal from TEXCOORD3 to TEXCOORD6 to prevent these errors - makes no sense to me.  And there were *definitely* no overlapping semantics!

error X5639: dcl usage+index: texcoord,3 has already been specified for an output register
error X4504: overlapping output semantics
error X5629: Invalid register number: 12. Max allowed for o# register is 11.
   
  Moved ground.fx and deferredSpecular.fx out of RM (renamed to ..._NOEXPORT in rfx backup folder).    
  SolidColour.fx now writes the same deferred shading data as bumpy.fx.    
  Added a PLACEHOLDER modelled skydome.  Remembered that objects only need the NoctambuleScenic modifier if you want to attach information to them.    
  TODO?: wheel movement control.
- roll forwards to move forwards (detects speed etc).
- roll backwards to move backwards (detects speed etc).
- forward & backward movement have sorta momentum so you don't stop dead between rolls
- nudge in opposite direction to movement to stop suddenly
- hold wheel down and pull left/right to sidestep
   
  Made the ground reflections distort farther vertically (ground.fx), looks good; todo: improve (currently hardcoded)    
  Added deferred specular lighting (but not shadows!!  NO!!) into the ground reflection image.  This makes it look loads better.    
  Fixed the occlusion culling in the ground reflection render, by changing IntersectRayCullPlane so that effectively every cull plane extends downwards to infinity.    
  Registered the following domains for 2 years with 123-reg:
programmerart.org.uk
programmerart.co.uk
programmer-art.co.uk
programmer-art.com
   
  Opted out of WHOIS for the .co.uk's and the .org.uk; the others don't give me the option.
Set up web & mail forwarding for all the new domains.
   
  Hmm, the framed forwarding doesn't seem to be working properly [yet] (jumps to the page but doesn't update the address/title/icon).  TODO: maybe try the other way?    
  IDEA: enemies could stagger towards you like zombies until they're quite close, say 10 metres away, then charge at you - might be quite scary.    
18-Nov-2006   6.582    
  Installed VS2003 and got the FX exporter working again.  Just had to add the platformSDK and DX paths back into tools\options.      
  MAX: layer window: press enter to select      
  Filtering doesn't work on floating-point textures??!      
  TODO: CullPlanes need to hang below the ground so they work for the reflected viewpoint!!!!
Maybe automate it so they all hang down to the height of the current reflected viewpoint?
     
  Couldn't get mixed fixed-point&floating-point MRTs to work, although the DX docs say this should work.  This was for the ground reflections (colour ORT & position ORT).      
  RM: VERY IMPORTANT: EFFECT MUST BE COMPILED IN RM BEFORE EXPORTING IT, OTHERWISE IT'LL NOT INITIALISE PREVIOUSLY-UNUSED VARIABLES IN THE FX FILE!!!      
  Got depth diffusion working on the ground reflections.  Looks nice.  Cures some glitches and introduces some new ones, but I think I'll keep it.  Increases the number of texture samples for the ground :/  Uses a new 512*512 floating point RT.      
  Added a debug RGB multiplier to bumpy.fx.  The landscape and reflections definitely look nicer (SCARIER) darkened down (before the deferred specular goes on).      
12-Nov-2006   2.5    
  Had a wcslen on an uninitialised string, rather than sizeof/sizeof(*).      
  Had to add bumpy.fxo and default.fxo      
  TODO: Find out how to get a publisher certificate for the downloads.      
#version 6 Released version 6. Labelled the commit "version 6".      
  TODO: For the next build / couple of builds, I will be concentrating on AESTHETICS, using the engine features I've already added (patchwork, reflections, specular lighting & shadows).  Needs to be done, because at the moment - although these features have great potential - the game looks mighty crumby.
Amongst other visual improvements, the next build should feature:
- Shadows from all characters (including player)
- Player ground reflections
- Proper (deferred specular) lighting on all characters
- Self-shadowing on all characters
- Landscape improvements (especially ground surfaces)
- Would be good to get the shadow glitches fixed as far as possible
     
11-Nov-2006   1.75    
  Fixed the corruption in fullscreen mode - ORT dimensions weren't getting updated after alt-enter, duh!    
  Put the V6 install together (done for English only so far).  The exe crashes though - seems to be having problems with paths eg. for leam.x (CMeshFile::Create)    
10-Nov-2006   2    
  Applied for a new savings account to use for the charity proceeds from the project.  No point letting JustGiving scoop 5% off any donations, cheeky buggers!
TODO: add this to PayPal; put a donate button (plus info) on the site.
     
  Stream mappings are not exported in the FX file and only apply within RenderMonkey!      
  MAX: trying to find the semantic if any on which vertex colours are passed.  Tried COLOR0, COLOR1, COLOR2, TEXCOORD1, TEXCOORD2, NORMAL1, POSITION1.  No luck.
TODO: TRY THE SAME IN MAX8; see VertexColor.fx, which suggests that vert colours come through on TEXCOORD0(?)
     
  Got a load of problems with SolidColour.fx when I renamed __Diffuse to something else.  The name needs to contain '__Diffuse' in order for the semantic to get added by the exporter.  Weird thing is it still didn't work (didn't write out the semantic or any XML type stuff) after changing it back from  __Colour to __Diffuse.  Had to revert the RFX and add __Diffuse again.  (???)
<- just need to remember to compile before exporting; see 18 Nov
     
  TODO: Get VS2003 so I can edit the FX exporter again!  <-DONE
Alternatively, could maybe try a recent version of RenderMonkey, see if it has a 2005 exporter and if so how much work it would need.
     
9-Nov-2006   4    
  TODO: Add the ability to draw meshes with whatever effect (eg. ReflectedLandscape.fx).
Dunno if it might be a matter of having them as CEffect / CEffectInstance instances so they can be fed textures and that…
Currently using Bumpy.fx for the reflections, temporarily.
     
  TODO: Get vertex colours working on Default.fx (in Max and in game).  It's being used on those light marker spheres.
<-Vert colours really don't seem to be passed to the shaders in Max 6; try Max 8 at some point.
     
8-Nov-2006   4    
  Been busy with an effects post-mortem for work, and with band stuff.  Also got severely reeled-in to MySpace, horrible thing, I've quit now.      
  Rendered my TV unusable, informed TV licensing and cancelled my licence payments.      
  Finally got the hang of housework scheduling: half an hour every day - no more & no less.      
  Got a new passport.      
  Stopped drinking, until at least 2nd Oct 2007.      
  Also gone veggie and started exercising every day.  That's not really relevant but is part of the whole self-discipline drive which I'm on for the benefit of the project.      
  ALT-ENTER: looks like 72 or 211 refs on the device when I reach the reset (Debug D3D)      
  CAnimMesh.cpp: Moved a block of code from RestoreDeviceObjects back into InitDeviceObjects (alt-enter was revealing this as a leak on game shutdown)      
  ALT-ENTER: added a LANDSCAPE_ENABLED define; setting this to 0 makes alt-enter a-ok.  So whatever the problem is, it's inside landscape.      
  ALT-ENTER: Added PATCHWORK_ENABLED define.  Shows that patchwork has nothing to do with alt-enter.      
  ALT-ENTER: Added LANDSCAPE_MESHFILE_ENABLED define.  Shows that the meshfile has nothing to do with alt-enter.      
  ALT-ENTER: Added LANDSCAPE_MESHOBJECT_ENABLED define.  Shows that the problem is only present when mesh objects are created.      
  ALT-ENTER: Added RENDERABLES_EFFECTINSTANCE_ENABLED define.  Shows that the CEffectInstance has nothing to do with alt-enter.      
  ALT-ENTER: Added RENDERABLES_MATERIAL_ENABLED define.  Shows that the problem is only present when CMaterial objects are created.      
  ALT-ENTER: Added RENDERABLES_EFFECT_ENABLED define.  Shows that the problem is only present when CEffect objects are created.      
  ALT-ENTER: Added RENDERABLES_D3DXEFFECT_ENABLED define.  Shows that the problem is only present when ID3DXEffect objects are created.      
  OnLostDevice IS getting called for ID3DXEffect instances.  Are there maybe also some instances that aren't getting the call?      
  D3DXFX_NOT_CLONEABLE (as in statemanager sample) when creating the effects didn't fix it.      
  Something to do with 'getExisting'?  YES IT WAS.      
  ALT-ENTER: Here's what it was: In CEffect::Create, 'getExisting' was being passed raw effect names, not adjusted effect names.  So probably the effects with a 'MAX_' dummy version would've been the ones tripping things up?
All working lovely now, apart from some weird corruption at the bottom of the screen in fullscreen mode (where the task bar was).
     
  TODO: Fix fullscreen corruption at base of screen.<- ORT dimensions weren't getting updated after alt-enter, duh!      
  #revision 124      
8-Aug-2006   2    
  Managed to untangle my source control.      
  Various SVN faffing.      
  Made a DVD backup of the Noctambule folder.  Seems I either forgot to do this last time or I did it but nothing wrote to the disk.
See Nero was somehow set to use its 'virtual recorder' rather than my physical DVD recorder (?)
     
  #backup 1      
6-Aug-2006   2.5    
  Release-mode startup crash: Narrowed this down to the 'Basic Runtime Checks' setting being 'Default' rather than
'Both (/RTC1, equiv. to /RTCsu)'
In fact it's some problem finding leam.x in CMeshFile::Create.  Search for D3DXFERR_FILENOTFOUND.
TEMP BODGE: I've hardcoded-in the leam.x path in CMeshFile::Create, which gets round the problem.  TODO - FIX THIS!!!  Is it just a problem with the initial directory?
     
  Added a 'Test' config that can be used for any old config testing.      
  #revision 115      
  Tried bailing out of OnFrameRender altogether but the state block problem persists.      
5-Aug-2006   5.16    
  ALT-ENTER:
- Should only delete device objects (DXUTCleanup3DEnvironment) if something goes WRONG (which it is currently).
- Should just reset the device (DXUTReset3DEnvironment).
- Can (and should) reset the device with a non-zero reference count.
- My device reset fails with D3DERR_INVALIDCALL, need to understand why.  Shouldn't fail.
     
  Debug D3D gives me this output on the Reset:
"Direct3D9: (ERROR) :All user created stateblocks must be freed before Reset can succeed. Reset Fails."
     
  TODO: NEED TO TEST ALL BUILDS ON DEBUG D3D BEFORE RELEASING THEM!!!
V5 crashes on Debug D3D.
     
  Switching off D3D 'break on…', I get a bit more output but no more info:
"Direct3D9: (ERROR) :All user created stateblocks must be freed before Reset can succeed. Reset Fails.
Direct3D9: (ERROR) :Reset failed and Reset/TestCooperativeLevel/Release are the only legal APIs to be called subsequently
D3D9 Helper: IDirect3DDevice9::Reset failed: D3DERR_INVALIDCALL"
     
  NOTE: IDirect3DDevice9's reference count member, in DEBUG D3D seems to be a signed int 4524 bytes in.      
  In debug d3d, device refcount always reads 211 when I get to the alt-enter device reset.  Release 1464, hmm.      
  Tried disabling font creation; didn't affect the alt-enter stuff.  Put the font creation back in the way it was.      
  NOTE: Release build currently crashes on startup.  CMeshFrame::FindFrame doesn't find the frames the game needs.  No idea why.  TODO: Fix this!!      
  Currently the best way I've got of doing a printf Is by using
CRT_DBG_REPORT(_CRT_WARN, NULL, 0, NULL, "hello %s", "world")
This only works ifdef _DEBUG (annoying, because release buids are where I need it most).
printf doesn't work at all.
Set up a macro key for the above, ctrl-P.
     
2-Aug-2006   3.5    
  Trying to get alt-enter working.  At the moment I'm not sure how V5 managed alt-enter.  By comparing the current source with the V5 source (eg revision 26 of the Source folder) I should soon be able to work it out…      
  Remembered that there's currenty sorta two landscape mesh systems sitting side-by-side, need to fix that.
The newer one from StateManager only stores like one CMeshObject, representing the top-level leam.x thing…
The rest is done by CMesh.
     
30-Jul-2006   7.2    
  Trying to track down these unreleased device objects.
- always three of them.
- nothing to do with Projector, although I thought the problem started about the same time as Projector went in.
- I found exactly three manual device->addRef calls, but they all release as they should - was just coincidence.
<- Gotcha.  CModeEnvironment::RestoreDeviceObjects was doing pre-CRenderTarget stuff to setup 3 render targets.
     
  NOTE: IDirect3DDevice9's reference count member, in RELEASE D3D seems to be an signed int 48 bytes in - handy for data-breakpoint action, to see what changes the refcount.
*((int*)(void*)(int(g_game.pd3dDevice)+48)) // release d3d
*((int*)(void*)(int(g_game.pd3dDevice)+4524)) // debug d3d
     
  #revision 110      
  TODO: Disable the F3, F8 & Pause DXUT hotkwys.      
  TODO: From now on, after adding any feature, must test that alt-enter still works and that the game shuts down properly!!!      
  Fixed a few wide-string-length bugs; they wouldn't have been causing a problem though.      
  NOTE: DEVICE->GetRenderTarget won't output NULL for an unused stage; it'll just not touch the pointer you pass in.  Will return D3DERR_NOTFOUND.
TODO: Manually keep a record of which stages are in use.
     
  On alt-enter, with maximum validation etc:
"Direct3D9: (ERROR) :All user created stateblocks must be freed before Reset can succeed. Reset Fails.
Windows has triggered a breakpoint in Noctambule.exe."
This would seem to tie in with the D3DERR_INVALIDCALL return code that I get from the Reset.
     
  #revision 111      
  #revision 112      
  RMB is a debug key to Invalidate,Delete,Restore.  TODO: Get this process working (landscape is causing problems).      
  TODO: Get alt-enter working.      
  #revision 113      
  Website: Deleted the tracker because it gave a nasty offputting 'active content' warning whenever someone visited the page.  I don't even know if hits were being recorded if the visitor blocked the script.<-only happened when opening the local harddrive copy of the page      
29-Jul-2006   6    
  Class 1 lights: Maybe only ever two of these at a time.  Use generous ORT res and res bias.  Can cast live shadows.  Shadows may undergo softening process.  Draw over whole screen most likely.      
  Class 2 lights: Say five or six of these, farther away.  Small ORTs, simple projection (90° cube style).  Depth images (shadows) are frozen.  Deferred lighting & shadow done using a screen-space revealing sprite.      
  Class 3 lights: Can have loads of these, way off in the distance.  No shadows.  Deferred lighting done using a screen-space revealing sprite.  Consider limiting lighting influence to a WS range if lack of shadowing becomes offensive.      
  I'm going to put together a build with a couple of class 1 lights just to show some progress; once that's done I'll work on the full-blown light management system.      
  NOTE: Max does not like it if you set Windows' number style to French.  The spinners can't make sense of the commas.      
  In my FX build rule, I tried changing the output paths to use backslashes instead of forward slashes - MB suggested this because he'd had some similar problem.  This didn't fix mine though.      
  Added a 'Draw to shadow' flag on the Scenic modifier (defaults true, handy to set false for light marker spheres - which are temporary of course).      
  Verified with Fraps that backface-culling the building walls gives a significant speedup (eg. 43fps -> 48)      
  Found that I was getting a load of WM_TIMER messages, which were causing error output when passed to DispatchMessage (DXUT.cpp).  I can't see any Windows timers being installed though (a function called SetTimer would be used for this).
I'm now forcing it to ignore any WM_TIMER messages, which gets rid of the output (and presumably any related file access).
The error was:
'Noctambule.exe': Loaded 'C:\WINDOWS\system32\psapi.dll', No symbols loaded.
'Noctambule.exe': Unloaded 'C:\WINDOWS\system32\psapi.dll'
Looks like the D3D sample apps suffer from this too, hmm.
     
17-Jul-2006        
  Got rid of the SayBox because it stopped working.      
16-Jul-2006   3    
  The 'giant gap' in the shadows is caused by a fault in the projection matrix.  I've got no idea how (the calcs all look fine), but it's like the fovs or the aspect ratio goes wrong.  TODO: FIX THIS!!!!
As a temporary bodge, I've artificially widened the aspect ratio.  REALLY need to fix this.
     
  Brought a bit of res bias back in, because it does help reduce depth discrepancies as long as you don't use too much.      
  Decided to ignore the shadow glitches for now so I can push on and get v6 out to show some shadows.  I'm going to lose too much morale otherwise.      
  TODO: get visibility testing working for depth images      
9-Jul-2006   2.5    
  Don't know why projecting the depth images onto the shadow matrix causes red gaps on the depth image at the frustum's far end.  It's the shadow matrix transformation itself that causes it, not the res-bias adjustment.
Tried disabling D3DRS_CLIPPING; that didn't help (saw no difference).
Tried various near & far clip settings.
Setting the near clip to 0.f fixed it :D
     
  Unfortunately, seems res-bias was responsible for a fair chunk of the depth discrepancy problems I was having (it takes res away from stuff farther from the viewer; less res = more discrepancy).  Maybe larger depth orts are the way to go?
Currently shadow matrix and res bias are disabled.  Might be able to put them back if the normal-based depth shift described above is successful.
     
  TODO: got to figure out what that giant gap in the shadows is when looking towards a light.      
8-Jul-2006   4.25    
  Using 1024*1024 shadow depth ORTs caused red borders at the bottom of the images (1024 must be taller than the window surface).    
  Made frustum faces at very shallow angles to the projector not draw (gets rid of some hairy overlapping nonsense).    
  In the absence of a 16-bit one-channel integer ORT format, I'm currently using R32F for projector depth rather than G16R16.
Important: I'm still doing the depth division though, to keep numbers closer to zero and therefore more accurate.
Seems you get no filtering using floating-point textures??!!!  I'm using G16R16 for now.  Filtering really helps prevent depth discrepancy.
     
  NOTE: Higher-res depth images == significantly less depth discrepancy.      
  The remaining depth discrepancies seem pretty honest - the main one is that surfaces at very shallow angles to the light don't have enough pixels representing one of their axes, so the gradation of reference depth is lousy.
TODO: In ProjectorDepth, bias verts' depths to be farther back according to the dot of their normals with the light's view direction.
     
7-Jul-2006   2.75    
  Turns out alpha blending is not supported on floating-point render targets on PC.  Got some docs from F about workarounds etc.    
  So I tried some integer formats.  16 bits would be plenty resolution.
 D3DFMT_L16, D3DFMT_A8L8 and D3DFMT_A8 gave me a scary "Could not find any compatible Direct3D devices" error & crash.
 D3DFMT_G16R16 didn't support blending.
 D3DFMT_R8G8B8 turned the game into a black void.
   
  Remembered that pixel shaders can output arbitrary depth values - now using this and zbuffering, rather than trying to use the MIN blend.
Got loads of depth-discrepancy speckles trying to use a floating-point format though.
Now working pretty well with D3DFMT_G16R16.
TODO?: use a depth-only format?
   
6-Jul-2006   1.666    
  Couldn't get projector depth images to use blending when their ORT format was floating point.    
4-Jul-2006   3.5    
  Got the dynamic res bias working.  Had to limit it at about 0.8 because when it gets extreme it gets glitchy, which is fair enough.    
  Plenty of depth discrepancies caused by the shadow matrices etc.
TODO: record the depths AFTER those transformations (in both ProjectorDepth and ProjectorShadow)?
   
2-Jul-2006   8.5    
  Realised that res bias will not help the PZ face much at all, especially when looking away from the projector.  Should still be applied though, I think.  Might well want to use higher-res targets for the PZ faces.    
  Decided to avoid flow-control/branching problems altogether, by drawing a separate pass for each frustum face.
Will probably end up drawing these shadows to a smaller-than-screen size ORT which will then be blurred and look-up by the deferred specular draw.
   
  Note: Lights-out coding is good - feels more determined and reclusive.    
  FINALLY res bias is starting to work :D  Need to get the correct amount applied based on size-on-screen of the two face ends (currently, PZ face is kinda buggered by it).  Looking really nice though.  Very sharp (but short) sawtooth edges are produced; these might actually be beneficial when I come to blur the shadow image.
I'm so glad this res-bias thing is finally starting to bear some kind of fruit.  PHEW!
   
1-Jul-2006   4.5    
  HLSL: dividing zero by a value can cause a bad result???      
  This weird DeferredSpecular cutting-out / corruption - looks like it could be some kind of parallelism problem?  It's almost as if it's using values before it's finished calculating them or something.      
  When I try to combine referenceLightDepth values with debug colours from the array (looking up using index from GetIntersectedCubeFace), I get problems.  Either on its own is fine.  Using a constant (hardcoded) colour index is fine.      
  If I assign the appropriate debug colour to a temporary colour variable next to each tex2D call, I can combine the referenceLightDepth and debug colours, but only if I don't divide the referenceLightDepth or the debug colour (except by 2).      
  I get slightly different results depending on whether I use /Gfp or /Gfa in the FXC compiler arguments.  Both look about as wrong as each other though (both cut out, just at different times).      
  Looked up 'flow control' in DX help and found there are some limitations to be aware of.  Didn't totally understand it, but it did sound like it could be relevant to the problems I've been getting.      
  Fixed the frustum plane normals (had been using slightly the wrong trigonometry).      
  Couldn't work out why the projector fovs seem slightly off.  The geometry that calculates them seems correct.  Is it just float imprecision??      
  TODO: RES BIAS!!!!!!      
29-Jun-2006   3    
  Installed Office 2003 (from L).      
  Right, turns out that DeferredSpecular cutting-out weirdness was some problem with the NZ face matrix, even though it looks healthy in the watch window.  I reckon I don't actually need that NZ face, it's so tiny.  I'm going to carry on without it and see how it goes.  It did seem like a waste of frame time and memory to be rendering a scene to such a tiny area.      
  TODO: try to make sense of those >1 U coords, on the NX face for example.  <-Was treating the frustum box as 1*1*1 rather than 2*2*2.      
28-Jun-2006   2.5    
  HLSL: DON'T TRUST 'clip' WHEN THERE'S CRAZY STUFF HAPPENING (?)      
  Eventually managed to stop the shadows cutting out.      
  - face matrices' translations were in slightly the wrong space.      
  - a UV needed fmodding with 1 otherwise the whole screenquad would cut out.      
  - don't trust 'clip' when weird stuff is going on.      
  TODO: get 'lightDepth' calculated; get other faces mapping properly; get shadows working properly (depth comparison) again.  After that, do the shadow-matrixy stuff res-biasy stuff...      
26-Jun-2006   3    
  Signed up for BT broadband; should arrive at work on the 11th of July.  They now reckon I can get speeds up to 6.5 gig?    
  Tried to do some shader debugging again, couldn't get it to run successfully.    
  Tried to make sense of this cutting-out lark that DeferredSpecular is now doing.  It is properly bizarre - not a code bug, something else is going on.  HLSL optimisations and preshaders are currently disabled, but this makes no difference.    
25-Jun-2006   9.85    
  IMPORTANT: Frustum-space direction vectors are tricky buggers.  See HLSL function 'GetFrustumSpaceUnitDirVec'.    
  Set up syntax highlighting for HLSL.  Set the 'editing experience' for FX files to be C++.  Put usertype.dat shortcut on quick launch bar.    
  IMPORTANT: I'm editing DeferredSpecular.fx directly from now on.  RM was holding me back (wouldn't let me use arrays).    
  Finally got shadows landing in the right place.  The colour is cutting out though, maybe something to do with W's.  Current debug shows zero W's in red and    
  non-zero W's in green (????).    
  TODO: Get latest drivers for DVDRW, backup Nocatmbule folder!!!!!!!!!!    
24-Jun-2006   9.666    
  NOTE: RM: SEEMS MULTI-LINE ARRAY DECLARATIONS CRASH THE EXPORTER.    
  NOTE: RM: SEEMS ANY ARRAY DECLARATIONS CAN CRASH THE EXPORTER.    
  **** IMPORTANT **** D3DX: WHEN MULTIPLYING A VECTOR BY A FUNKY MATRIX (eg. perspective, probably shadow too), NEED TO USE D3DXVec3TransformNormal NOT D3DXVec3TransformCoord!!!!!    
  Eventually got the frustum-space thing worked out.  It's starting to look sensible now.    
23-Jun-2006   2.333    
  Made a fix to projector view mats: target pos was between top&bottom points rather than left&right points.  View mats are looking right now :)    
  PROBLEM: ProjectorDepth: might need to do all the transformations (shadow matrix, perspective trickery) in the PS, because doing it in the VS will change the Gouraud (different perspective) and hence the depth information.    
  TODO: trace ray from each pixel in the direction of (light->pixel); find which frustum face it hits so we know which texture to look up.  Each face will have a view matrix associated with it; multiply pixel's WS position by that view matrix to find where on the depth image the pixel maps to.  Bonne chance !    
21-Jun-2006   4.57    
  Made a good start on the shadow res-bias thing - it's looking promising.    
  NOTE: ProjectorDepth.fx is currently bodged to help debugging the res-bias.    
  NOTE: Hid pointlight01 marker sphere because it was getting in the way.    
  NOTE: CMesh visibility testing is currently bodged to always return true.    
  TODO: Flatten depth image using shadow matrix, then adjust plane so perspective expands narrow end of frustum face as required.    
20-Jun-2006   1.5    
  Got debug lines working again (screen quads had been writing to zbuffer; UtilScreenQuad now sets zwrite false).    
  Checked that the frustum plane data are all correct.    
  TODO: When I come to fitting the frustum faces into the ORT views, draw each frustum face in WS to check it's fitting cleanly.    
  TODO: Res bias technique is currently X only; need to get Z in too, somehow.  Maybe using perspective to expand the near edge is indeed the way to do it (bring near edge closer to light till it fits)?    
18-Jun-2006   5.5    
  Got the sky colour sensible again after adding the deferred specular.  NOTE: device->Clear clears ALL MRTs.  This was happening inside CPatchwork::GenerateTextures.    
  Started working on the shadow res bias stuff.  NOTE: debug lines currently aren't working.    
  TODO: GET DEBUG LINES WORKING; CHECK THAT THE CPROJECTOR VIEW FRUSTUM STUFF IS OK.    
11-Jun-2006   10.5    
  RM: After changing an effect, you need to either F6 (faster - effect must be current though), or save, before exporting.  No change otherwise.      
  IMPORTANT: FLOAT VALUES LOSE PRECISION THE FARTHER THEY GET FROM ZERO!!!      
  Therefore it's best to subtract the VP from WS positions before storing them in an RT.      
  Spent ages trying to work out why my depth image colours were off; turns out I'd just set up some wacky blend mode in the ProjectorDepth effect >:| Or rather, that the blend didn't account for the fact that the target wouldn't be cleared to a sensible colour.      
  Had to disable dithering in the ProjectorDepth effect to prevent artefacts if using D3DFMT_R16F targets for it.  With D3DFMT_A16B16G16R16F targets it was  fine (?)      
  Can't go full-screen currently.      
  Got light colours passed through to deferred specular.      
  TODO: GET FLY CAM WORKING AGAIN; see end of CProjector::GenerateDepthImages.      
10-Jun-2006   7.15    
  Got the deferred specular working, YUSS!  Had to normalize the WS normals per-pixel.      
  Turns out you CAN store any values in floating-point render targets.      
  IMPORTANT: RM does not like dealing with any compile errors while multiple render targets are in effect (resets the machine, something about ati3daug.dll).      
  Tried to get the FX exporter project to build in vs2005, couldn't do it.  Bloody unicode bullshit again.  I suppose I'll have another go at some later date.      
  RM exports the 'SEPARATEALPHABLENDENABLE' renderstate typo'd as 'SEPERATEALPHABLENDENABLE'.  Really handy that, cheers.      
  Started to get some patterns that almost resembled the shadows.  For some reason the WS position image is seriously lacking in rgb resolution (?)      
  TODO: Stop the ground reflection drawing into the projector depth image.      
  TODO: Address the ws position blockiness somehow.      
  TODO: Get those shadows a-workin'.      
5-Jun-2006   1.24    
  Had to append "_Tex" onto the name of ORT effect parameters when retrieving handles, because the FX exporter appends that.      
  Remembered that UtilDrawScreenQuad sets up an ortho view matrix.  If it's used in conjunction with a shader that doesn't use the view matrix...well that was causing my deferred specular to come out crazy.  Now added a 'setMatrices' parameter.      
  TODO: Fix this current deferred specular problem; compare dummyScenery position colours with position colours in game, they're different.  Looks like RGB can be stored outside the 0..1 range?      
2-Jun-2006   2    
  Had trouble using UtilScreenQuad with a texture on it; ended up remaking it basing it on CModeDebug::ShowTexture; now works fine.      
  Made some progress with deferred specular.      
30-May-2006   2.75    
  Installed Tortoise SVN, nice Windows integration for SVN.      
  Had some difficulty removing folders from source control.  Ended up having to use the command line (svn delete) and then the right-click menu 'commit' option.      
29-May-2006   4.6    
  Added a linked list class (CLinkedList, CLinkedListEntry).    
  Added a render target wrapper class (CRendertarget).    
  Made CNoctmabuleApp into a gamemode (the very bottom-level gamemode).    
  CNoctmabuleApp (g_game) now owns all the render targets - much neater.    
  Decided I want to render the scene to an offscreen 16F render target, for HDR.  Need to render to such an ORT anyway so I can use MRT for the deferred specular images (ws position, ws normals).    
28-May-2006   9.75    
  Decided that shadow-casting lights will apply their light to the scene in a deferred specular pass over fullscreen images of each pixel's WS position and WS normal.  This includes the ground      
  PROS:      
  Means I don't have to worry about assigning lights to materials.  Which light reflects off what is a screen-space matter.      
  Provides vertical streaks for the lights in the ground reflection.  Can even fortify these by biasing the specular reflections in the Z axis ("to what extent is the vector from the pixel to the light VERTICAL from the player's point of view?")      
  Most importantly, lets me use the shadow image to block out only the light casting the shadow (not darken the ground reflection indiscriminantly like other games would).      
  CONS:      
  When rendering the reflection image, will have to duplicate the whole deferred specular process if secondary reflections are desired.      
  Hopefully shadows should provide suitable occlusion for the light reflections; if not it might look a bit odd that light can be seen reflecting 'through' objects.      
  Will want some code to decide the screen area in which each light reflects.      
  Realised that the notion of 'shadow range' doesn't make sense for specular lights.  Luckily my res-bias method should make limitless shadow range possible.      
  Had some trouble with this error in RM:      
  RENDERING ERROR(s):
   Invalid dimension or type in shader constant parameter named 'viewPosition' in pixel shader 'Pixel Shader' in pass 'DummyScenery'
     
  It made no sense.  In the end I just added a fresh float4 THEN added the vViewPosition semantic to it, and that worked fine!  Must simply be a bug in RM.      
  RM: CAUTION: Remember that the 'modelBoundingRadius' semantic uses the radius of the CURRENT PASS model (might be like a 1x1 square or something).      
  NOTE: Seems even on floating-point render targets, you can only write colour values between 0 and 1 :(      
  Removed the .suo and .ncb files from subversion source control - they were making a nuisance of themselves      
  MAX D3D9 MATERIALS CAN ONLY GO UP TO SM2.      
  From Max:      
  C:\Noctambule\Source\HLSL\BumpyWall.fx(258): error X3041: unsupported compiler target 'vs_3_0'

C:\Noctambule\Source\HLSL\BumpyWall.fx(259): error X3041: unsupported compiler target 'ps_3_0'
     
  Maybe the best thing to do is use dummy versions of the shaders for Max, that take all the same parameters as the real ones.      
  That's working now - just put "MAX_" at the start of the name of the Max version of the effect.      
  RM: got an export crash in an effect with a disabled first pass and an unused texture.  Deleted them both and one of them fixed it.      
  BumpyWall.fx is still referenced somewhere in the world but I don't know where (it's in a non-exporting material).      
  To get round problems, I've made BumpyWall.fx a relic (write-protected).  It should not be altered and is superseded by 'Bumpy.fx'.      
27-May-2006   8.75    
  Chose D3DFMT_R16F for the shadow depth images.  Might consider using DF24 DST later for cards that can use them; see ATI 'ShadowMapFetch4' sample.    
  Haven't figured out how to switch to my onboard 6100.  Managed to disable the Radeon though - wasn't a very smooth process.    
  Re-added all my .FX files to the project so they use the FX build rule.  For some reason it now only compiles one effect per build (???)    
26-May-2006   1.666    
  Worked out how to distribute the res of the shadow images.  It's going to be awesome - people will never work out how I did it.      
  Started on the CProjector class which I'll use for all the shadow-casting lightsources.  The job of CProjector will be to calculate the planes for the cube map faces, which ones need to be drawn, and the matrix required to fit each one to a square image.  Shaders will take over from there.      
  TODO: Ensure I'm clear about how to map the shadow images onto the environment.      
  TODO: Continue with CProjector (start with downwards face of Pointlight1).      
24-May-2006   4.25    
  - SHADOW/LIGHTING DESIGN is top priority.  It's something that's best planned out now rather than later.      
  Decided to use projected depth textures for the streetlights (see ATI ShadowMapFetch4 sample).  Sod sub-1600 cards, for the mean time at least.  The technique can be made to work on any old card later.      
  The main challenge is going to be hiding the aliasing.  The ATI sample looks nice but it's using a 1024*1024 ORT, and focusing just on that one object.  Some stuff to try:      
  Can the depth image be blurred?  I don't see why not.      
  Lightsources could take advantage of the fact that their whole range isn't always in view.      
  Since I'll be updating the depth images per frame, could the lightsources render depth images of geometry transformed by OUR view then by the LIGHT's view, to bias the res towards receiver geometry that's larger on screen?  The extra cost would be in the VERTEX shaders I'm guessing, which would be nice.      
  Somehow allocate more res according to each lightsource's range-size on screen.  Make sure lights at the far end of a street aren't actually rendering shadows, just doing simple light casting.  As they grow big enough on screen to cast shadows, fade smoothly from their plain light spot to the spot with shadows.      
  Will probably need five-faced (cube map) depth images for the general case.      
  Maybe casting lightsources farther away can be non-dynamic, and just hold onto static low-res depth images  for as long as they're on screen.  When they grow big enough to get dynamic, an off-screen cross fade from that to the full-res dynamic depth image can be performed.      
  REMEMBER: each pixel in our screen space can work out its texcoord in light space and its depth in light space (while it's being drawn to our screen space).      
  Could maybe do some screen-space sweetening of the final shadow image?      
  **** TODO **** GET CRACKING ON THIS SHADOW/LIGHTING WORK IMMEDIATELY.  IT'S GONNA BE A BIGGY.      
  TODO: TAKE SHADOW/LIGHTING REFERENCE PHOTOS ON A RAINY NIGHT (TOMORROW NIGHT?)      
  Examined both the POM demos.  Decided this is worth putting in at some point.  Actually seems very affordable when the sample limit is low, which it can be if the depth doesn't need to be extreme.  For the walls, probably best to perform the POM as deferred rendering, making it easier to use depth decals?  This will reduce image quality a bit, but that's probably not a big concern.  POM should really jump to life in stereoscopic mode - can't wait for that!      
  Decided I *do* want some fogginess in the town.  It just looks cool.  The enemies will look a bit scarier if they're sorta shrouded in fog in the distance.      
  Added sewage cover to the DX POM sample: file://C:\Documents and Settings\user\My Documents\Visual Studio Projects\ParallaxOcclusionMapping\ParallaxOcclusionMapping_2005.sln      
23-May-2006   2.85    
  Got Subversion working; the Noctambule folder is now under Subversion source control (only the stuff that needs to be though).  The repository is at C:\Repository.  Useful commands are 'svn commit' and 'svn diff'.    
  Got the level working again - it was just the reshuffle of losing the 'VSS' folder that had broken the DX9 materials.  Made a 'Default.fx' to help with that kind of problem in future (that's the default effect name used by DX9 materials).    
  VS2005 'build rules' are good.  Used one of these for my FX files; currently only handles debug config though.  Keeping the rule files in Noctambule\VisualStudio\BuildRules.    
18-May-2006   2    
  Installed Visual Studio 2005 (from C).  Took a copy of the install DVD (see 'Installs' folder).      
  Did away with the 'VSS' folder because it should never have needed to be there (was to do with a SourceSafe quirk).      
  Got the game running and debuggable in VS2005 :)      
  TODO: Set up Subversion ASAP.      
  TODO: Debug the current Leam.x; get it working (probably just a minor materials problem).      
  Eclipse said my X1900XTX arrived into stock today.  Should be here...tomorrow maybe?      
  So, the Noctambule project is up and running, at home, finally - w00t! :D      
16-May-2006   2.5    
  Got Max set up.    
  Got RenderMonkey set up.    
  Did a bit of landscape modelling.    
7-May-2006   5.5    
  RM: Stream mapping:
-seems to correspond to vertex declarations.
-affects RM previews only.
-does ordering matter?
-X mesh colour is in 'COLOR' format, not 'FLOAT4'.
     
  Keep getting this from RenderMonkey when I try to introduce colour streams:
DirectX Preview Window: Error setting up vertex data for model 'ScreenAlignedQuad': channel 'Color_0' data is missing from the model.
With X meshes, got to set the colour stream format to 'COLOR' not 'FLOAT4'.
     
  Tried using an X mesh in RM, haven't managed to get it to work so far, but it would be a good idea to use X meshes for previewing - rule out any file format differences.
Need to use the 'no frames' export option for RM preview meshes.
     
  NOTE: The easiest way of checking what does & doesn't come through in a mesh file is to use Deep Exploration.
But bear in mind that it can be a bit lazy about updating the preview when the file has changed.
     
  NOTE: X exporter swaps Max's Z&Y axes.      
  FVF CODES ARE A PRE-D3D9 RELIC AND THEY DON'T WORK - USE VERTEX DECLARATIONS INSTEAD!      
  Changed the mouse control so that push-forward is look-up.  This seems to be more popular.  I'll obviously add an option later.      
  Installed April 06 DirectX SDK      
  Released build 5, the first build to feature puddles.      
  I think I've worked out how to get mesh vertex colours from max into RM and the game - yay!      
  I'm quite inspired by these zombies:
http://ishi.blog2.fc2.com/blog-entry-180.html
Would they work in 3D I wonder?
Also the ??? tool is interesting reference for the dreamy effects.
     
6-May-2006   7.5    
  RenderMonkey: F5 to compile current SHADER; F6 to compile current EFFECT.
     
  Shaders: Watch out for those bloody D3DRS_WRAPn renderstates, they're confusing and hazardous.
If in doubt I think it's best to keep them at zero.
     
  Forgot about the perspective problems involved in mapping a ground ORT onto WS ground geometry; wasted a fair bit of time in PatchworkDimpleProcessing because of this :(      
  Turns out my dimple surfaces were in the correct 'plane space'; they just had inverted binormals!
Always check the obvious!
Binormals point DOWN, negative local Y.
     
  Fixed the 'sliding' puddles - the dimple lookup in Ground was happening too late, after the uv vector had been adjusted for a different type of lookup.      
  Started getting some weird framerate jittering (all configs).  There's a slight reqular jerk about once per second.
<- restarting the PC fixed this (?)
     
  Tried to minimise the number of pixels drawn in PatchworkDimpleProcessing - very important to do this kind of thing, big optimisation.
TODO: Return to UtilDrawGroundCoverQuad and get it working properly.
     
5-May-2006   1.5    
  NOTE: To make an uninstall shortcut, use the following as the 'target', replacing the product code with the current one from the setup project:
C:\WINDOWS\system32\msiexec.exe /x {4C676BFE-488E-4A70-9DE4-C3E957723CD3}
     
  Found you can get a 19" (diagonal) 16:9 1440x900 thin monitor for not much more than £150.  Tempting...      
  Tried to fix the dimple normal generation.  Decided I need to do this by drawing the ground effect plane, not a screen-aligned quad.  In this way, texture coords at any pixel on the plane will indicate pixel's world-space XZ position.  After offsetting that WS position for each neighbour sample, need to multiply into clip space to do the height lookup from ORT[3].      
3-May-2006   0    
  Placed the order for my PC, graphics card (X1900XTX!) and RAM.  There's screen grabs of the order details, and order confirmation emails, in the 'PC' folder.    
25-Apr-2006   5    
  Got ground dimples and puddles working pretty well, it's looking cool.
I'm a bit concerned about speed though - I think the bulk of the slowdown is from the real-time normal-map generation (unsurprisingly!).
     
  TODO: get dimple normal into proper plane space (in PatchworkDimpleProcessing) before multiplying Ground's plane-space normal by it.      
  TODO: Stop the dimple normals getting so extreme in the distance.      
23-Apr-2006   7.5    
  NOTE: Sundays are better for using the office (emptier) than Saturdays.      
  NOTE: ATI SDK includes RenderMonkey, CubeMapGen, and all the ATI shader papers.      
  MAX: Assigned ATI NormalMapperUI to the N key.  The tool seems to work just fine, but what on earth is an NMF file?  That's the only mesh format it accepts.
     
  nVidia Melody accepts 3ds files.  It outputs normal maps in DDS format, at the same location as the lo-res mesh.      
  NOTE: X850 supports OCCLUSION QUERYING!  See ATI 'OcclusionQuery' sample.
My CullPlane system isn't bad though; I'll stick with it for object occlusion culling.
Occlusion querying might well be useful for occluding light flare effects.
     
  ATI's Parallax Mapping sample doesn't support POM on X850.  Needs SM3.      
  Ordered the sound card (M-Audio Audiophile 2496) from Dolphin Music (http://www.dolphinmusic.co.uk).  £60.99 total.->Had to cancel this; first order has to ship to billing address.  Would've been nice if they'd made that clear before I ordered.      
  I'm getting a bit fed up of using this under-capable graphics card (X850).  If I'm going to be submitting this demo 3 years from now, it makes sense for me to be developing for the very latest hardware I can get my hands on.  If it doesn't run on anyone else's machine for 3 years, so be it!
So when I get this 'rig' of mine, I'm going to fork out for an SM3 card (likely ATI X1K series).  Just seems like a waste of time to be writing techniques that I'll end up replacing nearer the time because they're too old-hat.
     
  Decided I want patchy puddles.  I don't want my ground to be as flooded as the ground in Toy Shop; I want more variation.
Also I've noticed an absence of kerb-side streams in Toy Shop - I'll be making sure those are present and correct in Noctambule.
     
  Decided I want to add dimples to the ground.  This is a coarse normal-map layer that re-orientates the patchwork normals (currently the ground looks 'rough' but still 'flat').
Also, puddle depth will be a function of dimple depth.
     
  TODO: Draw dimple height to ORT[3] RGB.  Turn this into dimple normals on ORT[2] RGB.
'Ground' shader combines patchwork normals, dimple normals and ripple normals according to dimple height combined with patchwork height.
     
  TODO: ORT[3] RGB: ripple normals.      
  Removed MRT support from the Patchwork system; it wasn't being used because it was somehow causing problems on nVidia cards (even though the cards supported MRT).      
  TODO: Need a better system for compiling the FX files.  Having to add each FX to the project and set up all its build properties individually is no good.      
  Started adding dimple decals.  I can already see it's going to make a big difference.      
22-Apr-2006   5    
  Time to start on them puddles I think.  They're really important.    
  NOTE: The object matrix affects verts' positions only, not their normals etc.  This is good for ground patchwork decals because these decals get flattened by an object matrix; this flattening does not affect their vert normals (which can be used for fake undulation).    
  Had a proper look at the Toy Shop demo & slideshow; read a lot of stuff about parallax occlusion mapping etc.    
  NOTE: Apparently the POM method described by Tatarchuk works on 2.0, 2.b and 3.0 in separate implementations.  Still haven't found the code, but that would be mighty useful.<-must be in the ATI SDK (?)  Seems to need SM3.      
  Found and downloaded the latest ATI SDK.  It's easy to find on the ATI site (developer section, quick links).  WIll try this out tomorrow.      
  Downloaded ATI CubeMapGen, which generates specially neatened cube maps.  Looks great.  Removes the seam artefacts between cube map faces.      
21-Apr-2006   4.5    
  Scenics' CullPlane exclusion codes now get propagated to all the scenic's descendants, using CMeshFrame::SetCullPlaneExclusionsRecursive.  Mosley was getting occluded by its own cullplanes.      
  Put default materials on the trees to stop their reflections being pure white.  Can't be bothered supporting un-materialed objects; I'm happier using default materials.      
  Released build 4, the first build to feature occlusion culling.      
  TODO: Find out why some of those ground patchwork decals skew the reflection way off to the side.  Are they just tilted in Max?<-Yeah, that was just something srewy with their transforms in Max.  Tried all the 'reset' type options in Max but nothing helped so I'll just keep an eye out for them and replace them from scratch as I find them.  NB vertex normals in patchwork decal objects are honoured and should be (better to put fine undulations into decal objects than into the ground mesh).      
  Simplified the setup projects so they now take their files straight from the VSS folders.
Also cleared out all unused files from Graphics\Final.
     
  Made an instruction sheet for the build process: Builds\howto.txt.      
20-Apr-2006   3.166    
  Got CullPlane inter-exclusion working nicely ^.^
Been testing with cpBTSouthEast and cpBTNorthEast (both now have inter-exclusion set to 1).
This stuff is all in CCullPlaneManager::TestOcclusionVisibility.
   
19-Apr-2006   2.75    
  Ditched CullPlaneSuperchains altogether.  It's always a shame when work goes to waste, but it could've been worse.
The CullPlaneChains seem to be doing a great job on their own anyway.
SourceSafe label: "about to ditch cp superchains".
     
  Ground patchwork decals now use occlusion culling :)      
  Placed more CullPlanes.      
  Started setting up a simple inter-exclusion system for cullplanes, eg. for cpBTSouthEast-cpBTNorthEast.
This is the 'chain curling behind viewpoint' problem case that I knew existed but that I didn't think I would run into this quickly!
TODO: Return to TestOcclusionVisibility and continue this.<- done, seems to work really well!
     
  So nice to be rolling again - that superchain palaver was starting to get me down.  It's vitally important to keep it rolling.      
  TODO: For objects that are narrow on screen, do the occlusion culling using a single ray from a central top point.
This will be super efficient because the object is occluded if ANY plane covers that single point!
     
  TODO: Eventually, should also depth-sort the cullplanes - ideally very lazily, like once every couple of seconds.
They would then be tested in near->far order which should drastically cut down the number of ray-plane tests.
     
18-Apr-2006   2.17    
  Tried to think my way out of this superchain problem, couldn't do it.
In case I should forget what the problem is at some point, here's an example:
- look east along John St.
- cpBedfordNorthEast's corners are blocked by Mosley and Bedford Court.
- Mosley and Bedford Court are in the same superchain, so cpBedfordNorthEast is culled.
- cpBedfordNorthEast was visible in the gap between Mosley and Bedford Court.
   
  TODO: It's a bit of a compromise, but I'm going to have to ditch superchains* and use chains in their place (object is culled if its corners are covered by the same plane or by two planes in the same chain).
This'll mean more ray tests
and more objects passing the occlusion culling (only larger objects thankfully).
But at least it should get me rolling again, which is always the most important thing.
<- Works pretty darn well actually! :D
     
  *Superchain occlusion culling would work just fine for objects below a certain size though (eg. characters).
But the smaller the object, the less gain there is from checking superchains anyway, so I reckon it's best to ditch them altogether.<-done
     
  TODO: Place CullPlanes everywhere.      
  TODO: Get tree reflections properly coloured.<-using default materials.      
  TODO: Get ground decals culling properly (not popping out).<-The EMeshFrameFlag enum was out of sync with the CMeshFrame::flags bitfield (so ground decals didn't know they were decals and were using the wrong culling).      
  TODO: Release a new build.  Compare framerate with v3.4?      
9-Apr-2006   5.5    
  Had the minU and maxU swapped on x-major cullplanes.  Likes of cpBedfordNorthEast is working again.    
  Eventually got the superchains working just the way I wanted them, then realised the technique has a serious flaw in it.
It's hard to describe though, and I'm not sure what to do about it yet.
I'm amazed I didn't spot the problem when I was planning this out - it should've been obvious...
   
8-Apr-2006   3.25    
  Installed the ATI Toy Shop demo, but it doesn't run on my card.  I'm actually kinda glad!
The error message suggested that my card maybe didn't support the 1010102 format which is used heavily in the demo.
   
  Made some progress with the superchains.  Really need to get more hours in tomorrow.    
  Chose a PC I'm about to buy, so that  I can work at home without the noise distractions of the office (eg. other people's music).
This PC's got an onboard nVidia 6100 which should work nicely as a low-spec test card.  I'll add something a bit niftier (SM3 I expect) to do the fancy stuff with.
I'll be getting a RAM upgrade to take it to 1.5GB, and a nice sound card.
   
30-Mar-2006   3    
  Got the CullPlanes exporting accurately.  I just had the direction X component reversed, would you believe it!
Always check the obvious.
     
  Can now freely scale cullplanes.
TODO?: They still don't support transform resets though.
     
  JC reported a crash on his nVidia Quadro4 900 XGL; that's a high-end SM3 card.
TODO: Look into this.  Got a dxdiag in C:\noctambule\JC_dxdiag.txt.
     
  IMPORTANT: When 'Getting' stuff recursively from SourceSafe to a different (eg. backup) location, tick the 'build tree' option on, otherwise the explicit working folders in sub-levels will be used (dangerous!)      
  NOTE: PC375 does not have a DVD writer!  Only a CD writer.      
  Made a backup of the project.      
  TODO: CullPlaneSuperChains!  Go go go!      
29-Mar-2006   5.5    
  Re-installed the December 2005 DX SDK.  This brought back the Xbox surface viewer.      
  Fixed those link errors (see above).      
  Max: Objects can take on a funny scale when you connect them to a parent in the hierarchy.      
  CullPlane chains are now successfully generated by the game on startup.      
  Improved CullPlane exporting a bit.  It's now definitely right as long as you never use scale on them.  The two CullPlanes round the car-park wall are just temporary tests of this - they can be discarded.      
28-Mar-2006   3.5    
  Tried to get Max to export the cullPlanes properly.  Gave up because it was taking too long and all the stuff that should have worked didn't.
So from now on, I'm just going to have to make sure I don't ever SCALE CullPlanes.
It's possible I'll have another go at it later in the project.
     
  Reinstalling the Xbox XDK today seems to have buggered my project.  I can't link now - I get stuff like this:
Mesh.obj : error LNK2001: unresolved external symbol _IID_IDirect3DBaseTexture9
Reinstalling the Feb 2006 DX SDK didn't fix it.  I think it's the initial underscore in the symbol name that's wrong.
TODO: Need to sort this out somehow - what fun.<- just needeed to delete (or demote) the XDK lib paths in .NET\Tools\Options\Projects\VC++ Directories\Win32 - Library files.
     
  TODO: Continue with cullplane chain setup (CCullPlaneManager::PostParse)      
17-Mar-2006   2    
  Made a doc in which to record handy French vocabulary:C:\Noctambule\vss\docs\French vocab.txt    
  Improved the PA logo & icon.  Worked the icon into the installers.
I'm terrible once I start fiddling with icons and stuff - I can't stop!
   
  Changed the installers to build directly to website\final.
Removed debug configs to save confusion.
   
  Saved Photoshop palettes (.act files) for icons, in the Website folder.    
16-Mar-2006   3    
  Installed Xara X.      
  Made a Programmer Art logo and applied it to the game and website.  No idea why the transparency didn't work on the 16x16 256 colour version - switched the 16x16 to 16 colours instead.
The logo is a P and an A; the P is meant to look like a set-square (representing the programmer), and the A is meant to look like a warning sign.  It's like "Danger: coder graphics ahead!"
     
  Tried to get cullplanes exported more accurately.  Needs to take into account the node's pivot transform or something, but I haven't quite worked out how to do that yet.  It's just going to take a load more trial-and-error :/  Needs to be done though.      
15-Mar-2006   5.25    
  Website: Did a free submission to 10 search engines.      
  Website: Set up email forwarding - YAY!
This hasn't propogated yet ("Sender address rejected: Access denied"); I'll keep an eye on it.
     
  TODO: Work out why ground patchwork decals are popping out.      
  Decided not to store cullplanes grouped by chain, since some chains will be very long and contain planes that will be small on screen.
Instead I'll allow for depth/distance/size-on-screen qsorting later - should be a big CPU saving for the occlusion testing.
     
  TODO: NWF Exporter: Auto-generate and write-out cullplane chains.      
  TODO: Generate cullplane superchains each frame (but not between eyes).      
  TODO: Take into account chains and superchains in CCullPlaneManager::TestOcclusionVisibility.
The cullplane system should then be complete (basically).
     
  Added the level .X and .NWF to sourcesafe, just in case.      
  TODO: Return to CullPlane export and get the planes written out accurately (see previous notes).
What's there at the moment can't be far off.<- given up on this for now; workaround is to avoid using scale on them.
     
14-Mar-2006   4    
  Spent all evening trying to get the landscape hierarchy pruning working.  It was really very awkward, and I almost gave up.
It's working now though - currently managing to prune off 46 frames or so, if I remember rightly, which is great.
     
  TODO: NWF Exporter: Find out why Mosley only excludes cpMosleySouth (should exclude east and north as well). <- was using 'exit' instead of 'continue', skipping all but the first child plane.      
  TODO: Find out why CullPlane occlusion doesn't seem to be working at the moment.
<- wasn't initialising cullPlaneExclusions to 0.
     
  Max crashed on shutdown.  Opened the level again quite happily; didn't crash the next time.      
  TODO: sphere-frustum tests: use a world-space frustum to save transforming the sphere into view space.      
13-Mar-2006   4.25    
  Decided that CLandscape should be what contains the (sorted by material/effect) scenic list and what performs the scenic parsing.      
  C++: Memsetting a class instance to 0 breaks everything if it inherits from another class.      
  The NWF file is now parsed twice - once before the X file is loaded and once after.
Lights need to be parsed in before the materials in the X try to find them;
Scenics need to be parsed after their frames have been loaded from the X.
I can't make the system any cleaner than this because I'm not in control of what is and isn't written into the X file.
     
  TODO: return to CMeshFrame::PruneHierarchy.  Get this working so it removes all unnecessary frames, allowing duplicate visibility tests to be eliminated.  CullPlane exclusion should then be working fully.      
12-Mar-2006   3.75    
  Broke everything in the Max file by trying to connect the whole landscape hierarchy to a new parent.  This flattened the hierarchy.  I had also forgotten that moving the parent node moves all the child nodes with it unless you tick 'Don't Affect Children' in the Hierarchy panel.
Fixed it all in the end by rolling back a few versions in SourceSafe and repeating some work.
     
  Max: Schematic view: When you reconnect a node hierarchy to a new parent, it flattens the hierarchy!!
I expect I'll need to find a solution to this problem later on - might need to write a script for it.
     
  CullPlane exclusions now write out to the nwf file.
TODO: Finish the code side of the exclusion stuff.
     
  Saw that ATI 'Toy Shop' demo on Friday.  It put me in a very bad mood.  I'm going to pretend it never happened and carry on doing my thing.      
9-Mar-2006   2.75    
  Found an online translator thing at http://www.freetranslation.com - seems slightly better than Babelfish (but still not reliable of course).      
  MaxScript: For plugin members representing nodes, use type:#node rather than type:#maxObject.
The 'node' type gives you a proper node that you can get the name of etc; I don't know how to get the name from a 'maxObject'.
This stuff doesn't seem to be documented properly.
     
  MaxScript: using a class name (even with different case) for a variable name is REALLY BAD!
For example if you assign a value to a variable called 'cullPlane', you're actually redefining the CullPlane class as that value!
     
  Scenics now export the name of their designated CullPlane (the one that needs to be frontfacing for the scenic to draw).      
  TODO: Return to GetExcludedCullPlanes in NoctambuleWorldExport.ms.
Get the cullplane exclusions written out into the NWF.
     
5-Mar-2006   2    
  CullPlane exclusion: Planes will not cull the following objects:
a. Objects from which the plane descends
b. Objects descending from the plane.
c. Siblings of the plane (and their children) - DEPENDENT ON A FLAG, TRUE BY DEFAULT
d. Explicit visibility dependants of the plane (ie scenics that designate it as a visibility controller)
     
  Max: Found the 'always arrange' button on the schematic view - switching this off makes it a lot more useable.
Using 'arrange selected' where necessary seems nicer.
     
  CullPlane: Added the 'Cull Siblings' flag for case 'c' above.  I don't think I can automate things any further - sometimes you want planes to cull their siblings and sometimes you don't.  I'll keep a look-out for a pattern as I add the rest of the planes.
'Top-level' type planes need to cull their siblings, while 'child' type planes don't - but that's a vague statement because all this stuff can sit at any level in the hierarchy...
     
  TODO: Each frame carries a bitfield indicating which planes it's NOT culled by.
When I run out of bits, maybe each frame can start carrying one such bitfield per 'sector' or something like that...
     
1-Mar-2006   3.167    
  Installed ATI's 'fluid flow' screensaver.  Reminds me of the kind of thing I'll want for my intro...      
  CullPlanes now test their own visibility (once per frame in PrepareCullPlanesOnChangeOfView) to determine if they should be used when testing occlusion of objects.
This is a fast but approximate plane-frustum cull.  Planes that are deemed not visible are drawn in red, so keep an eye on this.
     
  Got the occlusion culling working (more) nicely.  It's so nice seeing everything pop out when it goes behind the CullPlanes.
TODO: use this on ground patchwork decals too (precalculate their bounds using ray tests down to the ground mesh).
     
  Decided I'm going to stick with occlusion planes.  Having placed a bunch of them now I can see that they're really quick and easy to use.  On the engine side they're ideal too.      
  TODO: work out why the angle of some of those CullPlanes ended up a bit skew-whiff.  Mix of 'view' and 'local' rotation modes??      
  TODO?: On export, calculate the plane based on the four vert positions (allowing complete freedom over transforms during editing)?      
  TODO: Got to stop CullPlanes occluding their 'own' buildings!      
  TODO: Fix current occlusion problem cases.  Make sure that the two planes occluding the two corners overlap, that oughda do it.      
  Changed my devlog converter thing so it doesn't crop the text at 1 meg's worth (now 8 megs, should keep me going for a bit!).      
28-Feb-2006   5.75    
  TODO: Remove the fly-cam from the next build (it confuses people).      
  TODO: Tune the camera control etc. to match Half-Life 2 or whichever other FPS is popular at the moment.
Getting the game feeling right for people - early on - is more important than I thought.
It does feel laggy/floaty at the moment, not sure why that is.
     
  NOTE: Can't use accents / cedillas in names of online files.  If you do, you can't link to them or even run them from the address bar of a browser.
Tested this in IE and Firefox.
     
  NOTE: HTML code for 'ç' is '%E7'.      
  Made a separate French installer and uploaded that version to the site.  Couldn't combine the two languages into one installer because I don't have control over all the strings.
Uploaded a slightly-updated version of the English install too (tweaked some strings etc).
     
  Reinstalled DX Feb 2006 SDK, because I was missing a dll and also I thought it might bring back my missing Xbox surface viewer (it didn't).  Didn't replace the missing dll either (so I fished it out of the bin instead).      
  Max: Never use scale on CullPlanes!  It gets too bizarre if you do.  The exporter now just writes out raw Plane properties - doesn't take into account scale.      
  Got the basics of the occlusion culling working nicely.  Need to avoid gaps where two planes meet though.  Maybe they all need to cross over each other slightly at the corners? - Yes they do  Maybe I should be doing this thing using lines (defining the tops of the occlusion 'walls') rather than planes?  I'll have a think about it. - I'm going with planes, they're easy.      
27-Feb-2006   5    
  Set up an installer using a .NET 'setup' project - gives me everything I need and more.
Currently just in English, TODO: French version
(combine both languages into the same installer to save work?)
<- can't.
I had to avoid using .NET SourceSafe integration, because it was getting itself in a right twist.  Just added the sln and vdproj files so SourceSafe manually, on their own.
Uploaded v3.4 which uses this installer.
     
  Setup: Default copyright warning was
"WARNING: This computer program is protected by copyright law and international treaties. Unauthorized duplication or distribution of this program, or any portion of it, may result in severe civil or criminal penalties, and will be prosecuted to the maximum extent possible under the law."
     
  Setup: Default update text was
"Please use Windows Update to check for any critical updates to the .NET Framework."
     
  Setup: Banners seem to want to be 500 x 69, even though only 497 x 69 pixels seem to get displayed (?).
These details might well be different on different Windows setups though.
     
26-Feb-2006   6.5    
  .NET: Links in comments open the file read-only :(      
  Restored visibility testing for the ground patchwork decals.
Must have been switched off as a test.  Need to use #pragma message to remind myself about that kind of thing.
     
  MaxScript: Ran into a limit on the number of 'else if's you can use together, in NoctambuleWorldExport.ms.      
  Set-up the game side of the CullPlane system.  It's basically all in place but not quite working yet.
TODO: Continue this.
     
  Shifted a bunch of maths functions from Util.h to Maths.h.      
  Added some new maths functions.      
25-Feb-2006   4.75    
  Decided the next thing to do was to extend the landscape culling.
I'm going to go ahead with a system of visibility/occlusion planes, beacause I think that's very suitable for my town environment.
     
  Found Max's tree primitives in Geometry\AEC Extended, and placed a few stand-in trees.  They pretty the place up a bit.
These have got an alpha pass that isn't currently drawn in-game; also their reflections come out white in the ground reflection because they've got no shader material on them.
TODO: fix this so they look presentable in the next build.
     
  Max: Shifted my plugins into dedicated Noctambule categories, eg. Noctambule Lights / Noctambule Geometry, using the 'category' keyword in the plugin definitions.
My 'CullPlane' primitive wasn't showing up till I did this.
     
  Added a 'CullPlane' plugin (extends Plane).  This is a finite plane that must be visible and frontfacing in order for its dependent objects to be visible; also it's an occlusion plane to block other objects' visibility.  Should be very effective.      
  Added a 'Scenic' modifier (Object-space modifiers\Noctambule Scenic).
This will sit at the top of the stack on
all scenery objects.  Currently just lets you specify a CullPlane for the object, using a 'pickbutton' control.
     
  Started laying down CullPlanes.
- These have to point their local Z axis away from the surface they run along.
- The planes must be vertical - must only use rotation round the vertical world axis.
     
  TODO: Change start point, spawn points and collision rectangles to be plugin classes rather than using user-property text.      
  CullPlanes now export from Max in the NWF file.      
  TODO: CullPlanes on the game side.      
24-Feb-2006   0.5    
  M reported a big speedup between v3.2 and v3.3 - presumably down to the major pruning of the bumpywall buildings and the removal of the ground depth draw & test.
Went from 29/30 to about 40 according to Fraps.
     
  Installed Firefox, checked that the website works ok on it.  Practically identical so far.  I'll make sure I test new content on both browsers as I add it to the site.      
  Asked IT for a copy of InstallShield.      
  Labelled everything in SourceSafe as 'v3.3'.      
  Thinking about landscape culling in more detail.      
23-Feb-2006   1.75    
  Got the patchwork / ground effect working without MRTs - went surprisingly smoothly.  Works on a 5900 now - YAY!
Uploaded v3.3.
     
  Installed MSN Messenger.      
22-Feb-2006   3.75    
  .NET: When editing web pages, don't use the browse button to point a picture ref at a local image file!!
The build 3 screenshot was missing from the front page because of this, and I didn't even know about it because I had the local file it was poining at! >:(
     
  Trying to fix this reflection glitch on the nVidia cards.  I'm using T's 5900, which is a handy minimum-spec type card for me (the game runs at a snail's pace on that machine!).
- Tried taking the ground depth clipping out altogether.  Made no difference.  Note that the zombies' reflections are chopped up just the same as the building reflections.  Interesting that on this 5900 the reflection is mangled out of position too, not just gaps like on the 6600 & 6800.  Taking the ground depth clipping out did get rid of the rendertarget contention warning I was getting.
- Reflection image is corrupted, but looks like it's mapping correctly onto the ground.
     
  Been getting this from CPatchwork::Render where it draws the receiver:
"Direct3D9: (ERROR) :DrawIndexedPrimitive failed.
D3D9 Helper: IDirect3DDevice9::DrawIndexedPrimitive failed: E_FAIL"
     
  Took the size of the reflection ORT down to 512 - this has a lovely softening effect on the reflections.  Prevents fizziness in reflections of brickwork etc.      
  Added an un-set of rendertarget[1] after the patchwork draws!      
  Started seeing this (when drawing general landscape) when I enabled 'maximum validation' in the DX control panel thing:
"D3D9 Helper: IDirect3DDevice9::DrawIndexedPrimitive failed: E_FAIL
Direct3D9: (ERROR) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD,0) does not have corresponding usage in the current vertex declaration
Direct3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):
Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0
Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0
Direct3D9: (INFO) :0, 24, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0
Direct3D9: (INFO) :0, 36, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL, 0"
     
  NOTE: 5900 can only render to one RT at a time :(      
  Tried to get a non-MRT version of the patchwork shader working.  Couldn't get it to behave.  Keeps ignoring the values I set for 'twoPasses' and 'currentPass' (or maybe doesn't test them properly, who knows).
Maybe try disabling preshaders as a test?
TODO: Get this working!
     
20-Feb-2006   7    
  It seems that Max will always crash on trying to load a level that uses a shader that doesn't compile.      
  Max has a nasty habit of caching textures so that when you update the texture file the change doesn't make it through to Max.
Restarting Max fixes this.
     
  Max: When adding any objects, remember to put them in their right place in the hierarchy!      
  TODO: Ground effect plane needs to lerp around discreetly - currently you can see it snapping when you step off a kerb.      
  Because of the space in the name of the folder "Batch Files", I had to add quotes to a path using that folder name, in build.bat      
  AnimUser.cpp: Moved 'AdvanceTime' call from render to update.  This stopped the zombies animating at double speed.      
  Added a bodge to correct the zombies' walk speed.  Noticed they're all walking in step at the moment - is that new?      
  M&G's 6600 GT is 128 meg.      
  Had to change the run.bat to copy d3dx9_29.dll into C:\windows\system32.  Need to find a better fix because I can't rely on that path.      
  Uploaded build 3, then build 3.1 with the above fix.      
  RenderMonkey's 'package exporter' isn't what I thought it was at all.  It just makes a zip containing the RFX file, the meshes and the textures.  Very handy if you want to share your shaders with other people, but I was looking for the exact opposite!      
  Relased build 3.2, which uses pre-compiled effects (fxo files) so that no-one can see my code.      
19-Feb-2006   11    
  Max: NOTE: The rendertarget scripts in patchwork.fx were causing max to crash when loading leam.max.      
  Max: M for material editor.      
  Max: Object render order is not depth-based :(
I've now changed the exporter so it 'ifndef _3DSMAX's zwrite=false and ztest=always.
Also changed it so it removes the scripts that max doesn't like (removes them even for ingame, since I don't use them).
     
  patchwork.fx: fixed the transformation of the normals, pretty much by guesswork.      
  HLSL: A PS float3 normalize uses three arithmetic slots.      
  TODO: (after build 3) remove CMesh::m_pTextures and m_pNormalMaps!!  And any other out of date junk.      
  Swtiched back to DX debug libs, and started seeing this:
"Direct3D9: (WARN) :Can not render to a render target that is also used as a texture. A render target was detected as bound, but couldn't detect if texture was actually used in rendering."
I don't actually think it's a concern.
     
  Had to remove 'd3dx9dt.lib' from the Release and Master configs otherwise they crashed.      
  Reconstructed my 'release' config because I was unclear about why it wasn't working properly.
After doing this I got a link error about 'test\winmain.res' not being found ('test' was the original name of the new release config).  This went away after I restarted .NET.
     
  Got a hefty speedup from minimizing the distance that the buildings extend below the ground.      
  Got a hefty speedup from drawing the landscape with CCW culling normally and CW culling when reflected.      
  Got point lights working on the zombies.  Just had to use the device's LightEnable method after SetLight.  Didn't need this for a directional light.      
  TODO: Get proper memory leak reports working.      
  Trying to track down those leaks.
- There's 134, that's 2 per CMesh instance.
- Not in CMesh::SetVertexDecl
- Not it CMesh::GenerateSurfaceVectors
- Nothing to do with CMesh::m_strMaterials
- Not in D3DXComputeTangentFrameEx
- Nothing to do with OptimizeInplace
- Nothing to do with InvalidateDeviceObjects
- " D3DXComputeNormals
<-Fixed it - pEffectInstanceBuffer in CMesh::Create
     
  Reenabled CMesh frustum culling.      
  Discovered a last-minute ground reflection bug.  Spent quite a long time fixing it.      
  Everything is working properly now, at last.  Build 3 will go online tonight (Monday night).  I could do it now but I'd be here till 3am, which wouldn't be so nice, and I'd rather not rush it anyway.      
  TODO: Straight after build 3
- back up the project!!
- get the FX code hidden (point release?) v3.2
- improve the devlog convertor thingy so it lets me hide rows (eg. those that describe effects processes).  Replace all non-space characters with '/' or something.
     
  TODO: for build 3: normal map for yellow road lines.      
18-Feb-2006   11    
  Got the '__Specular' and '__Diffuse' properties of bumpywall editable in Max again.  The exporter had just been culling them because they weren't used.      
  MAX: Couldn't find a way of getting the mesh's original vertex colours through to the shaders.  That would be really handy.
TODO: Need to work this out.
7.5.6: The shader's stream mapping needs to include a colour element!
     
  MAX: Found something to do with DX light maps in the material editor.  TODO: investigate.      
  Max's 'subdivision' modifier is my new best friend.      
  Added normal mapping to the reflective ground shader - SO PRETTY!      
  COOL!  RenderMonkey does support multiple simultaneous render targets!  It's absurdly easy to set up too.
I've applied this to the 'DummyPatchworkImage' pass of the 'ground' shader.
     
  TODO: Render the patchwork decals like so:
- Make a 'patchwork' shader for the decals, allowing them to write their rgb and their normals+gloss to two simultaneous ORTs.
- Use the patchwork shader to make materials for the decals (one per texture)
- Each material specifies its colour map and normal map
- Make a 'puddle' shader & materials for the puddle decals.
- The puddle decals will, initially, just ADD gloss into the alpha channel of the normal-map ORT.
     
  MAX: NOTE: The 'Instance duplicate map' menu item in the material editor can cause a crash when you click it.      
  Did a half-decent job of making a height map for that manhole cover:
- trace contour
- Gaussian blur
- PSP dilate
- curves
- Multiply layer
     
  Confirmed that an 8-bit PNG is smaller than an 8-bit BMP (though only a tiny bit smaller in my test case)      
  Photoshop: Confirmed that you don't need to set number of colours to 255 when reducing to 8 bit.  Just make sure the forced colours option is set to none.
I've been using 'local adaptive' for normal maps and 'local perceptual' for colour maps.
     
  TODO: FX exporter: Remove render target scripts because Max doesn't like them.      
  TODO: Some of those manhole covers have still got their surface vectors pointing the wrong way.      
17-Feb-2006   1.5    
  NOTE: X850 and 6200 both support up to 4 simultaneous render targets.      
  Started naming HLSL functions/variables/structs like C++ ones.      
  TODO:   Render planar patchwork to two simultaneous ORTs
ORT1:    (R,G,B,[Height]) - will need new shader for the water influence on height.
This height is final (it includes distortion by rain impacts and puddle surfaces)
ORT2:    (TsNx, TsNy, TsNz, [Gloss inflenced by water and by tarmac height but not by normals]) - will need new shader for water influence on normals & gloss.
These tangent-space normals are final (they include distortion by rain impacts and puddle flow).
--
Then draw the ground mesh to two ORTs.  The height data from the patchwork ORT can be used for parallax displacement at this stage.
ORT3:    raw R, raw G, raw B, [Gloss influenced by normals]
ORT4:    Nx, Ny, Nz
--
Then draw the ground + lighting & reflection in a single screen-space deferred shading pass.
     
16-Feb-2006   5.5    
  RM: Don't need to save before exporting.      
  Got the ground drawing again - in CMesh::Render I had been nulling the VS & PS if the mesh's effect pointer was NULL (this was stopping the ground effect doing its thing).      
  FX exporter: TODO: Stop the auto duplicate-remout applying to local variables!      
  Added a common shader effect bool param "groundDepthClipping".  Used to clip reflection geometry to the ground depth (borrowed from GroundReflection.fx "ReflectionGeometry" pass).      
  NOTE: RM can crash suddenly when you're typing something.  Save frequently; don't trust it.      
  Disabled Max's crash report thingy by renaming it 'DONT_SendDmp.exe'      
  Found that Max totally can't handle #includes in FX files.  I can see this being a bit of a problem later on - maybe I'll have to make the exporter expand the includes into the exported file.
TODO: Do this, so I can start using FX include files for structs and stuff.
     
  Stopped using the 'ReflectionGeometry' pass of groundReflection.fx altogether.      
  Ran into a PS arithmetic instruction slot limit (for the first time) in bumpywall.fx.  It was just test stuff clogging it up, nothing to worry about.  Did have to knock out luxury normalizes though, but I need to improve the modelling anyway.      
  Got the game pretty much back into one piece, and it's starting to look nice.  Build #3 should be ready this weekend if nothing else gets in the way.      
  TODO for build 3:
- Improve zombies' placeholder lighting (use same light as bumpywall).  This includes their reflections.
- Improve building meshes to minimize lighting artefacts etc.  Improve texturing too.
- Are the buildings being culled at the moment?  If not get that working (if it looks like a big job leave till after build 3 though)
- Normal maps for the ground
- Reduce ground reflection distortion to give the impression of perspective
- Blatantly-placeholder lightsource effect for the bumpywall light (yellow sphere - simple colouring shader)
- Fix shutdown memory leaks
- Polish bumpywall (most importantly, include diffuse lighting element)
- Pre-compile all shaders so the embarrassing source isn't visible
- Get master build running
- Make fly cam available in master build
     
15-Feb-2006   1.75    
  Landscape: Had to use D3DXGetDeclVertexSize in place of D3DXGetFVFVertexSize, because I'm not using FVF-code-compatible vertex declarations on the meshes any more (so ID3DXBaseMesh::GetFVF was returning 0).      
  Started getting this message on exit:
"D3DX: MEMORY LEAKS DETECTED: 134 allocations unfreed (16169 bytes)
D3DX: Set HKLM\Software\Microsoft\Direct3D\D3DXBreakOnAllocId=0x570f to debug"
<-Fixed it - pEffectInstanceBuffer in CMesh::Create
     
  I've disabled general landscape draw for the moment while I get the ground working.  Have I got a transposed matrix somewhere??      
14-Feb-2006   4    
  Got BumpyWall working perfectly in-game :D
I just needed to wait till after I'd pre-transformed the meshes into world space, before calculating their surface vectors.
Still got some artefacts but they're due to bad modelling, not shader problems (eg. see output from CMesh::GenerateSurfaceVectors).
   
  In Max, tangent-space normal is based on bumpCol.yxz; in RM and in game it's xyz.  Not sure why it's different in Max.    
  HLSL: Multiple #defines of the same symbol are a-ok.    
  FX exporter now #defines '_3DSMAX' at the top of every file, but wraps it in '#ifndef INGAME'.
Don't believe any talk of a built-in _3DSMAX_ define, there's no sign of it when using Max 6.
   
  Now using normals from the X file again.  I'm pre-normalizing them and pre-rotating them into world space at startup.    
  Tried removing as many normalizes as possible from bumpywall.
- removed all from the VS, ingame (I'm pre-normalizing normals at startup)
- TODO: remove per-pixel norms of incoming surface vectors (this brings down the quality of the effect a bit, but better modelling should help)
- removed norms of reflected vectors and rotated vectors
- can't remove norms of the normal map colours, unless filtering is all POINT and all normal-map mip levels have normalised texel colours (TODO? for distant surfaces?)
   
  Confirmed that the nVidia normal-map plugin for Photoshop generates normalised texel RGBs.    
  In master builds, shader effects are now compiled with the same '_MASTER' define.    
  Experimented with the sampler states on bumpywall.  As we might expect, maxed-out anisotropic filtering all the way gives the cleanest sharpest results.  Currently set to 8 levels.  I expect the 6600GT can do 16 same as mine.  DX9 lowest common denominator is 4.  It looks like requests for unsupported numbers of levels causes it to use what looks like linear filtering instead.
Tamed the moiring (especially on the normal map sampler) using mip settings.
   
  TODO: Get the ground back!!    
13-Feb-2006   3    
  Installed February 2006 DX SDK and its debug symbols.    
  Confirmed that the effect Set... methods do take a COPY of the data you pass to them.    
  I think the viewpoint Y discrepancy was nothing at all.  The -1170 height was just the one used when drawing reflected buildings (1170-830 = (170*2)).  I've disabled the reflected draw for just now.    
  Seems I've been a bit confused about these shader matrices.
Regardless of whether the matrix is declared row_major or column_major: _41,_42,_43 is always translation if the matrix uses a '...Transpose' semantic in RenderMonkey.
When the matrix is column-major, the watch-window display shows translation in the 4th column; when it's row-major the matrix doesn't display in the watch window at all.
   
  NOTE: Setting an effect instance vector parameter in SetMatrices will have no effect because it will be overwritten in the Apply method with the value that the effect instance has stored.    
  Found that the PS normals are all wrong on Bedford Court (the ones on the car park wall look ok though).    
  Found that in Max, the viewpoint is always at the origin and it's the world that moves and rotates.    
  Forced new normals to be generated for meshes, but it made no difference - Bedford Court was still wrong in exactly the same way.    
  Max got 'stuck' with bumpywall again.  Tried the usual tricks but couldn't get it to behave.    
  Positioned a light right up by the car park wall and got a result that's almost right.  You can definitely 'see' the light source.  Looks like the binormals and tangents are just twisted round 90°, or something like that (the peripheral highlights are on the wrong edges of the bricks).  I still don't know why Bedford Court's normals are so weird.    
  Need to call it a night there, otherwise I know I'll have a load of bad dreams about twisted surface vectors :/    
12-Feb-2006   3.25    
  HLSL: NOTE: Matrices are column-major by default, and apparently this tends to be more efficient in terms of instruction slots used when multiplying vectors by them, etc.
Row-major matrices can't be viewed in a watch window.
   
  Started adding my FX files into sourcesafe, because sometimes I edit them directly.    
  bumpywall: confirmed that viewToExterior._41,_42,_43 is the viewpoint.
Confirmed that the binormals and tangents in rendermonkey are ok.
Fixed a stupid bug: pixelToVP_unit was being calculated as viewpos-lightpos or something!  The effect is looking right in RM again now.
   
  Made more progress towards getting bumpywall.fx working in game the same as in RenderMonkey and Max...
NOTE: Currently using the viewpoint as the light source for this (test).
   
  Added WASD controls, in response to customer feedback ;)    
10-Feb-2006   0    
  Something about that viewToExterior matrix getting transposed and also not getting the lesser-used column/row initialised...      
9-Feb-2006   3    
  Note: There's surface viewers available in .NET, in Debug\Direct3D.      
  Got shader debugging working RARR!      
  Made more progress towards getting bumpywall.fx working in game the same as in RenderMonkey and Max...      
  NOTE: Panda exporter exports normals but not binormals or tangents.  The official max 7 exporter says it does export them.      
  For release build, had to remove the flags D3DXSHADER_NO_PRESHADER | D3DXFX_NOT_CLONEABLE from CEffect::Create.
Otherwise got the message "D3DX: Flags parameter is invalid" and a break.
     
  Next, got the error "D3DX: ID3DXEffect::SetArrayRange: Invalid handle" and a break.  Unhelpful call stack.
TODO: Fix this!
     
  Got rid of the flickering in bumpywall - viewToExterior was undeclared in the PS.
Bumpywall is no longer changing erroneously when the view orientation is changed.
     
  Now amending the the meshes' vertex declarations from the X file to include calculated binormals and tangents.
There should be no ambiguity in calculating these since they should just align with the texture mapping, and there's already exported normals.
Bumpywall is still wrong somehow.
Tried auto-computing normals as well but this made no difference at all (which is maybe a good sign). <- Normal generation was being waived because normals were already present.
     
  Found a Y discrepancy between g_viewInfo.position (eg {-10942.8, -830, 8794.94}) and the 'viewpoint' variable in the bumpywall PS (eg { -10942.8, -1170, 8794.94 }).  TODO: Fix this!      
8-Feb-2006   4    
  Eventually got to the bottom of the 'data size mismatch' error when applying effect instances:
Max exports combo-style effect parameter values as dword combo row indices (zero-based)!
So my 'PointLight01' value was just exporting as a dword '2', rather than the position vector of PointLight01.
     
  Changed the PointLight plugin so it exports each light's auto-calculated 'shader index' (see above).      
  Changed the ordering inside CModeEnvironment::OnAddedToStack, so that effect instances parsed from the level .X file can lookup point lights by index.      
  NOTE: FX files currently have to be in Graphics\Final for the game.  In Max, I'm currently using the copies from source\HLSL.  TODO: Sort this out.
Now always using source\HLSL.
     
  TODO?: Texture most landscape mesh in 1 metre tiles, then use mapping density parameters in the shaders/materials?
That makes it loads easier to change an object's texture without having to update its mapping.
     
  Made progress towards getting bumpywall.fx (my test shader) working on the landscape objects in-game.
Still not quite working yet, but it should be close.
     
  TODO: See if the meshes in-game have binormal & tangent data.  There's wacky numbers coming from somewhere; maybe it's just those vectors not being set up at all.
Right enough, they were all 0,0,0.
     
28-Jan-2006   6    
  Had to think about how I'm going to store and render the landscape.
- Keep the hierarchical mesh layout because it's great for culling.
- Divide the landscape into visibility 'sectors' (just special frames).  Need to divide the ground according to these sectors too, so maybe the ground frames can be the sectors' top-level frames (Max will need an object of some kind to create a frame, and I'd rather not use dummy bounding boxes).
- Within each sector, have a second layout that sorts mesh subsets by material, then by effect.
- Deal with alphas later (trees, fencing, windows etc).  Ignore all that for just now.
Set up appropriate culling for individual building faces later.  Each face will be a separate frame, a child of the building frame - will only draw if you're on the right side of its plane.  I expect all the most expensive detail will be in the building fronts (shop interiors, etc).
     
   - Cull shop interiors based on visibility (and size-on-screen) of the windows.  Windows need to tint-over when small to hide the interiors.  This will seem natural in many cases because windows farther down a street will tend to be viewed from a shallower angle anyway.
- Need a system whereby meshes can be re-used by multiple instances of an object.  Hmmm.  Look at the way the statemanager sample uses FrameMeshName blocks in its scene.x.  Can Max be made to export that kind of block?  Look into reference objects and X-refs, whatever they are.
     
  Excel is rubbish at dealing with lots of text in its cells, but you can sometimes help it along a bit by adding some newlines before/after the text.  You can also make several rows look like the same one by knocking borders off (as above).  Need to make sure you don't start the line with '-' though.      
  TODO: Make use of that nice CResource class that came from the StateManager sample.  I haven't used it for CMesh though.      
  NOTE: For shader stuff, object matrices seem to be referred to as 'world' matrices.  So object space seems to be referred to as 'world' space, how confusing.      
  My 'bumpywall' effect, the version that worked properly, seems to have been erased from history.
I don't understand.  I was saving, I was checking-in, saving, checking-in.  But it's not in the current RFX and It's not in any of the sourcesafe history versions.  HOW??!!  Maybe I started to get slack and use F7 instead of saving?  Looks like I didn't do a checkin at the very end of the 26th when I got it working.  I do remember getting an error message (that I ignored) from SourceSafe about a 'delayed write' failing - could that have anything to do with it?
TODO: Verify important code checkins!
I'm going to re-write that effect right now, even if it takes all night!! >:(
     
  TODO: delete all the really old backups in the Noctambule folder; back up the project again.      
  TODO: FX exporter: Make sure it handles auto-remout of 'shared' and 'row_major' variables!      
  NOTE: In RenderMonkey, F7 DOES NOT SAVE.  It removes the asterisks, to make you *think* it's saved, but it DOES NOT SAVE.      
  Also, SourceSafe waives checkin altogether if the file hasn't changed, which made the history record a bit confusing.  So what I must have been doing is using F7 instead of saving - then for some reason not saved before exiting - then exported over the working FX file earlier tonight.      
  RIght, I've re-written bumpywall.fx.  Luckily it took no time at all the second time round.
I've checked it in and verified the check-in this time!  Phew!
     
  Tried to work out what the 'data size mismatch' problem was all about; didn't quite manage.
TODO: Need to fix this!
It's like the materials' effect instances have got parameters for the wrong effects.
     
27-Jan-2006   2.5    
  Seems the official Max X file exporter only works for Max 7.
Installed the Panda one instead.
     
  I don't have a copy of the Max 8 SDK.  Apparently you need to be a 'registered developer' and pay a fee to get this.  It's also part of the Max 8 DISK install (my version is the download version).      
  Emptied my recycle bin, which seems to have got rid of the ten-minute wait whenever I delete something.      
  Wowza - Max 8 comes with a few more example shader materials.      
  Hmm, can't export anything using my shader materials from Max 8.  The exporter crashes.
I can export diffusebump, glow, all the basic ones.
Textured_bump crashes it.
Well I could spend hours working out what exactly it doesn't like, but I think it'd be a waste of time.
Since it doesn't seem to have an option to export Max 6 files, Max 8 is pretty useless to me for the mean time.
TODO: Come back to it later, see if the exporter's been improved / work out what's crashing it.
     
  NOTE: looks like 1x1 textures are a-ok.  'EffectParam' sample uses one.      
  Started setting up an effect pool and effect param blocks.      
26-Jan-2006   4.75    
  Installed Max 8 (an, erm, " evaluation " copy from G ;)      
  Had some buildings go flickery when I added a shader material to them (like it was drawing an unshaded version under it).
Was the same on Max 6.
Converting to editable mesh fixed this.
     
  Ooh, there's asset-tracking stuff in Max.  Is that new?      
  Put a copy of leam.max in the 'safe' folder before saving a max 8 version.      
  Set up keyboard shortcuts again - F for pan camera mode and D for fov.
Saved keyboard config in the noctambule folder ('kbd' file).
     
  Looks like the DX SDK only comes in English.  Installed the Dec 2005 version.      
  Kept a safe copy of the official max .x exporter that I tried to get working for max 6:
C:\Documents and Settings\PPalmer\My Documents\Visual Studio Projects\Max (TAMPERED)
     
  NOTE: FX parameters bit in material editor sometimes needs a bit of help updating after the effect's parameter semantics have changed.      
  MAN you've got to watch those W's when writing shaders.  DON'T MIX FLOAT4s AND FLOAT3s IF YOU CAN AVOID IT.  USE FLOAT3s WHEREVER POSSIBLE!!!!!!!!!!!
The new & improved bumpywall.fx was buggered for hours because the normals, tangents & binormals were coming in to the VS as float4s but then I was using float3s the rest of the way.  I suppose it would've been the 'mul's that were going crazy?
     
  Spent most of the night changing bumpywall.fx so that it hopefully wouldn't have those Gouraud artefacts.
And in the end, eventually, it worked!  It works stunningly!  I can barely believe how perfect and promising it looks.
I was misled for a long time by Max not reshoogling Bedford Court in whatever way it needed to - I didn't think I'd managed to fix the artefacts.  But I put a subdivide modifier on the building, then took that modifier off, then the building was properly reshoogled.  It even fixed some dodgy normals I had (?)
     
  Old version is BumpyWall_perVertex.fx.      
  YAY!  Max has finally got a fly cam! :D Needs a bit of taming though - it's way too fast at the moment.
Called "Walk Through" camera.
     
25-Jan-2006   4.33    
  pos & normal both in object's LOCAL space.
World-to-view converts it properly into view space though.
Light pos in WORLD space.
World matrix is being filled in as rotation/scale only!!!!!!!
     
  Max recognises:
ViewInverseTranspose
View
ViewInverse
     
  NOTE: RM currently doesn't export semantics for unused matrix variables!!      
  Max doesn't fill in a 'View' matrix translation.      
  Max does not recognise:
ViewTranspose
Projection
ViewProjection
     
  RM FX exporter now strips off 'Transpose' from all semantic strings.  TODO: Conversely, add 'Transpose' where needed.      
  Right, FINALLY got the shader materials working properly with the light positions AND the object transforms.
This took all night - I had to work out which matrix semantics were being recognised by the Max plugin, which ones it wasn't recognising, which ones it was mis-interpreting and how.
In Max, vert positions arrive in the VS in the object's LOCAL SPACE!!!  Took me some time to work that out.
I'm therefore having to transform vert positions, normals etc into view space then out into proper world space.
     
  TODO: See if the shader materials can be made to work properly on sub-objects (currently uses some wrong transforms somewhere along the line, but to be honest, I can live with it if I have to).
(No problem there - it was just that some materials had been set to use the wrong light).
     
  Should receive a nice present tomorrow that might make things easier…      
  TODO: Install December DX SDK, then get this bump effect through to the game.      
24-Jan-2006   6    
  Got sourcesafe integration working on the RM FX exporter and the devlog converter.  I hate sourcesafe.      
  IMPORTANT: Max shader previews TOTALLY DON'T WORK in orthographic views!!      
  NOTE: Have to normalize normals for Max.  TODO: wrap this in "#ifndef INGAME".
A 'normal' modifier with 'unify normals' ticked doesn't help (but 'flip normals' does - weird).
     
  CAUTION: HLSL lets you do 'dot(vec1.x, vec2)'!!!
This wasted so much time :(
     
  TODO: Look into ID3DXEffectPool.      
  NOTE: Max doesn't seem to be case-sensitive about its variable semantic names.
So relieved it recognises 'WorldViewInverse' (view->world, so I can get the viewpoint easily).
     
  Made a specular bump effect and got it working properly(ish) with the light positions in Max.
Took a lot of faffing and hair-tearing to get this going (much more than it should have), but I learned plenty from it.
Max doesn't take into account objects' local transformations, so currently I've just got a single light near the origin, working more like a directional.
     
  TODO: Get rid of the Gouraud artefacts in bumpywall.fx - shift some calcs from VS to PS.      
  Learned about tangent space - all far more straightforward than I'd imagined.      
23-Jan-2006   4.75    
  Wrote a little program to format this dev-log for the website (put most recent day entry at top, etc.)
NOTE: Excel is flakey at working out row heights and this transfers to the online log; I might do something about this later but till then we'll have to put up with random missing text.  Only seems to be a problem when the cell has a lot of text in it.
   
  Moved 'Acknowledgements and Resources' into a separate Excel file to facilitate html export of this log (exporting page only loses a bunch of formatting).    
  Had to hide some dev-log cells so they're not present in the online version.  String "<hash>hide" (case sensitive), anywhere in the day entry (eg. In the date row), denotes a hidden day entry.  TODO: better filtering system.    
  I'm going to keep the source log in html format since Excel seems to know what it's doing with it.    
  Started putting copies of the devlog on the site.    
22-Jan-2006   7.66    
  M&G's graphics card is an nVidia 6600 GT.  Should be able to do anything my X850 XT can do.      
  TODO: Get some InstallShield action on the go.      
  NOTE: FX FILES: First int of MeshMaterialList block is a number of materials...      
  TODO: See if Max understands the 'VIEWINV' semantic?      
  Started cannibalising the D3D 'State Viewer' sample for my landscape.  This has just started working - got the effects coming through and looking just like they do in Max!  :D  :D Got a few parameters to hook up though, but nothing too taxing I'm sure.
NOTE: Debug output: "D3DX: ID3DXEffect::SetValue: Data size mismatch".  This is what's causing the chugging.
All the old landscape code is still in place - TODO remove.
For future reference, this was a very good code-upgrade method.  Leave all the existing code in place and just append the new code to the end of the appropriate functions (denote the new code sections with comments of course).
     
21-Jan-2006   9.25    
  NOTE: Using D3DXMesh, model parts with different effects need to be separate meshes.
But within a single mesh, multiple different Max materials can be used, and these can send their paramters (including textures) to the effect.  Material = effect configuration.
     
  So, I'll specify effects at the CMeshFrame level.  Effects will be inherited down the frame hierarchy.      
  I wish I had my own Max exporter.      
  TODO?: OOD?: For the mesh system, make a 'material' wrapper that wraps the d3dx material with an array of textures that will all be sent to the active effect before the mesh draws.
See D3DXMATERIAL.
Now using CMaterial from the StateManager sample.
     
  No way!  There's  MaxScript menu in max, with a 'visual maxscript editor' in it!  When did that happen?      
  WICKED!!  You can create Max materials of type 'DX9 Effect' and it gives you a gui for all the effects parameters!  And it understands the Max lights as lightsources for the effects!  And you can see the effect in real time in the viewport!  And the effect info gets exported to the .x file!!
The only problem I've seen so far is it forgets which effect 'technique' each material uses (I'm guessing it's defaulting to the first one).
     
  NOTE: sometimes nvidia normal map generation does weird stuff if you ask it to put height into the alpha channel.  Maybe best to do this manually.      
  TODO: Change the RM geometry loader so it game-aligns meshes coming in from Max.      
  Spent ages adapting the RM FX exporter so it pipes the effects nicely into Max for use in materials.
Works a treat now.
Started chucking shiny bumpy materials onto objects all over the place!  So cool!
     
  TODO: Get the new effect materials through to the game!
TODO: Get the normal mapping on the ground working!
     
  NOTE: BumpyWall.fx isn't using lightsource positions properly in Max.  The default light source (viewpoint) currenty works best, but even that looks like it's slightly off.  This is only a stand-in effect anyway…      
20-Jan-2006   5.5    
  It seems that Max 7 has very good normal-mapping tools/support.      
  nVidia have got an impressive selection of shader-related tools on their site.      
  Installed an nVidia heightmap-to-normalmap filter for Photoshop.
Installed nVidia 'Melody' which might be handy when I start modelling objects.
     
  TODO:   Render patchwork to multiple simultaneous ort's (no more than 4).
ORT1:    R, G, B, Height
ORT2:    Nx, Ny, Nz, PuddleFlow
ORT3:   
     
  PUDDLES:
- Puddle depth is based on overall height image combined with vertex normals (steeper ground is less puddly).  Ideally puddles would slump sideways depending on ground normal, but I can't think of a nice way of doing it at the moment.  In addition to the height maps on all the patchwork decals, I'll also have a height-only coarse noisy bump layer which will be the main influence on where the puddles appear.
- Puddle direction is based on vertex normals, times the puddle flow multiplier channel.
- Flowing puddles will be done as flow-only patchwork decals lining the kerbsides.  I suppose the flow intensity should imply puddle depth too.
     
  Draw general patchwork with RGBA textures on 0 and NNNH textures on 1; write RGBH to ORT1 and NNNX to ORT2.
Draw flow patchwork with F textures on 0; write XXXF to ORT2.
Draw moisture patchwork with 
     
  NOTE: Pixel shaders can output a DEPTH value!      
  Installed FX Composer.  Certainly has its merits, but having to type in all the FX code makes it a no-go for me.
The "kick-ass" relief-mapping demo doesn't work on my card (it's 2.a and my card only goes up to 2.0).
Looked through the examples.  Couldn't see anything mindblowing.  The glass sample is nice.
     
  Gathered some reference photos from t'internet of wet streets at night.      
  TODO: Decide what to do about ground relief (and relief in general).      
  Started automating the gathering of bump map textures etc as the meshes' textures are loaded.  Needs improving…      
19-Jan-2006   3.66    
  NOTE: In RM, don't seem to be able to update variables in one shader to be picked up in a later one.
Eg., can't update a matrix in the VS and use those values in the PS.
     
  IMPORTANT: In HLSL, before normalizing a four-element vector, you have to make sure its W component is ZERO!
I have no idea why.
     
  Finally got the ground reflection distorting properly according to the surface normals.      
  From now on, I'm going to use game-aligned test models in RenderMonkey - does away with that axis conversion crap entirely.
Got the ground shaders working this way.
     
  NOTE: the ground reflection disortion is only "correct" for a vertex lying on the line of sight.  This is not a bug.      
  Subdivided Bedford street a bit because some of the funny reflections had been caused by huge / splintery polys.      
  TODO: Tidy up the existing shaders, the way they're all set up and that (game and RM).      
  TODO: Decrease the ground reflection distortion into the distance, to account for perspective.  NOTE this makes sense for buildings/lights but not for the moon (far less important).      
  TODO: Incorporate normal maps into the ground reflection distortion.      
  TODO: Get some prototype puddles in, then put build #3 on the site!      
18-Jan-2006   6    
  Got my zombie reflections drawing again.  It was just out-of-date ORT clearing resulting from changes to the reflection shader effect.      
  TODO: Try using Subversion for the web project instead of VSS (which doesn't seem to be up to the job).      
  Returned to the single Nocatambule.rfx shader project for the whole game - MUCH nicer.  The trick is to export the effects individually by right-clicking on them.
So you get a separate FX file for each effect, eg. Ground.fx, GroundReflection.fx.
     
  My 'groundReflection' effect currently comes out black in the preview in RM.  Nothing to worry about.      
  Started having thoughts about adopting Max / RenderMonkey's 'Z is up' coordinate system.  Decided not to, because D3D uses my 'Y is up' system (eg. it converts meshes to this system).  If I'm going to have to make conversions, I'd rather be doing it in exporters than at runtime.  Just a bugger for RM previewing really.      
  RM: Added an INGAME define (undefined in RM, defined in game).      
  Started distoring the ground reflection based on the surface normals (currently just using the ground's vert normals).  You can see it's *trying* to work, but it's definitely not right.
TODO: try displaying the plane-space normals (or the UV offsets) as RGB, to try to work out what's going on.
     
  TODO: Jazz up the website a bit when I upload build #3.  Stuff like the 'total hours' count would be nice, even this whole devlog.      
17-Jan-2006   2    
  TODO: Read up on VSS web project stuff!!  Looks cool.      
  Gave PPALMER VSS 'destroy' permission.      
  Tried to set up my VSS 'website\final' folder as a web project.  But when I try to deploy my site content, it just sits for ten minutes, overwrites my online index page with an empty file, then complains that it couldn't connect to the ftp site.  The ftp site that it's just finished mauling.      
15-Jan-2006   8.66    
  NOTE: RenderMonkey doesn't seem to know about multi-element textures (ORTs with two layers of colour).
But my card seems happy enough to create such an ORT for me though (D3DFMT_MULTI2_ARGB8).
     
  IMPORTANT: In a PS, can't be testing values of the current render target to decide whether or not to draw the pixel!  It causes a contention problem and gives you pretty random results.
This was buggering the sub-ground masking for the ground reflection.  Took me ages to work this out though.
     
  My road lettering came out as paint-texture blocks when I switched the patchwork texture to 64 bit.      
  Had a good old think about the ground reflections and how best to proceed with them.
- Will continue to render from the point of view of the reflected camera.  I considered rendering from the POV of a point on the reflection plane (making all the necessary mapping adjustments), then realised that would be bad POV (eg. what if POV was right next to a kerb - the kerb would block out buildings).
- Reflection render FOV should be flexible (up to 90° say).  I'm willing to render a five-sided cube map of the reflection geometry if need be.  This would be oriented with the reflection camera.  The minor sides would be much lower detail (eg. no characters, or lights only).
- The final surface normal of each pixel will divert the mapping of the reflection image.  I will probably have to scale the diversion based on the depth of the pixel, for perspective.  This is sound for building / streetlight reflections but not for the moon.
- The ground reflection plane, if I do decide to keep it (probably should) needs to morph around very discreetly.
- I'll want to figure out a way of reflecting the kerbs, later on.  It looks good already when you get what looks like a kerb reflection.
     
  Did lots of bits & bobs (fixes) on the ground reflections.  Pinning the reflections to the undulating ground was alarmingly easy!  Very similar to the patchwork mapping :D      
  Having been playing around with blue-sky, yellowish-black silhouette ground reflections, I'm feeling very drawn towards adding a daylight mode to the game (probably non-conflict; see wishlist log).  Because it looks eerily lifelike already.
I think it would be very little work and would be an awesome thing to include (like - survey the carnage early the next morning).
So from now on I'll be trying to make sure the stuff I do allows for daylight mode to be added later.
     
  TODO: Get the character reflections working again.      
  TODO: Get the road lettering working again.      
14-Jan-2006   12.33    
  NOTE: effects are not device objects, but they do/can contain device objects.      
  Got my head round the InvalidateDeviceObjects / RestoreDeviceObjects / DeleteDeviceObjects lark a bit more.
I call all the restores at the end of the game initialisation, as if the device had just been changed.
     
  Decided there was no reason to force device-dependent initialisation into its own stage.  Nothing should ever initialise during an absence of the device.      
  Found that you can (and should) set effects' texture parameters rather than manually setting the texture you want on the corresponding stage (which doesn't seem to work properly).
Need to NULL the texture parameter on losing the device though.
     
  Had to start splitting my shader effects into separate rfx files (ie. one file per effect).  This is basically because D3DXCreateEffectFromFile only supports one effect per file.  Also it will cut down on variable name conflicts in the fx file.      
  Managed to get the second pass of an effect working.  Just need to make sure I set all the texture parameters that are needed.      
  TODO: Get that 'clip' working in the GroundReflection PS.      
13-Jan-2006   5    
  Got the true ground effect plane working (currently just the player's ground normal, as a stand-in).  Had to adjust the shaders for this.
Took quite a while to get the patchwork decal object matrix right, but I got there in the end.
NOTE: There's a tiny decal culling bug - it's probably not taking object matrix scale into account.
     
  Fixed the RM-vs-game axis difference by defining _Y and _Z macros (as z and y respectively) that the exporter converts to y and z respectively.      
  TODO: Get that ground reflection rendered onto an ORT - I need to see it working!!      
12-Jan-2006   7.33    
  Removed CModePlay::updateFlags because I couldn't see a good use for them.  (Why did I add them?)      
  Moved all the environment stuff from CModePlay into CModeEnvironment, having decided I wanted to allow the possibility of rendering the environment as a background for the front-end menu for example, or during the credits, or whatever.  Fairly easy change.
This is also in preparation for multiple environment subset renders (eg. reflections).
     
  Accidentally got a sort of a golden-shine-and-running-paint effect from the patchwork PS by offsetting a second layer of colour according to the natural red component of each pixel.      
  CAUTION: Some of those D3DX functions, eg. D3DXMatrixReflect, do unwanted normalisation etc.      
  Changed all my vector3 functions to take vector pointers rather than references.  This is the way the D3DXVec3 functions are done.
Replaced SETVEC3 macro with Vector3Set function.
     
  Started working on reflection code.  This is initially for the ground, but I expect windows etc. will follow soon after.      
  TODO: Get the view set up properly in CModeEnvironment::RenderReflectionImage      
11-Jan-2006   3    
  Got rid of all the RM FX name mangling problems by auto-remming-out variable redefinitions (see define NOCTAMBULEFX_REMOVE_DUPLICATE_VARIABLE_DEFINITIONS).
From now on, can't re-use same name for different variables (all shader variable names have to be unique).
I'm still mangling struct names etc.
     
  Had to add a fix to stop function names getting un-re-defined (exporter didn't know the diff between a variable name and a function name; now checks for '( ' after the name.  Function names are mangled.      
  Continued building up the ground effect in RM, improving the exporter as necessary.      
10-Jan-2006   5.25    
  Note: texture surface levels have to be released when you're finished with them.      
  The name mangling (of the matrix mentioned above) seemed to have arisen from the matrix being prototyped in the VS (where it wasn't used) as well as in the PS.      
  Fixed a bug (" true" / " false") in RenderMonkey's FX exporter; added a new exporter "Noctambule FX Exporter".
Moved the RM plugins into "noctambule/vss/RenderMonkey SDK".
Added the FX exporter code to sourcesafe.
Wasn't able to get .NET-SS integration working on the FX exporter project.
     
  Noticed I don't have permissions to permanently delete files in the Noctambule VSS database.      
  Changed the ground effect to use the proper "ground effect plane" info.  This bypasses the axis-difference problem mentioned above (for now).  Next time I run into that problem I'll adjust the exporter to correct it.      
  Disabled RM FX exporter's shader variable name mangling (see define NOCTAMBULEFX_MANGLE_SYMBOLS).      
  TODO: Resolve remaining name-mangling problems (ie. problems arising from NOT mangling the names).      
  Started setting up the rest of the ground effect in RM - adding more passes.
Some of these are dummy passes, so I've changed the exporter so it doesn't export passes with "dummy" in their name.
     
  TODO: Take a field trip to France to celebrate 500 hours of work on the project (time flies!)<-done (june 2007)      
13-Dec-2005   5.5    
  I'm totally ECSTATIC to have got the ground effect working at last - I was beginning to worry that it might not be achievable.
Did this by moving the projection from view to clip space into the pixel shader.
It's like parallax mapping but using a mesh instead of a height map.  Looks gorgeous.  Even the artefacts look gorgeous.  I'm so proud :')
     
  RenderMonkey was mangling the name of one of the matrices, which was stopping the game version working for a while.      
  TODO: Sort out the rendermonkey-vs-game axis difference, and see if there's a way of preventing the name mangling problem.      
  TODO: Tweak the placeholder lighting and slap a new build on the site??      
11-Dec-2005   8.5    
  Spent the whole weekend trying to get the shaders right for mapping the patchwork on.
Landscape\Ground\p0 is the best I've come up with so far but it needs some kind of clipping.
I need either some better way of preventing perspective-correct texture interpolation, or some way of clipping pre-projected vertices with W's of 1.
     
10-Dec-2005   9    
  Set up a RenderMonkey 'Noctambule' workspace with the understanding that this will contain ALL my shader effects.      
  IMPORTANT: Had to switch the 'matViewProjection' (and 'matView') matrix in RenderMonkey from 'viewProjection' semantic to 'viewProjectionTranspose'.
So it would appear that D3D and RenderMonkey use opposite matrix formats?!
     
  NOTE: Can't view rendermonkey .fx files in the D3D effect viewer, for various reasons - not a problem to me since I'm happier using rendermonkey.  It supports drag&drop for a start!      
  NOTE: RenderMonkey is a bit flakey with its compile error messages.      
  NOTE: In rendermonkey, had to change my textures' origin to be 'bottom left origin', and my models' orientation to be 'RHS coordinate system'.      
  Wasn't able to run anything other than pass 0 of my ground effect (had to move the pass I wanted to run into pass 0)      
  NOTE: RenderMonkey seems to share Max's weird Y-Z swap.  Will need to deal with this in some nice way.      
  TODO: zwrite pass for the ground so it sorts with the buildings.      
8-Dec-2005   5    
  Started reworking the patchwork system.    
  Meshes now transform all their verts into world space, in CalculateBounds.  Saves having to set an object matrix when drawing each mesh.    
  Added special culling for ground patchwork decals - projects the object onto the ground effect plane and culls it from there.
TODO: optimise by taking advantage of the fact the object has no height.
   
  Got the ground decals rendering on their ground plane to the ORT.  Need the vertex shader next to map it onto the ground.    
5-Dec-2005   1.833    
  TODO: Re-work the patchwork system as follows:
- Render all visible decal objects onto the approximate ground plane, on a screen-sized render target.
- Use a vertex shader to project each ground vert onto this plane, thence into screen space to get the UV coords for using the ORT as the ground texture.  Camera-space texture matrix might be of some use.
This will solve a bunch of problems, most importantly it'll give me the res I'm currently lacking.
The approximate ground plane is the same one used for the ground reflections.
     
  Fixed the ESP problem by linking with d3dx9d.lib rather than d3dx9dt.lib.  Tom Gaulton suggested it could have been a bad mix of libs that was causing it, and he was right.      
  Eventually got some sensible results out of the 'BasicHLSL' FX - phew!
I'll now start cannibalising this into the new patchwork effect for the ground.
As soon as that's working, I'll set up the ground reflection effect to pipe it through :D
It'll be ACE!!
     
4-Dec-2005   9    
  Re-installed DX9 Aug 2005 - this gave me back my shortcuts etc.    
  Installed RenderMonkey - looks like a really good effect editor and has tons of example effects.    
  Clouds - see RenderMonkey example "Reflections Refactions\OceanWater_ASM"    
  Got the missing DX code stuff back in - must've been the uninstall attempt that removed them.    
  Started planning the custom per-pixel ground lighting / reflection.  The RenderMonkey "Reflections Refractions" example is a very good reference, especially with the 'bumpiness' value turned up high.
Had to remout the blur offsets array from the final pass of the reflection effect to get this workspace to export (?)
   
  Started adding .RFX (RenderMonkey) files to the project and SourceSafe.    
  Can't launch RFX files from .NET.  RenderMonkey opens but not with the document.    
  Got rid of the 'unicode' configs.  The normal configs are unicode now.    
  NOTE: Use UtilCreateEffectFromFile instead of D3DXCreateEffectFromFile.    
  Couldn't get any effect to work.  Calling any function on an effect is giving me "value of ESP not saved properly..." error.    
3-Dec-2005   5.75    
  Found that some DX stuff suddenly didn't exist (probably because of the attempted uninstall then reinstall):
D3DXComputeTangentFrameEx;
D3DXFX_NOT_CLONEABLE.
Luckily the game seems to run fine without them.
   
  Found that all objects in max need to have their object colour set to full white, otherwise their object colour always pollutes the exported vertex colours.
That is unless you use the 'ambient diffuse override' thingy in the exporter.
   
  Found that ampersands should not be used for naming obejcts in max.    
  Found that after using max for a while, the game can fail to create a d3d device.  Closing max fixes this.    
  Cleared the node colour of everything to white.  Told max to use white for all new nodes.    
  Got rid of placeholder solid colour materials - shouldn't need this kind of thing again now that I've sussed the colour lark out.    
  Added a 'PointLight' plugin for dynamic point lights.    
  Added CLightManager, the class that stores and manages all the dynamic lights.  This is now parsing the PointLight instances nicely.    
  Spiced up the website with some keywords.  Found that it is showing up in Google now, even if you limit the search to English results or French results :)    
2-Dec-2005   2.5    
  MaxScript: Found that spinning 'objects' only gives you the non-hidden nodes.  If interested in cameras, you should spin 'cameras'.    
  PhotoPoint: Added a UTIL button for doing general fixup stuff.  Used this to correct the paths of all the photocam photos.
Although this worked, leam.max still contains those same "\\newdell\p_drive " paths.  No idea what that's all about, but it doesn't seem to be causing any problems.
   
  Decided to ditch the P: drive and move the Noctambule folder into the root of C: instead.  The P drive was a brilliant idea in theory, but in practice it caused more problems than it solved.  Those network folders just don't work as well as they should.
Anyway, this changeover went frighteningly smoothly.
   
  M & G confirmed that the build (v2) downloaded from site runs perfectly :D    
30-Nov-2005   2    
  Removed the redundant lib copies from run.bat; checked that it still works.
I reckon the old lib copy should do no harm though, even on new DX versions, since the libs are numbered according to version.
   
  Found that DX9.0c runtime can't be uninstalled - it even says so on the Microsoft site.  So I wasn't able to install a French runtime to test with.    
  Added the batch files to source control.    
  TODO: I've asked IT to let me change my computer name back temporarily.  PhotoCams need to save the FILENAME of their bitmap (UPDATE - they already did), and this needs to use "P:\" rather than "\\pc375\p_drive\".  Test this by changing the computer name again.
Existing photopoints in leam.max are completely broken till I can change my machine name.
   
11-Nov-2005   6.75    
  Had to move all my folders containing source-controlled stuff into P:\Noctambule\VSS, in order for .NET SourceSafe integration to work.
I think it's because of IT mucking about with network stuff.  They even changed the name of my PC so I had to re-map drives etc!
   
  Found that I could control the game using Tony's RC aircraft controller (eventually worked out that this was why the controls seemed jammed!)    
  Got the game running in the new location (VSS folder).    
  NOTE: Files deleted from the P drive (or any 'network' drive) get properly deleted, not sent to the recycle bin!  TODO: Find a way to change this?    
  Found that the .mdmp crash dump files that get created for Microsoft are quite useful for debugging crashes that are otherwise hard to get to (eg. fullscreen-only crashes).    
  Had to add d3dx9dt.lib to the project's linker input for Master and Release configurations.  It was complaining that the likes of IID_IDirect3DBaseTexture9 were unresolved external symbols.    
  TEMP?: Disabled the F1 (control config) key in full screen because it was causing a hang that I couldn't really debug.    
  Found that the game clamps the window size, so the default window size works fine on any res :)  I'll therefore probably leave windowed as the default until the game nears completion.    
  Re-arranged the file/folder hierarchy of the install because the game wasn't finding files properly since the shift to the VSS folder.  TODO: improve the file finding!    
  Put build #2 on the website; updated the website.  Added some more folk to the mailing list.  Submitted the site to Google.    
3-Nov-2005        
  Found a util for making font textures out of font files: C:\Program Files\Microsoft Xbox SDK\xbox\bin\fontmaker.exe    
29-Sep-2005   3    
  Set up a memory-depletion handling function, 'HandleMemoryDepletion'.    
  NOTE: The 'unreleased device objects' error box is displayed from DXUTCleanup3DEnvironment (DXUT.cpp)    
  Remembered about the AXIS(vec, axis) macro.    
  Set up a 'NEW' macro (to replace 'new') which causes leaks to display their origin in the source.  Should nearly always use NEW instead of new now.  Defining 'new' as something caused problems for classes trying to override their 'new' operator.    
  Fixed the unreleased device objects - they were temp surface obejcts created by a 'DEVICE->GetRenderTarget' in CPatchwork::GenerateTextures.  Now calling Release on the surface when finished with it.
It was also a 'texture->GetSurfaceLeve' in CPatchwork::ApplyTexture.  Bizarrely, this Release returns S_FALSE rather D3D_OK (??)
   
  I can get into full-screen now, but I can't get back out…    
  TODO: get that surface level mentioned above, in the restoredeviceobejcts function rather than where it is now.    
  Moved the landscape shutdown into its destructor (from its shutdown method), because the shutdown method was never getting called! (hence the leaks)    
28-Sep-2005   5.5    
  Fixed the patchwork sorting bug.  So the patchwork system is up & running now, that's good.    
  EXCEL: Ctrl-cursor to cursor through text rather than between cells.    
  TODO: fix the misc. bugs in order to get build 2 together; also set up placeholder lighting (the beginnings of the real-time lighting system).
After that, probably pixel-shader-o'-clock :D
   
  Added a default material, 'g_defaultMaterial'    
  TODO: Work out how the patchwork is still leaking memory; get it alt-entering smoothly.    
  Got the zombies and crosshairs drawing again.    
26-Sep-2005   5.75    
  NOTE: The '* Unicode' project confifurations are not to be used (the normal configs are now unicode anyway).
TODO: get rid of the unicode configs.
   
  Set up multi-band support for patchworks.  Road patchwork is currently working pretty well with 3 bands.
Used the 'border' texture-addressing mode for each of the bands except the outermost one (wrap).
   
  Bunch of improvements to the mesh classes.    
  Patchworks now gather up all the decal frames inside the outermost band, then qsort them by height.  Z write and Z test are now disabled when generating the patchwork textures.
Inner bands then spin through that decal subset testing visibility and drawing their visible ones.
TODO: Sort out the weird drawing problem resulting from this qsort!
(D'oh! I was interpreting the qsort callback parameters as mesh pointers rather than mesh ptr-ptrs.)
   
25-Sep-2005   5.5    
  Tried enabling 4-sample multisampling for the window.  Did what it said on the tin, but also corrupted my ground patchwork and increased tearing, so I disabled it again.    
  TODO: Only move the patchwork ranges by multiples of their world texel size!  This will completely prevent fizzing!!!! :D
And it does!  Yay!
   
  EVENTUALLY sorted all the problems with the patchwork texture matrix, but this took up most of my evening.
Texture transforms are always a complete bitch.
   
  Added multisample support for patchwork texture generation, on an option (defaults on).  TODO: check the multisampling is doing its thing; check caps before enabling multisampling; do away with redundant surfaces when the option is off.    
  TODO: Fix the lighting / renderstate / flickering issues to do with patchworks.
I had been preventing materials (as well as textures) getting set when drawing patchwork receivers.
   
  This patchwork system is really proving itself worth doing now :D  Works a treat.  They'll never know how it's done, tee-hee!    
24-Sep-2005   10    
  Made placeholder pavement & road textures, 'placeholderPavement' and 'placeholderRoad'.    
  Fixed the top-down orthographic culling, phew!    
  Got the beginnings of the patchwork system up & running.  It doesn't seem to like ORTs bigger than the primary render target, so it's currently very fizzy.  Longer intervals between patchwork updates will reduce the fizz I suppose (currently every frame).
I need to get the patchwork rendering looking decent or else I won't be able to use it.
I'm worried about my patchwork height map / normal map fizzing - could look really bad.
   
  TODO: Get the patchwork system to survive alt-enter; see how things look with a 1024*1024 ORT.
Investigate <device>::CreateRenderTarget, and multisampling for the offscreen rendering (might help against the fizz).
   
  NOTE: Looks like ORTs have to be power-of-two dimensions    
  NOTE: 512 is a good res for a 4*4m patchwork range.  I'm thinking I'm going to need to do multiple passes of the patchwork render, to get a sort of manual mip-mapping thing going on.  Luckily, the patchwork system lets me keep the ground geometry nice & simple, so multiple renders of it shouldn't be too bad.  Maybe say 4m, 16m and 48m, all at 512.  And of course, the bigger the square, the less often it needs to regenerate its texture!  Cool.  There's hope for this thing yet...    
  Now defaulting to a full-screen window - best of both worlds.    
22-Sep-2005   2.5    
  Improved the camera system and the view-info system.  Well worth doing - it's nice & clean now.
Added UtilTestXZBoundsVisibility, which is now used for CPatchwork's mesh culling.  *Nearly* ready for that offscreen rendering…
   
21-Sep-2005   2.25    
  Investigated the official Max .X exporter (C:\Documents and Settings\PPalmer\My Documents\Visual Studio Projects\Max).  Trouble is it's for Max 7.
I hacked the code up a bit and got it loading and running on Max 6, but trying to export anything more complex than a sphere just crashes it.  I couldn't see a way of debugging the crash either.  I could really do with a copy of Max 7 - I'll look into that...
   
  So I'm thinking I should try to reconstruct the hierarchy myself based on bounds containment, or something…
Actually no, a MaxScript plugin to write out a map of the hierarchy would be better, then this can be reconstructed by the game.
   
17-Sep-2005   13    
  Did a first pass texture shoot round Bedford Court, from about 7.20->8.20.  Came out well - definitely stuff there that will make it into the game.  Timing worked pretty well too; plenty of light but not too much activity.  Might do more tomorrow    
  Cameras now have names; added a CNameUser base class for this.    
  Got rid of old DebugCamera files because they weren't being used.  Added a 'Source\Graveyard' folder for this.    
  Eventually sorted all my hierarchical landscape bounding sphere culling problems.  Took much longer than it should have though.
I've been a bit sleepy from having got up so early for the texture shoot.
UtilTestSphereVisibility is deadly accurate now.
   
  Found that ImageAlign is a far better tool for reshaping texture photos than Photoshop's (current) transform tool is.    
  256*256, 8 bit PNG ~= 66K.  That's good!    
  TODO: use normal mapping on windows to give the impression of warped glass.    
  Had another play with the Flame materials, to get me thinking.  Stumbled across a smashing parallax refractive rain-bounce effect for the ground!  (parallaxRainTest.fmt).  Uses a glass-smash texture that Steve T did, but I'll want to animate or proceduralise my height map.
Added a 'Mockups' folder with screenshots of this stuff.
   
16-Sep-2005   2.75    
  Put a  temp welcome page on the website.    
  Got a Zbrush crack from G.    
  I can’t stop admiring my new baby website!  It's so cuuute!    
  Jettisoned the DXUTMesh files, copying the code instead into the Mesh files for extension.    
  Landscape: replaced a wad of code to determine the mesh's vertex size, by using D3DXGetFVFVertexSize(pCollisionXMesh->GetFVF())    
  Mesh: used D3DXComputeBoundingSphere to get frames' bounding spheres and centres, but they look like they're in hierarchical space or something.    
  NOTE: CMeshFile inherits from CMeshFrame!!!  Duh!    
  Tried making sure the view matrix _44 was set to 1 in case that was what was causing the ED view angle glitch; no luck.    
  Unremmed-out UtilTestSphereVisibility.    
15-Sep-2005   3.5    
  Bought programmerart.org for two years, plus one year's hosting. :D  Now I am the master.  The web master.    
  DXUT.cpp: bodged-out a check that was failing saying that I was running a different version of DirectX from the one that DXUT was compiled on, or something (?)  D3DXCheckVersion.    
  Got hierarchical mesh loading and rendering working YAY!  The DXUTMesh file was confusing; turns out the CDXUTMeshFile class was the hierarchical one, the one I should've been using.  CDXUTMesh is a flat thing, used for leaf meshes in the CDXUTMeshFile's hierarchy.    
  Been changing WCHAR stuff in the UT code to be chars.    
  Photoshop's 'filter\texture\grain\clumped' gives a nice tarmac effect.  'Wave' and 'Zigzag' filters can be used to make lettering look hand-painted (TODO: apply this to the pavement font texture).    
  CModeStack: Fixed bug with Pop(); added destructor that empties the stack (I had some memory leak warnings without this).    
  Jettisoned some 'indexed shaders' stuff from CAnimMesh; old legacy junk from the MultiAnimation sample by the looks of it.  It was causing a crash when I alt-entered, because it was trying to do Invalidate/Restore type stuff with it although it hadn't been set up.    
  Made landscape collision be generated only from the "ground" object.    
  Got hierarchical culling working fine using object centres.
TODO: Get all this landscape culling working nicely (bounding sphere + XZ bounds for top view) so I can get going properly on the patchwork system.
   
14-Sep-2005   4.5    
  TODO: Texture photography this weekend!
If I'm going to be experimenting with the patchwork system, I might as well work on textures I can keep rather than have to throw away.
Get tilable road/pavement surfaces, caps and covers, patches, seams, cracks, etc.
- Clean pavement tile(s)
- Clean road tile(s)
- Big cover outside Bedford Court
- Bedford brick
- John St. sign?
   
  Had to add d3dx9.lib to the project's linker input.    
  Installed the August 2005 SDK update, because I got a DXUT init message saying I was running "the wrong version" (D3DXCheckVersion).    
  EVENTUALLY managed to get the game running again, using CDXUTMesh for the landscape, and having jettisoned all my old util files from the previous SDK.  What a big old ball-ache it was though!    
  Decided it's easier to do all my filename strings as good old-fashioned char arrays, and convert them to wide strings at the last possible moment when necessary; added a nice lazy util function for this - UtilGetTempWideString.    
  Been thinking a lot about a procedural texture system kinda like the patchwork system, mostly for wall text.
Would be awesome to be able to zoom in on kebab-shop menus and read big car-park signs and stuff!
   
  Tried to use CDXUTMeshFile::CreateFromResource, couldn't do it.    
13-Sep-2005   0    
  In .NET, ctrl-alt-P brings up a nice 'processes' window that lets you attach to any process currently running!    
12-Sep-2005   4.5    
  TODO: remember to investigate the 'shader debugger'.    
  Placed some more road lettering, using Max's 'reference' copies.  DISABLED & LOADING ONLY on Bedford Street.  Very quick to do :)
Road markings make a lovely relaxing 5/10 minute break during tough coding.
   
  Tried to use the CDXUTMesh class.  Found that the DXUT stuff needed a unicode setup.  Got into a world of hurt trying to set this up - jettisoned all my existing DX util type files from the previous SDK, and started setting the app up in the manner of the new samples (looks quite a bit cleaner).  More still to do...
The DXUT stuff looks good.  I just wish they'd make their mind up about this stuff!
   
  TODO: Get that pixel motion blur in for the next build.    
11-Sep-2005   10    
  I'm now using self-extracting zips for the releases.  This is because the temp storage folder on X:\ was deleting some of my files, when obviously it's better for it to delete either everything or nothing.      
  Installed WinZip because ZipCentral is a bag of wank.      
  Found a site all about roads and road markings: cbrd.co.uk.  This contains downloads and info for all the road marking fonts :)      
  Got the 'pavement' font plotted out using Xara.  Just need to add variation to the bitmap now, including alpha channel variation for thresholding.      
  Added a 'pavementLetters' object that I'll use to create road lettering.      
  Started setting up a hierarchical mesh system.  Eventually stumbled into the CDXUTMesh class which appears to do exactly what I'm after (even optimises the mesh).
TODO: Assimilate CDXUTMesh into CMesh!!!!!
     
  Installed the DX file formats plugin for Photoshop / PSP.  Lets you save fancy .dds files with mips and stuff.      
10-Sep-2005   8    
  All file paths are now specified relative to the game root folder.  For example:
g_gameRootPath = "..\\..\\"
textureName = "Graphics\\Final\mytexture.png"
LoadTexture("%s%s", g_gameRootPath, textureName);
     
  The game root folder is now designated by the existence of a file whose name is defined by GAME_ROOT_MARKER_FILE (currently "GameRoot.dat").      
  TODO: Stop using DXUtil_FindMediaFileCch!!      
  Couldn't stop the background plane photos exporting with leam.x.  Even tried hiding every layer, but they still exported :(      
  For some reason, the giant quads on the ground obejct were causing the HOP tests to fail (the pre-collide test was bailing out; forgot to try skipping the pre-collide).  Worked round the problem by putting a few arbitrary cuts in the giant quads.      
  Found you can batch-build projects by right-clicking on the solution item in the solution explorer.      
  Ran into a problem with the shader data in the project resources.  Got round it by removing the data and using D3DXAssembleShaderFromFile instead of D3DXAssembleShaderFromResource.      
  Removed redundant options from the app's menu.      
  Got V1 running on PC228.  First it complained that it couldn't find d3dx9_26.dll (this file didn't seem to be on the machine anywhere, despite me having just installed DX9.0c.  No idea what that's about.  So I made a 'run.bat' that copies this dll into the PC's windows/system32 folder, then runs the exe.      
  PC133 only had dx8.1, so it complained about a missing d3d9.dll I think.  I couldn't download DX9.0c because Windows validation failed (invalid product key).      
  Installed DX9.0c on PC142, but then it restarted itself and I don't know its password.  TODO: try it again on this machine.      
  Made a batch file to assemble a build of the game, and a 'builds' folder to keep them in (recent ones at least).      
  Made a release log (txt) which gets copied into the build.  This will list the new features and fixes of each build.      
  Nervously released build #1 to my small distribution list (in the 'contacts' category).      
  TODO: I'm now going to get started on the patchwork system - YAY! :D  This is going to be a big, big, task though.      
  TODO: Try swinging the viewpoint around according to the 'distanceToScreen' option?      
9-Sep-2005   5    
  Had a good old think about that patchwork idea I always imagined, for the ground texturing.
I'm going to go ahead with it, because it looks like it'll be absolutely brilliant!
This system simultaneously solves all the problems of road markings, repair patches, designed surface variation, manhole covers, muck, puddles, chewing gum, fag-ends, tyre marks, etc., etc.  It'll be ultra-powerful and should actually save frame time.
Restrictions: Probably won't be suitable for drains; won't work on kerbs/walls.  Only for streets and pavements.  A dummy texture (the aerial) will be planar mapped in Max onto the streets and pavements.  While the game's running, the decal layers will be rendered offscreen and applied to the ground using a texture matrix to shift the rendered area into position.  I'm thinking there'll be one decal stack for the streets and another one for the pavements - this is more flexible and facilitates kerb position tweaks.
     
  NOTE:Before loading Max, you've got to disable all E-D's D3D support, otherwise the viewports get corrupted unusably.      
  Found that, when exporting the X file, it's better to switch off texture conversion and let it use the original textures.      
  Considered GetMapping's digital surface model again.  The thing that makes it useless is the 5m horizontal posting - all the streets would slope up to the roofs like a snowdrift.      
  Got the placeholder crosshair drawing, using an orthographic projection matrix.  The thing I'd forgotten was to make the VIEW matrix identity as well as setting up the projection matrix.      
  Looked at the 'Motion Blur' sample - it's gorgeous!
TODO: PIXEL MOTION BLUR!!!!!
     
  Fixed a Release/Master FOV bug (wasn't being updated each frame and currently it needs to).      
  Finally got the exe to run without the debugger, by launching it from a shortcut whose 'start in' directory is set to 'P:\Noctambule\source'.      
  TODO: Top priority is to get that portable master build working, then maybe have fun with motion blur or the patchwork system.      
  TODO: Placeholder gunshot sample (get the audio system started).      
  Note to self: Noctambule.org is not work-safe! :/      
8-Sep-2005   5.3    
  Tried all the deformation modifiers that looked like they might help with my ground-detail vs ground-slope question.
SurfDeform WS came closest, but it would've given me the same problems that the meshsmooth did - not enough control basically.
Luckily it looks like soft selection will do what I need anyway.
   
  Found the E-D fly-cam bug: the fly-cam was setting up view & projection in PreRender, then the debug mode was drawing text in Render, disrupting the subsequent play mode Render.
I've changed the mode stack to render from the bottom up, which is always the way I thought it should work anyway.
TODO: start rendering from the lowest opaquely-rendering mode, if any.
   
  Added a 'Master' configuration, which defines the '_MASTER' symbol.  Master config will be used for all the proper builds that I distribute.
   
  The 'Release' configuration now defines the '_RELEASE' symbol.  Release config is optimised like a master, but still has timers and debug output.  It's essentially for assessing the performance that the master builds will have.    
  The debug symbol to use is '_DEBUG'.    
  Added CModeHUD, for crosshairs, gauges, etc.  Tried to get a placeholder crosshair drawing; couldn't get the object matrix right, but I'll try again.
TODO: GET THIS WORKING, AND RESTORE PREVIOUS OBJECT MATRIX FOR THE DEBUG RENDER!!!!
   
  TODO: Get a presentable master build together asap, to prove that the project exists!    
1-Sep-2005   3    
  Borrowed some LCD-shutter 3D glasses and tried them out on the game - looks great.
Currently lots of ghosting though because of the gaudiness of the placeholder buildings.
This glasses system doesn't let me do any of the stereo myself - it does it all its own way :/
Scroll-Lock toggles glasses commands; F5 = on, F4 = off.
   
  Improved the options system.  FOV is now calculated from physical measurements in the options class so that it matches with the player's real-world FOV.    
  TODO: Fix these shutter-glasses bugs:
When using the glasses: Landscape disappears in fly-cam mode;
Sometimes get an angle glitch when turning the view while running.
   
  Checked that the 16:9 seems to work.  I'd love to try it out on a big widescreen TV some time though!    
31-Aug-2005   2.5    
  Got my first genuine in-game fright while standing outside Bedford Court eating my dinner and admiring the car park wall.  Glanced right, straight into the blank face of a placeholder zombie - completely forgot what it was and why it was coming towards me!    
  Tried to map an N: drive to the Noctambule folder - didn't work.  The folder didn't show up as an available mapping location for some reason (???)    
  Found an interesting DX help topic: "Introduction to the 10-Foot Experience for Windows Game Developers".  Have a look at this later and see what can be added for the 'Media Center' (sic) setups.  There's a download for the relevant extension SDK.    
  Added Options.cpp&h, which include likes of stereoscopy and widescreen settings.    
  Got the basic anaglyph stereoscopy working, using the D3DRS_COLORWRITEENABLE renderstate.  Didn't hit the displayed fullscreen framerate, so I'm guessing that's clamped (PHEW!).  Anim system will need to be made stereo-friendly.    
  Bedford area mesh tweaks.    
28-Aug-2005   8    
  Decided to ditch the mesh-smooth modifier on the ground.  It was too vague; didn't give me enough control, etc.
Mesh-smooth is removed after version 130 of Leam.max.
   
  TODO: Remember to set up local space (pivot) for each building.  This makes it much easier to flatten walls, etc.    
  Knocked-up a placeholder Bedford brick texture and splatted it onto some objects just for fun really.  Looks kinda cool.    
  TODO: When photographing textures, it'll be a good idea to use some kind of scale marker    
  TODO: Realised it'd be far more sensible to export collision geometry using MaxScript rather than fishing it out of vertex buffers.
For a start, the collision will eventually be a separate (invisible) mesh; secondly the plug-in could exclude polys inside collision boxes, etc.
   
  UVW mapping modifier has been really weird - seems to come out differently scaled on different objects (?)
Also seems to get twisted up somehow after the verts have been edited.
   
  NOTE: Hidden objects don't export.    
  Started building details into Bedford Court, as sub-objects.  Should probably shoot some detail reference and textures for this area soon.    
  Updated the 'world' file for the new town.    
  TODO: Find out how to display hidden verts!    
27-Aug-2005   7.5    
  Noticed that the edges of the ground had shifted out of position a bit - dunno how, but it didn't cause a problem because of the planar mapping modifier.    
  Got ground collision working nicely, for the player and the zombies! :D
Currently colliding with every poly in the world, but I'll fix that later.
   
26-Aug-2005   2.5    
  NOTE: Must avoid exclamation marks in node names (x parsing doesn't like it)    
  Got the game running under the new SDK.  Had to remout my DgbAssert calls, and use a different assert function, and remove an old library reference from the solution settings (strmbasd.lib).    
  Got the new Leam model into the game - this was very good for morale, and makes it much easier to judge ground shape, etc.
Worked first time.  Used the latest Panda .X exporter.
   
  TODO: Ground collision, even if only placeholder.  I want to be able to walk around the new town as soon as possible, and I want the zombies to do the same.
(frame 'ground', child currently "Object #16')
See ID3DXMesh::LockVertexBuffer / LockIndexBuffer.
   
  Added a 'breaches' log to the Schedule, which should help reduce absences from the project, or at least get a clearer idea how they arise.    
7-Jul-2005   6.5    
  TODO: keep the graphical time-stamp on photopoint photos - it's handy.    
  Shift-click a photo thumbnail to view the bitmap.    
  Built a bunch more bits into the Bedford Court area.  Found that it's a good idea to stick lampposts etc. in to help with the photopoints.    
  Jogo showed me some stuff like the target weld and using animated cameras to look around, in the absence of a proper fly cam.
He says that Andy Slater wrote a Max fly-cam but it was slow, etc. - I might ask about that.
   
  Got a bit handier with cuts, slices and booleans.    
7-Jul-2005   3    
  Had a look at the samples on the very latest DirectX, with my new graphics card.  The post-process sample is especially cool - this should show me how to do the colour-draining I need for the stereoscopy.    
  Had a look at panoramic tripod heads at www.kaidan.com - too expensive.    
  TODO: Super-fast 'toggle buildings & ground' hotkey.    
  Did more Bedford Court area.  The plan is to build it into an early prototype area - I want to see it in the game as soon as possible.    
  Had some problem auto-fovving pp19 - I seem to remember zooming out & back in again during shooting that one (which can alter the fov).  Maybe that's all it is?
TODO: re-shoot, delete photopoint and strart it totally fresh - see if there's still a problem.
   
  I've got to start adopting a more happy-go-lucky approach to the blocking-out process, since things still aren't matching properly.  To be honest, they don't really need to, it's just me being pedantic as usual.
Anyway, I blame the aerial!  It'll be interesting to see what the re-shot aerial looks like; it's due this year.  Who knows, might be higher res and better to use.
   
5-Jul-2005   2.75    
  Continued in the Bedford Court area - going pretty well.    
  Downloaded the latest DirectX.    
3-Jul-2005   2.5    
  Camera tilt now takes the photopoint's full orientation into account.    
  Tweaked the ground and buildings a bit round Bedford Court.    
28-Jun-2005   4    
  Found what seems to be another aerial splicing problem at the bedford/regent junction.  Really can't seem to get that Jessop's shop corner into place and agreeing with the aerial.
I'm now taking the aerial with a big pinch of salt.  It seems that the best way for me to work is to use photopoints to check the positions of other photopoints, forming trustworthy clusters like the one at Bedford Court.
   
  Cross-referenced the various photopoints at Bedford Court, to improve the buildings and add more detail (eg car park wall).  This area is really starting to fall into place, so I'm tempted to focus in on it a bit.  It's very good for morale to actually get stuff built and add a bit more detail to an area.  Adding more of the buidlings round there will help me to judge the ground shape too, which in turn will help me to position more photopoints.    
  Used the new auto-fov-calculator thing again - works an absolute treat!    
  TODO!!!!!!!!!!!!!!!!!!!: Camera tilt needs to take photopoint's full orientation into account!!!!!!!!!!!!!!!!!!    
26-Jun-2005   8.5    
  Re-shot all my photopoints as continuous horizontal tripod pans, between about 5.15 and 7am.    
  Used new pp17 and pp15 to tweak the fov again to 49.306962703711542917626673274527 - sorry!    
  Came to the conclusion that there is genuine (real-world) variation in FOV from one photopoint to the next (due to slight inaccuracy in the NIkon's zoom mechanism).
So I abandoned the common FOV.  When welding a photopoint, you can now state its total angle span at current FOV- the code then calculates the photopoint's own fov, and re-angles all the cameras accordingly so that the gap/overlap is sealed.
This took fucking ages to get working - had to try every possible way of rotating those cameras :(
This was tested/first used on pp12.
Photopoint must have ZERO ORIENTATION for this to work.
   
  TODO!!!!!!!!!!!!!!!!!!!: Camera tilt needs to take photopoint's full orientation into account!!!!!!!!!!!!!!!!!!    
25-Jun-2005   7.5    
  Measured the height of the camera on the tripod, legs fully extended, pole fully extended, as 154cm.  This is the way I'll be shooting my photopoints from now on.    
  Used my most precise pan so far ("ppCalibration") to re-measure my photopoint FOV as 49.494671571448866999761693707093.
I will NOT be re-measuring the FOV at any point in the future - it was only two hundredths of a degree out!!
   
  I'll be using 8-shot tripod panoramas from now on.  I've added a mark to the tripod so I can get zero pitch, and the tripod already has the 8 yaw marks that I need.    
  Added a global camera roll setting to photopoints (one per point).  Works well.  Tried making it a static member of the plugin but for some reason it didn't want to carry through from each session to the next.  It might be better as a global thing for all photopoints...possibly.    
  Made some photopoint fixes.    
  I'm going to hold off on the common pitch angle parameter for now - I'll see how it goes just doing horizontal pans.    
18-May-2005   5.5    
  Worked out that only one photopoint can allow free lookaround at a time using the photo planes.  One other will be available for static display of a single camera using the viewport background method.  It will use the far-clip setting to cull the other photopoint's background planes.    
  Re-worked the photopoint code so they display a 'pan camera' for looking round the panorama (now up to 10 planes), as well as displaying the current photocam.  This is really groovy.  Mapped FOV to the D key for easy zooming.    
  TODO: Display previous photopoint's current camera using the viewport background method.  When a photopoint is deselected, maybe the closest photocam to the pancam should be made current.    
  TODO: keep photocams arranged by angle.    
  TODO: I'm going to re-shoot all my photopoints as continuous panoramas, concentrating on the bedford court area.  It's such a superior method that it seems silly not to.
I'll use the tripod for these.  It's a shame my tripod rotates its pitch angle by its yaw angle rather than the other way round.  I'll have a look for one that works the other way.
Actually no, come to think of it all I need is a common pitch angle property (relative to the photopoint).  By tweaking this I should see all the photos twisting to meet each other.  Also, a common pitch angle property would be a good way of counteracting any tripod-top tilt, rather than doing this on the bitmaps.
   
  Added a 'show buildings' checkbox to the photopoint rollout, but it doesn't seem very responsive (hiding/showing the buildings layer).    
  TODO: Add the common rotation properties above, and test them in the warmth of the office.    
17-May-2005   5.5    
  PhotoPoints now get forced into the correct group whenever you select a photo.  They were unhappy when I tried to do this on creation or rollout open.    
  TODO: photocams should keep a record of their native orientation.  You should be able to zoom and pan them, and they should stay like that till you tell them to 'return' (button).  Need a 'Set native orientation' check-button that defaults true.  The state of this should be saved with the camera.      
  TODO: Global hide/show ground/buildings check-buttons on the photopoint rollout.  Keyboard shortcuts for this would be great.      
  Quite tempted by the idea of buying some web space and a domain name.
It would be cool to put latest builds on there as well as having this devlog online.
programmerart.co.uk and programmer-art.co.uk are both free, as is noctambule.co.uk.
I could even use it as a data backup area if there was enough space, hmmm...
   
  Found that overlapping photocam photos are useful because you can create a continuous panorama.    
  Used a photopoint panorama of the office to measure a horizontal FOV error of -0.0146484375.  Doesn't sound like much, but it causes quite a big gap.  Used Max's panorama exporter to measure the gap in pixels (45 / 3072).
Accordingly, I've now adjusted the photopoint FOV to 49.516357264618434093161546085233.
I've also adjusted the photopoint background planes accordingly:
length: 489.15462886217099641210934067868
width: 652.20617181622799521614578757157
distance still sqrt(500m)
Leam.max version 83 is the last version with the old FOV.
   
  I'm going to use the tripod for all photopoint photography from now on.  That guarantees that there's no difference in local Max-Y angle, and if desired, no difference in local X angle between the photos.  It also makes the photo height more reliable.    
  I'm going to use panoramic photopoints wherever possible - this allows me to ascertain the relative directions of the cameras first so I can then just rotate them all as a group, and also rotate the photopoint (to recreate ground shape) if necessary.    
  Added show ground / show other photos options for photopoints - helps when lining things up.    
  TODO: BUG: Photocams currently don't transfer their roll angle to the background plane at the point when they're viewed.    
  Got a good feeling about the new field of view - things seem to be fitting better.  Maybe it's my imagination.    
  TODO: Marks on the tripod to indicate the rotation steps to use.    
  TODO: have as many background planes as there are photocams, so you can pan round the whole panorama.    
16-May-2005   5    
  Started getting scary messages from Max saying that the 'm_photoFilename' property of the photocams didn't exist.  Turned out to be just a script bug - phew!    
  NOTE: If Max's MacroRecorder is enabled, with the 'Explicit sub-object sets' option ticked, moving an edge will cause a crash.
This heppens even if the listener is closed.
   
  Got the photopoints working with textured planes rather than viewport backgrounds.    
  Now forcing photocams into the photocams layer.  I get an error when I try to force photopoints into the photopoints layer though - will fix that next time.    
  Layers rock!  I can turn the entire building layer into wireframe/see-through and still see the textured ground layer / background photo plane!
They also let me hide away all those photocams which tidies & speeds things up a lot.
   
  TODO: Ability to view several photopoints at once - ideal for cross-referencing 'live' while tweaking buildings & slopes.    
  Made a tiny fix to the cropping in the 'cropDebarrelled' photoshop action.    
15-May-2005   6.25    
  Put the mesh-smooth modifier on the ground mesh, and this (touch wood) seems to fix the HOP test problem.    
  NOTE: It's great when you can see one photopoint from another - try to arrange this more often.    
  Deleted some older photopoints with unreliable footpoints.    
  Got a black screen crash in Max - most likely video drivers again.  Got to remember to save save save.    
  NOTE: Max: CTRL-S doesn't work while panning a camera view!    
  Added the rest of the photopoints I shot yesterday morning.  There's currently 30 of them, taking up about 40 meg - won't break the bank at all! :)    
  Should probably use the 6am->7am period for shooting detailed stuff; some of my current photopoints clearly didn't have enough light and are blurred.  Will also use the tripod & timer for texture photography.    
  Couldn't see a way of setting different backgrounds for different viewports via maxscript.  Might well switch to the textured-plane idea.    
14-May-2005   10    
  Took a load of pre-planned photopoint photos, between 5 and 6 am when the streets are empty.  Could possibly have done them an hour or so later when it's brighter - maybe try that next time.  I'm guessing people start earlier on week days than at the weekend though.    
  NOTE: Can't do conditions in plugin rollout definitions    
  Made a whole bunch of improvements to the PhotoPoint code, including handling for missing files.    
  Now grouping photopoint photos by index; index can be set on the rollout.    
  NOTE: MaxScript editor's undo only holds one item - so if you make two mistakes in a row you can't get back to where you were! :(    
  Upped the de-barrel setting to 27 and updated the photoshop action accordingly.  This is a 50% halfway-house between calibration.png and DSCN1745.JPG - works well for both of them.  I reckon I'm probably getting pedantic about this de-barrelling lark...
I'm not going to worry about the out-of-date debarrelling on the existing photopoints at all [yet].
   
  Set up a load of new photopoints.  Had to re-jig the existing ones because of changes to the camera class.    
  Still getting that misread-ground-height problem.  Looks like it's just caused by testing giant polys, so I'll start dividing the ground up a bit more.    
13-May-2005   7.75    
  NOTE: Perpendicular photopoint cross-references are the best kind.    
  TODO: Might want to phase-out any photopoints that don't have clearly-visible-on-the-aerial foot points.
Certainly need to pick my footpoints on the aerial first, rather than taking the photos then trying to find the footpoint (which might be obscured by a car or a shadow etc.)
   
  Impoved building placement; added new buildings, added more slope detail.  The photopoints are really starting to make sense - it's all going well :)    
  Found that Max can fail testing the ground height after the ground mesh has been edited.  Added warning dialogues for this.
Restarting Max fixed the problem.
   
  Found that Max can also mis-read the ground height.  Don't know how to fix this yet.    
  Ctrl-clicking a photo thumbnail now also selects the camera object.    
  Found that User View is a much nicer way of getting around than Perspective View, mostly because the zoom is predictable.    
  Pre-plotted a load of photopoints in Max, then grabbed screen images of them into the camera so I can remember where to stand.
This is definitely the way to do it.
As soon as the sun rises, I'll go and take the snaps - should be nice and empty at the crack of dawn.
   
12-May-2005   4.5    
  Got hold of 'ImageAlign PRO' and set up a de-barrelling profile (de-barrel set to 25.50, re-scale set to -1.00).
Complemented this with a PhotoShop action 'cropDebarrelled' which fixes the aspect ratio back to what it should be.
   
  NOTE: ImageAlign previews are to be taken with a pinch of salt.    
  Set up all the photopoints I had photos for, and I'm barrel-correcting all the photos now.    
  TODO: Nice calibration grid photo to make totally sure the barrel correction is ok?    
  Noticed on my way home that quite a few building edges (in real life) aren't vertical or aren't straight.  'Venue' for example is bent just the way it looks on my photopoint (post-correction), which is nice.    
  NOTE: The aerial photo is not gospel!  It's especially dodgy at the points where they've joined two photos, eg at the Yorkshire bank.
I expect I'll do some surgery on it later…
   
11-May-2005   5.5    
  Got the photopoints aligning with the ground - far too easy!    
  TODO: Later on, I'm going to want to view angles from several photopoints at once.  Perhaps ideally it'd auto-show all the cameras that can see the selection being edited.    
  Placed more PhotoPoints (around Windsor, John, Bedford) while tweaking buildings.    
  Made a bunch of improvements to the PhotoPoint plugin.    
  TODO: Lock photopoints' orientations - a number of times I got myself in a twist by rotating the photopoint when I meant to rotate the photocam.    
  On the subject of photopoints:
- Watch out for dips in walls (ie. non-flat walls) - they can throw the matching off.  Eg. west wall of Blitz.
- Don't spend ages matching a single photopoint perfectly - cross-reference with another photopoint and get a happy medium.
   
  NEXT: Put a few more photopoints in, then continue adding slopes.
Try out the barrel-correction plugin for photoshop - might help deal with the fisheye problem.
   
10-May-2005   3.5    
  Got the new PhotoPoints up & running - sooo goood!
Started replacing the old photopoints with nice new multi-angle ones.  They're matching very nicely (especially the ground detail) thanks to the new FOV.
   
  Looked at the Megon smash-up-a-museum physics demo.  Nice shattering physics glass.    
  Had a couple of Max crashes, including a blue screen when trying to resize a photopoint viewport.  This looked like a graphics card driver bug, and I do seem to remember people saying Radeon drivers can be iffy.    
  NEXT: Need to get photopoints auto-aligning to the ground mesh (probably on selection of the photopoint).
See 'How To ... Move Objects to a Surface' in the MaxScript reference.
   
28-Apr-2005   4    
  Found that when you copy photos around, their creation date changes :(
Maybe I'll be wanting some code to name them according to their creation date, straight after they've been saved.
As a temporary measure, I've switched to using the modified date, because they initially match the date taken.
   
  Made progress on the PhotoPoint helper.  Got it creating the child cameras.  It can't store these as node/nodeTab parameters though, because that would create illegal cyclic dependencies.    
  Had to change a bunch of paths etc. to get stuff working on this temp PC - worth doing though because it's such a lovely snappy machine.    
  Steve T gave me a quick demonstration of Zbrush.  Looks like it's going to be an essential piece of kit for when I start texturing and creating materials.    
27-Apr-2005   2    
  Set up the project on my borrowed ninja PC, which has a "Radeon X850 XT Platinum Edition".    
  Had a play with Flame's SM2 materials - very very nice.  I can't wait to get my hands on that stuff.    
  Codenamed the project "Noctambule"; renamed some stuff accordingly from 'Zombies', to prevent unwanted interest.
Also changed everything to live on a 'P:' drive (the ninja's D: drive wasn't available).
   
  Current priority is to get this new photopoint helper working - then I can really get going with the construction.    
25-Apr-2005   1    
  Fiddled with the new photopoint helper, then decided to go out and get pissed and see some bands - sorry!    
23-Apr-2005   2.5    
  Measured the camera's field of view, using blu-tac, embroidery thread and my new tripod (48.79102º x 37.57088º).
This is equivalent to a 39.689mm lens.  Updated the current PhotoPoint class to force this FOV.
Some PhotoPoints are definitely matching better as a result (the House of Fraser / Blitz one is pretty exemplary), but Windsor St. and Murphy's are still weird and I don't know why.  I might well end up having to distort the aerial on XZ, but I'll probably consider it a last resort.
   
  Measured the height of the camera on the tripod (legs fully retracted, pole at full height) as 92cm).    
  Noted that the tripod currently tilts the camera clockwise on Z by about 1.5º.    
  Noticed a fair bit of fish-eye on my calibration photo - slightly worried about that...    
14-Apr-2005   2    
  Started the new PhotoPoint plugin (extends the Point helper to look after a group of photo cameras).    
  TODO: clicking on a camera photo thumbnail should toggle that camera.  Oldest camera should be replaced when you run out of viewports.  Use a right-click menu for photo options (view, browse, clear, etc).    
11-Apr-2005   4    
  Really getting the impression that my FOV is wrong.  Going to measure this empirically ASAP - totally pointless trying to match any more photopoints till I have.    
  Started getting the PhotoPoint plugin working (complete with photo & footpoint-photo thumbnail/pickers :)
Needs quite a bit of work still, but it's going to be ace.  This plugin lark is much simpler than I imagined it!
   
10-Apr-2005   11    
  NOTE: See LODTester.ms for examples of gui stuff.    
  Selecting PhotoPoints now does the following:
- Changes the bottom-left viewport's view to be that of the selected PhotoPoint.
- Changes the bottom-left viewport's background image to be the PhotoPoint's photo (specified in the 'photo' user property).
- Applies the photo file's creation date&time to the sunlight system (this was really quite complicated!).
Used a startup script for this.  Lovely swish result.
   
  Stuck a few more photopoints in - got a bunch more ready to place.    
  Started trying to write the photopoints as scripted plugins - this definitely seems like the way to do things.  Should try to get this working next time.    
  Slightly less pessimistic about the photopoints now.  It's all about cross-referencing - that's the only way it'll make sense.
Matching up the ground seems to be a fairly good way to start.
Just need to add lots of photopoints - got to get the ground shape worked out, then things should start to fall into place :)
   
  Learned tons about MaxScript tonight - it's very groovy.    
9-Apr-2005   13    
  NOTE: Camera batteries don't hold their charge for long periods of time (eg. a fortnight).  They need to be charged right before they're used.    
  Decided on the world alignment that I'll be stuck with throughout the entire project: Z -6.15°.  It was a bit scary making this decision, but I reckon it's aligned well so I'm going to forget about it now, take it as gospel, and get cracking with the construction work.    
  Leamington Central Point is right outside GameStation, 83 The Parade, CV32 4AY    
  Spent ages trying to match a photopoint of Windsor St.  Only had a single photo because the cold killed my camera batteries.    
  Learned a few lessons from it all:
- Before shooting, check that the from point is clear on the aerial (ie. carry a printout).  Arrow tip/tails, give-way tips and centre line tips on the road seem to work best.  Kerbs are not clear enough on the aerial.
- Precede the shot(s) with a photo aimed exactly at the from point.
- Shoot the street from various positions and angles so you can cross-reference.
- Try to get as many reference points / vertical lines as possible into the shot.
   
       
8-Apr-2005   4    
  Made the world exporter loads nicer and safer.
- now gives you a save dialogue.
- will never lock files when it hits an error.
- exports SpawnPoints.
- supports scaled rectangles (CollisionBoxes), which are much nicer to edit.
- Added a .zwf format for it (just text still)
   
  Learned some Max stuff.
- selection filter
- selection locking (space)
- handy manipulation shortcuts (q,w,e,r)
- Macro recorder
   
  Added SpawnPoints.  Currently zombies respawn at a randomly-picked SpawnPoint, but that will obviously improve.    
  It's beginning to play now that the zombies emerge from the alleyways.    
  TODO: Auto-expand collision boxes - they'll be placed down tightly around buildings.    
  Fixed some shutdown leaks.    
7-Apr-2005   3    
  Player collision with AA collision boxes is working.    
  Added very rough zombie once-per-frame routefinding, but it's too rough - you can get them stuck just by hiding on the opposite side of a building.  Need to write decent routefinding before it'll play.    
  Looked at Max's sunlight/daylight simulator - should in theory allow me to match sun positions and shadows with those on the PhotoPoints.  Just need to remember to keep the camera's time&date set properly.  Might be able to write a MaxScript to set the sunlight's time&date whenever you select/preview a PhotoPoint?    
  Oh yeah, pretty much worked out how I'm going to gather ground height data.  Works like this:
- Build boxes with XZ's matching the aerial.  Height doesn't matter - exaggerate the height.
- Taking care not to Z-tilt the camera, shoot one height sample point of known XZ from standing at another.
- Rotate the PhotoPoint round Y to face the target point - the target point should appear directly above or below its position on the photo.  Rotate the PhotoPoint round X till the vertical lines on the photo match the vertical lines of the box wall edges.
- Alter the height at the target point till it matches its Y position on the photo.
- Having altered the ground height, ensure all photopoints are the correct height above the ground (use a MaxScript for this!!!)
- To verify the data, repeat the process shooting the first photopoint from the now-y-adjusted first target point.
A typical height-sample range would be between two junctions (points at building edges or maybe pavement edges).
     
6-Apr-2005   4.5    
  Checked GetMapping for terrain/height data.  But it doesn't look like they've got anything accurate enough to be of much use to me. And its £50+vat!    
  Got the parsing system up to a usable level.    
  Start-point and collision boxes are parsing in perfectly :D    
  Added debug draw for the collision system - currently just draws its collision boxes.  Looks to be a frame behind somehow.    
  TODO: Swap vectors' Y & Z axes when exporting using MaxScript.    
  Steve T was telling me about character lighting, and the 3-point lighting they're using/trying to use on Possession.
Showed me some really effective stuff in 'Def Jam' on PS2 which looks like it's using ramps to force rim light effects.  Might be worth bearing in mind when I come to do the zombie lighting.
   
  Might have made a couple of little blind changes to ZombieWorldExport.ms.    
5-Apr-2005   5.75    
  Couldn't see a way of creating custom modifiers (for entity classes) using MaxScript, so I'll forget that idea for now.    
  Learned a big bunch of MaxScript.  The export script is working beautifully now, writing out class properties in a nice convenient block format.
It also writes out a class count at the beginning so that the game can malloc stuff up.
Class properties are specified in the objects' user-defined properties.
   
  Got the whole parsing system in place - almost ready to roll.    
  Put some PD string CRC code in, which is used by the file parsing.  It's virtually the same code that B uses, which is reassuring.    
  Nice meaty coding session - very pleased with how it's going.    
4-Apr-2005   4.5    
  Learned about MaxScript; got the script to export the level data working (custom properties and all) :)    
  Started setting up the world-parsing, collision and route-finding stuff.  Collision boxes are XZ rectangles from the world file (currently a .dat).    
  Fairly productive evening.    
1-Apr-2005   4.5    
  MUST keep this log checked out - I just lost a whole entry due to sourcesafe shenanigans.    
  Tried out the DirectX Summer 2004 samples.
The PRT demo is eeriliy lifelike.  MUST use that subsurface scattering for the zombie flesh because it looks amazing - really fleshy.
   
  Bought an aerial photo of central Leamington for just under £25.  Mapped it to a Xara file with a 1 metre grid and rotated it to be grid-aligned - perfect perfect scale reference!
It covers both my walks home from work, so the area is spot-on.
   
  Downloaded Neat Image (image cleaning) demo - only saves jpegs.  No real use on the aerial, but should be great for texture photography later on.    
  Decided from looking at the aerial that routefinding and collision want to be based on axis-aligned XZ rectangles.
   
  I'm wondering: should I actually just base the town directly on the centre of Leamington??  To save me umming and ahing about level layout etc?  A couple of other games have done this and it's been really cool - going round places you've been in real life.    
  Yes, fuckit, that's exactly what I'm going to do.  It should save me a lot of time trying to decide whether stuff's realistic or not - I'll base it all on photographs, observations and measurements.  Also, it'll be a lovely souvenir of the town I'm trying to escape from (in real life!)
Bedford Court & John Street will be the starting point for the level creation.
   
  Made a few decisions about ground undulation, etc.
- I do want hills, and the zombies will need to follow the hills.  A 2D array of height, generated by MaxScript.
- I do want
bowed streets, etc.
-
Pavement collision: Axis-aligned XZ rectangles should cover 90% of cases.  Later, I might support non-aligned rectangles too, because I would like non-aligned streets if requried.  Pavements will be a standard height offset from the hills.  Background zombies can skip pavement collision (very background zombies can probably skip wall collision too).
-
Shadows: Volumetric shadows are going to be the easiest to do.  Not ideal (I'd prefer some fuzziness), but I'm guessing they'll look fine, what with all the rain and stuff going on.  They might even be able to shade the rain, which'll be nice.  I'm open to using old-skool blob shadows for background zombies.
Collision: Like I said, this will all be axis-aligned XZ rectangles (might need to support rotated ones later, see how it goes).
Need lines for fences / walls too.
   
  First thing I'll do now is get the wall collision boxes working in the current level, then I'll do spawn points.  After that, I'll probably start a rough version of the proper town.    
15-Jan-2005   5    
  Got the new anim-user system working, yay!  Checked the MultiAnimation project as a reference for using D3DX animation controllers.
Tested it with a horde of a thousand zombies; they initialised in a flash, took up bugger all memory and shut-down with no problems at all!  I randomised their anim speeds to make sure they were independent.  So relieved that worked ok.
   
  visibility functions, zombie culling    
  some maths functions and stuff    
  Shifted cameras' projection precalcs (projection matrix, FOV tans, etc) out into a CalculateProjection method.  Added suitable dirty flags.    
  Camera FOVs are now stored halved (far more convenient).    
14-Jan-2005   2    
  Seperated the necessary parts of CAnimMesh out into CAnimUser (an instance of an animated mesh), and got the code compiling again.  Tomorrow I'll approach it fresh and (fingers crossed) get it running in this new form, which will be infinitely better.    
  Help seems to be working fine again, thank goodness.  Don't know what was up with it before.    
13-Jan-2005   2    
  Oops, got sidetracked again by work, the band, and sheer laziness.  Must resist the temptation of those comfy nights in (except Wednesdays) and nights out.  When I need the evenings for band stuff it's fair enough, but the rest of the time I should be following the schedule - to the letter!
TODO: consider moving Wednesdays to a night when there's music on - Monday maybe?  Could be nice.
   
  Fixed the exit assert by removing a RestoreDeviceObjects call from CZombieManager::Init (not sure why it was there).    
  I'm now going to concentrate on getting the required number of zombies into the game - this will show that I know what I'm doing.  Currently they each take a fair time to initialise and take up loads more memory than they need.
Realised that cloning meshes was a stupid idea - need more of an Actor/ActorInstance system where multiple zombies use the same mesh data but with different animation states.
   
  Reconstructed the Release configuration in order to get "debugging info" so I can break and step through the code.  Not sure what was wrong there.  Erm, maybe a rebuild-all would have fixed it actually, oops.    
18-Nov-2004   3.5    
  Tried to cut down on the zombie setup time by cloning the first zombie into all the others.  So complicated though - couldn't get it working.  I might have a hope in hell if I could access MSDN and find out about the IUnknown interface.    
24-Oct-2004   5    
  Fixed Tubby's vertex weights (shifting the skin modifier had meant that weights got reassigned to different verts kinda randomly).    
  Gave Tubby a rough zombie walk cycle.    
  Added some debug and maths functions.    
  Got the zombies to chase the player.    
  Added placeholder headshot detection which results in the zombie being respawned to its start pos.    
  Changed the storage of the zombies to be a fixed-size array; all the mallocing gets done at the start of the level now.    
  TODO: Create the first zombie mesh then memcpy it for all the other zombies.  The setup time is currently very long setting them all up individually.    
  TODO: Fix exit assert.    
  Realised that tubby was built facing the wrong way :(  Will correct that in Zombie mkII.    
23-Oct-2004   4    
  Where possible, removed files from my VSS folder that contained 'FOP3'.  The work VSS database got broken recently and I was worried that I might have caused it by cannibalising that database for Zombies.  Wasn't able to remove the file called 'aaaaaaaa'.  Didn't see anything too suspicious in it though.    
  Learned a bit more about skinning and animating.    
  Had a go at editing Tubby's vertex weights.  Got his eyes to move with his head by linking them to his neck bone.    
16-Oct-2004   8    
  Finished Tubby's head and attached it to his body.  He still looks kinda short in the game, but for now I'm putting that down to his cartoon proportions (that'll be why his eyes are below the player's eye point).    
  Used a MultiRes modifier to reduce his res while keeping crumple zones for animation.  Currently about 1250 verts.    
  Made bones for Tubby, set-up the IK chains and added a skin modifier.    
  The old 'skin-not-moving-with-bones' thing seems to make more sense now.  Seems you need to have the skin modifier selected in the modifier stack in order to see the skin deform with the animation.    
  Right - to get the skinned animation to export properly, you have to collapse all the modifiers on the mesh, THEN add the 'skin' modifier.    
  And lo, the zombies did march.  I've now got my own skinned, animating characters in the game - made by me, from scratch! :D
Now where did I put that biscuit tin?
   
  I'm going to bail out of my all-nighter now - I don't think I'm up to it and I should sleep ok after tonight's results.    
15-Oct-2004   3.5    
  Finally got SourceSafe eating out of my hand - such a relief.  The SS project layout is neater now too - none of those stupid dummy folders.    
  Continued with Tubby.  Had to re-do the head but this gave me a chance to re-familiarise myself with Max (it's been a while).    
  I reckon once the head is finished and joined onto the body, I'll move onto skinning & animating him.  The purpose of Tubby was just to learn the basics of character modelling - I shouldn't actually need to finish the tutorial (clothes, hair, etc.).    
  Tried creating several zombies instead of one - worked fine!    
14-Oct-2004   3.5    
  The reason the zombie looked short was that the near clip plane was too far away; brought it closer now.    
  Added & improved debug draw functions.    
  Got a nice debug game-mode which draws the stats and handles the debug keys.  Lucky me.    
  Fixed the mode stack issues.    
  Improved the fly cam.    
  Need to work towards animating the placeholder zombie next.  It'll kick ass when they start wandering around.    
10-Oct-2004   4.5    
  Got the mode stack working.  Need to handle the old mode-removal problem cases but other than that it's working nicely.    
  Restructured the code into game modes, currently 'play', 'debug' and 'fly cam' - this makes things lovely & neat.  Will add the likes of 'pause' and 'front end' later.    
  Got the fly cam working.    
9-Oct-2004   4    
  Decided it was time to add a fly cam.  Started adding this, but then...    
  Decided it would be a good idea to set up a mode stack.  For example the fly cam will be controlled from a 'debug' mode that gets pushed on top of the normal game mode and stops the normal game mode receiving input.  The mode stack will become very useful when I start adding front-end, pause screens, etc.    
  Eventually succumbed to the temptation of the rock night at Robbin's Well - sorry!    
7-Oct-2004   4.5    
  Been away for a long, long time.  I've now started following a weekly schedule telling me what to work on each night (Monday & Tuesday is overtime, Wednesday is housework, Thursday and Friday is the demo).  So hopefully I shouldn't get so sidetracked in future, but it's still going to be slow progress.    
  Sorted out the scale.  Zombie still looks short somehow - something to do with the projection?    
  Added Debug.cpp&h and some debug draw functions.  These took a while because I had to find out about flexible vertex formats, which were alien to me.  Turns out they're very straightforward though.    
  Did a bit of tidying and re-familiarisation.    
8-Jul-2004   2.5    
  Discovered to my dismay that my "optimised" rotation matrix functions were actually a wee bit slower than making each axis' matrix seperately and multiplying them!  What a topsy-turvy world we live in.  So I'll update matrix.cpp/h accordingly.
Oh - and the supposedly-fast asm 'SinCos' function I got from the net actually appears to horrendously slow - not sure what's going on there!
   
  Figured out how to use QueryPerformanceCounter to measure time intervals in ticks.  I'm gonna be using that a whole lot.    
  Ressurrected some code to print some much-needed on-screen debug text.  Allowed me to check the above timer results in speed-optimised release build.    
17-Jun-2004   1.5    
  Continued fiddling with Tubby...    
13-Jun-2004   4    
  Continued the Tubby tutorial.  Exported the character as soon as he was humanoid, and loaded him into the game with no problems.    
  Got snagged on MS flight sim again.  Might need to un-install it or something...    
12-Jun-2004   3.5    
  23:16 - First "Max moment" of the project, while working through the Tubby McChubs character tutorial (which is going well btw).  When I tried to scroll the help page Max vanished, taking with it about an hour's worth of almost-finished hand!  Must get into the habit of saving more frequently.    
8-Jun-2004   3    
  Got the zombie-dragon respecting its position, y orientation and (prolly temp) scale.  This is good.  Man rest now.    
  Added a couple more steps to the design checklist.  Next one is learning how to build and animate characters in Max - yay!    
7-Jun-2004   3.5    
  IT FLIES!!!!!  The dragon is in the game, textured, moving and animating - WORKED FIRST TIME!!!  Wicked.    
  Checked-in all source immediately after getting 'SkinnedMesh' source working, at 23.09 odd.  (Errors on exit though)    
  Got rid of the shutdown errors.  I think I'm starting to understand the 'InvalidateDeviceObjects' / 'DeleteDeviceObjects' lark a bit better now, so I'll fix the method names and comments soon.    
6-Jun-2004   8    
  Tried eliminating the frame-range overlap in the dragon's anims - didn't help.    
  Tried reducing the dragon to just bones, mesh, and 'Scene_Root' dummy (ie. removing lights, points, IK chains, etc) - this didn't help.    
  Giving up on the dragon for just now, because I can't see where the problem is.  I've learned a few things from it but I think I'll learn more from building a minimal skinned test object, which I'm about to do now.  This way, I should be able to see exactly where the problem starts (provided I can get some animation working in the first place).    
  Couldn't get any animation on the minimal test object to appear (fine in deep-exp as always).    
  Dragon: tried putting the bone names *after* the keyframe blocks - no change.    
  Tried making sure 'scene_root' had an identity matrix and a keyframe at the start and end of the anim - no change.    
  Decided to jettison the 'MultiAnimation' code, having realised that the 'SkinnedMesh' sample loads and animates the dragon almost perfectly!  Although ultimately I'm likely to want animation blending, it's not worth losing all my time over at this early stage - I want to start actually making this game!  I'll be able to use 'MultiAnimation' as reference later on when I add animation blending.    
  So I'm about to cannibalise 'SkinnedMesh' instead...    
  Realised that ticking the 'use full pathname' box in the exporter eliminates the need to put the textures next to the source (duh).    
  Checked-in all source before starting the transition to 'SkinnedMesh', at about 22.44.    
5-Jun-2004   4    
  Remembered that the textures currently need to go next to the .exe's - dragon now textured, and ground texture showing in release builds.    
  Altered the dragon's hierarchy to get rid of the assertion failure mentioned above, but it's still not flapping...    
3-Jun-2004   1    
  Fiddled about trying to work out why my dragon won't animate, but to no avail.  I notice that I can't seem to change its position either.  The only output I get is D3DX: Assertion failure! (d:\builds\nt32_chk\multimedia\directx\dxg\d3dx9\anim\loadxh.cpp 1342): D3DXFrameNumNamedMatrices(pframeRoot) == plc->cNamedMatrices    
  Too tired and hungover; going home.    
2-Jun-2004   2    
  Managed to get the dragon mesh loading in.  Currently untextured and not animating (?), but looking healthy nonetheless - big relief.    
1-Jun-2004   1    
  Installed Max 6.0 and - HURRAH - managed to export working skinned animations!  This is a huge relief.    
31-May-2004   5    
  Read some more about Québecois & French immigration.  Took the Québec immigration evaluation a few times and got different results depending on how I interpreted the questions, so I'm not sure one way or the other whether I'd be accepted.  Much as I hate to admit it, it's my lack of a degree that's complicating things.
France, on the other hand: very cheap to get to, no immigration hassles whatsoever, just even more in the way of language complications.  Ah well, I should be able to make this thing work one way or another, so I'll just concentrate on making the game as impressive as possible (and on saving money) and worry about the rest later.
   
  Worked through some Max tutorials - learned a bunch of stuff about Max, modelling & animation.  Made more attempts at exporting a skinned animation - still no joy.  I'm thinking I should maybe try to get hold of Max 6, since the Panda website says something about a Max 5.1 bones bug (?)  TODO: skin-up my_tut_hand.max and try to work out exactly where the problems creep in.    
30-May-2004   4.5    
  Oops, got a bit sidetracked by other things these past two months...    
  Removed ALL borrowed code, because it was really bugging me having it there.  Learned how to multiply matrices, and used this knowledge to reconstruct MatrixRotationZY.  Added a PD MatrixRotationXYZ.  Implemented an easy (inefficient) version of MatrixRotationYZX - might write it properly later.  Reconstructed Vector3RotateY.    
  Managed to get some debug asserty stuff working, eg. DgbBreak.    
  Set up a release configuration - all seems fine, except my ground texture has disappeared (hopefully it's nothing too sinister though).    
  Installed Max 5.1 service pack 1.  Got some relatively promising results with the 'soccer' demo character.  I think what I should do soon is try building a placeholder character from scratch to see exactly where it starts to go wrong.    
9-Mar-2004   2.33    
  Improved the player run by adding sideways lean and height-wise bob.  Still rough, but it's already pretty convincing and fun, like some kind of an urban running simulator!  It's going to kick ass man!    
8-Mar-2004   2.67    
  Installed a cracked Max 5.1 and Character Studio 4.0 on my machine.  Some of the skinned sample files load ok into Max now, but they all still look just as screwed after export :(    
  Seperated the 'UtilMatrix...' functions off into their own file, Matrix.cpp/.h; renamed them to 'Matrix...'    
  Added Vector3.cpp & .h for VEC3 vector functions such as rotation.    
  Look-around, run and strafe are in and working now.  Tweaked the player height and zombie height - the scale feels pretty good now; just the pavements that are too narrow (will revise the town plan before next town mesh revision).    
  Hooked up the camera's view & projection matrices to the zombies' vertex shader, so the zombies appear where they should in the world again.    
  Not a bad little evening's work in terms of visible results - but KEEP IT UP!!    
17-Feb-2004   6.8    
  Got the lookaround code pretty much working - player is talking to its camera quite nicely now, but it still needs some work.    
  Added some more maths stuff.  "Borrowed" a couple of matrix functions from you-know-where.  I'm not happy about borrowing stuff, but if D3D doesn't have these functions I'm damned if I'm going to go wasting a load of time looking for them in maths books just for the sake of not cutting-&-pasting.  I mean, 3D maths functions are common knowledge - I'm not stealing anyone's creation; I wouldn't do that.  Just benefitting from their typing, that's all ;)  If I can find some public-domain replacements, I'll use them instead.  All borrowed code is marked "_borrowed".
->Nothing borrowed from there now
     
  I'm now using 16-byte-aligned matrices, vectors and quaternions throughout the game (added typedefs MATRIX44, VEC3, VEC2 and QUAT for these).  On Pentium 4's, the D3DX functions are optimised for 16-byte-aligned data.  Rar!      
16-Feb-2004   4.8    
  Got all the input setup working very easily.  The built-in controller setup screens are working perfectly!  ACE!    
  Started adding maths macros & functions.    
  Continued working on CPlayer and CCamera.    
15-Feb-2004   7.5    
  Sorted out the rendering problems I was having; got the placeholder zombie drawing properly against the landscape.    
  Took me a while to work out that the demo character ("Tiny") was about a nanometre tall - so I altered the character vertex shader to apply a scale factor.    
  Stole the CInputManager class from the 'Donuts' sample.  It's a very good example because it already uses the same controls that this will use!
Started changing the input code to suit the game.  I'm using the Direct Input FPS virtual actions, meaning that if someone tries to play using some crazy-ass mech controller, they shouldn't have too much hassle doing so!
   
  Added Utils.cpp & h - for miscellaneous handy stuff.