I just tried Interior Mapping, using the code that Humus used in his latest demo.
The problem is, i cannot run his demo (no D3D10.1 card), so i don’t know how his results are supposed to be, but the results, that i get, are not perfect.
Here is a screenshot, of the result, when i use his code without changes:
As you will notice, the edges of the rooms do not have the same vanishing point. From grazing angles this looks extremely bad.
Here is the code, that i use currently for testing:
vec3 vTangent0 = vec3 ( vInteriorTangent.x, 0, vInteriorTangent.z); vec3 vTangent1 = vec3 (-vInteriorTangent.z, 0, vInteriorTangent.x); vDir.x = dot (vTangent0, vEye); vDir.y = vEye.y; // * 0.5; // HACK vDir.z = dot (vTangent1, vEye); // Entrance position into the room vec2 f = fract (vTexCoord2.xy); vec3 vCubePos = vec3 (f * vec2 (2.0, 2.0) - vec2 (1.0, 1.0), 1.0); // Compute position where the ray intersects the cube vec3 id = 1.0 / vDir; vec3 k = abs (id) - vCubePos * id; float kMin = min (min (k.x, k.y), k.z); vCubePos.xyz += kMin * vDir; // Sample cubemap at this position vInterior = textureCube (TextureInterior, vCubePos);
When i add the piece of code marked with “HACK” (ie: vDir.y = vEye.y * 0.5;) the result is this:
As you can see, the vanishing point is not completely wrong anymore, from grazing angles it looks much better. However, the result is still not perfect, it is still somehow distorted.
Can someone check out Humus demo, whether there are the same problems? And can someone tell me, what i might be doing wrong?