IMP
IMP copied to clipboard
Bug in function OctaSphereEnc() give empty frame when camera look from below
This bug can't be clearly seen when you merge 3 nearest frames like what you're doing now at here:
half3 frame0ray = FrameXYToRay(frame0, framesMinusOne.xx); half3 frame1ray = FrameXYToRay(frame1, framesMinusOne.xx); half3 frame2ray = FrameXYToRay(frame2, framesMinusOne.xx);
Thus to clearly see it, I edited the code to make it render one frame only which is frame0
.
Now when I put the camera right below the Imposter object, the Imposter object disappear.
The bug happens in the function OctaSphereEnc() in file ImposterCommon.cginc.
I notice the bug happen when the value of vec equals (-1,-1,-1), thus I fix it by tweaking it to (0,-1,-1). Like the code beblow:
half3 OctaSphereEnc(half2 coord) { half3 vec = half3(coord.x, 1 - dot(1, abs(coord)), coord.y); if (vec.y < 0) { if (vec.y == -1 && vec.z == -1 && vec.x == -1) //Fix the bug!!! { vec.x = 0; vec.z = -1; } half2 flip = vec.xz >= 0 ? half2(1, 1) : half2(-1, -1); vec.xz = (1 - abs(vec.zx)) * flip; } return vec; }
But the fix isn't perfect the because the frame is still twisted a little.