Trying this now, it doesn't seem like velocity map is getting an accurate normal though.
To test it I pretty much just pass the number through
motion_blur_v.cg
OUT.N = IN.normal;
motion_blur_f.cg
outColor.rgb = IN.N;
fs_shader.cg
fout.col.rgb = tex2D(normalMap,vin.tc0).rgb;
What I get is (0,1,0) for objects in the scene, (0,0,0) for the sky.
When I do a similar test with the position, I do get the correct position map of the track, but the car's not present. Hrm.
I see indeed (got a Green & black picture here as well). Turned out the motion blur pass is disabling normal passing to the shaders. I've turned that off in the racer.exe at
http://www.mediafire.com/file/8vvfil563vd4xbi/rr090rc2.7z
That gives me the right normals. The indeed, just keep motion blur velocity in R and G, put the normal.x/y in B and A. Then in fs_shader.cg, regenerate normal.z using the sqrt option. This prevents an extra pass just for the normals. Not sure if the cars get there though, they seemed to be turned off for the motion pass, hm... But it should work on at least the track.
EDIT: hm, it seems motion blur velocity is stored in 4 channels, to get 16-bits per velocity axis (R+G=16 bits so 1/65536 accuracy). So all channels are already in use. Velocity might need only 8 bits though, but this may require tuning of the range that the 0..255 value represents. Alternatively, I could make the motion blur FBO an RGBA half-float variant (not 8-bits RGBA but RGBA_16F).
I also see that R & G are not really 16-bits of resolution, but rather R stores positive movement and G stores negative movement. That doesn't make sense, the bits can be used much more efficiently; now it's like 2x 8-bits so 512 levels, pfff.
(changelist for that racer.exe / v0.9.0 RC2:
- Added resolution parameter for motion blur shader (motion_blur_f.cg). Requires vsync=1 to work reasonably well.
- Reverted SMD camera up orientation, since it sticked to up even if the car was rolling.
- Added 'uniform float2 resolution' parameter for Cg shaders. Used in the motion blur shaders.
- Added theoretical sprung mass weight distribution under Ctrl-9, see also
http://www.racer.nl/index.php?jump=reference/carphys.htm#bodymass
)