1 2 3 4 5 6 | Normal.xy = Normal.x*NxAxis + Normal.y*NyAxis; Normal.z = NzScale; Normal.xyz = Normalize(Normal.xyz); v3 BounceDirection = 2.0f*Normal.xyz; BounceDirection.z -= 1.0f; |
SlappedSilly
To comment on a different reflection bug, I believe the speckels around the periphery of the sphere is caused by lerping the normals at that sharp transition.
1 2 3 4 5 6 7 | : | as encoded by the normal map |________ : | as produced by the lerp \________ |
SlappedSilly
As for the distorted reflection, I'm now suspecting it's caused by interference between ScreenSpaceUV and SampleDirection in SampleEnvironmentMap().
cmuratori
Movement in Y _should actually be movement in Z_ for purposes of the map, so that is where the anomaly is coming from.
1 2 3 4 | #define YEncodedAsZ(y) (y) . . float Z = -YEncodedAsZ(MyVar.y); |
pajh
To me the sphere has a distinct black border - ie the pattern does not seem to reflect all the way to the edge.
A good point, and another reason we may want to try encoding something slightly different instead of doing real reflection directly.
Secondly in this weird Y/Z "what to they mean?" scenario, you're intending on doing either laying down or standing up "cards" - but if you consider something like the way a barrel is drawn in most "2d" games - ie an upright cylinder where you also get a view of the top - as you start at the bottom and move up in Y (in terms of the sprite) you are actually moving "up" (ie away from the ground) ie the sprite needs to be treated as an upright card, however as you cross the boundary to the lid moving in "sprite Y" is now no longer moving away from the ground plane but parallel to it.
mmozeiko
Here's how reflections should look like