Skybox notes
Hi bo3b. In a nutshell, it is whatever looks best :-) The standard formula almost never applies to skyboxes.
That formula applies a correction where one has not been applied by the driver, or 'un-applies' a correction that should not have happened. Skyboxes are at the "correct" depth its just that the developer made that depth stupidly small. The usual way to fix a skybox is to just multiply stereoParams.x by a constant value (between 0-1). Sometimes that just does not seem to work well, or sometimes you need to multiply by a much bigger number than one, and oftentimes the skybox may still exhibit dependence on convergence. The fix "r10.x += stereoParams.x * (stereoParams.y);" basically removes the driver level convergence correction, leaving only whatever the depth correction was - so if the depth of the box was "1", this is equivalent to the usual correction of just multiplying stereoParams.x by a number between 0-1 (and in this case actually "1"). This fix will now be independent of convergence. If you look in other shaders you will see things like (r10.x += stereoParams.x * (-r10.w + stereoParams.y + 1); and what this is doing is completely offsetting the driver correction, "(-r10.w + stereoParams.y)" (making it at 2d screen depth) and then applying the max depth correction with the "1"). Like I say it's all trial and error because it depends what arbitrary depth they set the skybox at. In AC3/4, they don't use the same depth for skybox, clouds, stars, sun or moon, hence the variation in ways to correct them, and hence the variation in lining them up.
Sorry that was a bit longwinded, but the upshot is you try one of 4 approaches, in this order, and see what works best:
1. r10.x += stereoParams.x * [0-1] or [0-inf...]; 2. r10.x += stereoParams.x * (stereoParams.y); 3. r10.x += stereoParams.x * (stereoParams.y) * [0-1]; 4. r10.x += stereoParams.x * (- r10.w + stereoParams.y + [0-1]);
- by 'works best' that means stays in the same place when separation and convergence are adjusted, or scales perfectly with the scene when they are adjusted. If the skybox goes in and out of depth as convergence is adjusted, that's generally not good unless the 'playing range' of convergence is such that not much movement happens.
Hope that helps.