Odd behaviour with Cameras and Sprites in 1.5.3?

Hmmm, just downloaded 1.5.3 (great update guys) and as usual tested some of the code i’ve been writing with the new version and getting some strange behaviour with sprites and cameras.

Basically, I’ve got a 3D camera looking at a sprite thats flat to the X,Y plane. Moving the camera (i.e. the eye position) introduces distortion/tearing to the sprite as you move around it.

My code is quite involved, but a simplified example is here:


-- 3D Camera & Sprite Test

function setup()
    parameter.number("XY_distance", 1,1000,500)
    parameter.number("Z_distance", 1,1000,500)
    parameter.number("Y_rot",0,360,0)
end


function draw()

    background(40, 40, 50)

    eye_x = math.sin(math.rad(Y_rot)) * XY_distance
    eye_y = -math.cos(math.rad(Y_rot)) * XY_distance
    eye_z = Z_distance    
    
    perspective(60, WIDTH/HEIGHT)
    camera(eye_x, eye_y, eye_z, 0, 0, 0, 0,0,1)
    
    sprite("Cargo Bot:Codea Icon")
    
end

This also appears to happen with the sprite representing the floor in the 3D Lab example (difficult to see, but more obvious if you change the image to something like the Codea logo)

On the app i’m developing (which uses 3D cameras/sprites extensively) this is even more dramatic, with really bad tearing across polygons/textures. Yet to try this with a simple 2D mesh/camera combo and wondering if its just peculiar to sprites.

This looks like some sort of failure to correctly compute the texture coordinates in relation to the eye position.
I guess i’ll flag this as a possible bug, as I know @Simeon and the guys have just updated the sprite engine.

Any thoughts?

Can you try disabling sprite batching to see if it still produces artifacts?

Call spriteBatching(false) in setup to do this. Note that this is a debug method that I’m planning to remove. But I’ve left it in for this release to debug potential issues with rendering.

I’m getting the same with spriteBatching on. I tried it with 3D lab in test 1(tab) test2 parameter with the codea logo. It’s pretty noticeable. If I turn spriteBatching off then it renders correctly.

Yup, the spriteBaching(false) command fixed the issue and everything appears to behaving properly again. Thanks @Simeon.