haabath.blogg.se

Mafia ii 3d model
Mafia ii 3d model







mafia ii 3d model

My memory is a little bit hazy on this, but that's how I think I remember it. It feels like maybe it needs an FOV multiplier, or division by W during the translations or fix, or something like that since shadows would separate more or less depending on their distance from the camera.

#Mafia ii 3d model code

it does cause the shadows to stereoize, just not correctly (and yes, I've even split the above line of code up to separate the v2.xyz * r0.xxxx and + g_CameraOrigin.xyz, so the g_CameraOrigin is added after the fix). Found a ViewProjMat in another shader, copied that into the shader, and using that (and using matrix.hlsl to inverse) does work for translating, but the stereo fix doesn't fix it. Even just translating the coordinate to clip and back to world using these (without doing anything else) will cause the shader to fail to render. The shader even has the following two matrices available: g_WorldViewProj and g_InvWorldViewProj which should make the translation to clip space and back ez pz, but no dice (these probably are using model space as the start/end point, not world space). Here is the line of HLSL code from the M2 shader (which occurs before a shadow map matrix multiply) that other shaderhackers will likely recognize the significance of: r1.xyz = v2.xyz * r0.xxx + g_CameraOrigin.xyz This means the coordinate is a world space coordinate, and should simply need a conversion to clip space, fix, convert back to world space. The correct fix SHOULD be extremely easy. M2:DE has shader headers, M3 does not (so would be adviseable to start on M2 and then hopefully adapt the fix to M3 with less information at the ready) Unsurprisingly, both games shaders had similarities (with M3 being much more complex, of course, but still following the same initial handling of it's coordinates), so I'm pretty confident that a) Mafia 1: DE is going to be the same deal, and b) the same general approach to fixing will be the same for all 3 titles. I lost interest after spending at least a couple hours on each title without correct result, and likely won't bother to make further attempts, but I'll document a few notes that may be useful to others that might want to attempt (or make any suggestions that I might not have thought of). I looked at both Mafia II: DE and Mafia III recently, couldn't manage to fix shadows in either and therefore didn't bother trying anything else because without correct shadows no point looking at anything else.









Mafia ii 3d model