Texture changes in PlayCanvas

Aha, knew it! Anyway, I will do the necessary changes and get on with my life, but I still think it’s bad to mess with vertex values, as it will be a source of confusion in the custom shaders.

1 Like

Looks like Three.js flips uv coordinates in the gpu by default.
https://threejs.org/docs/#api/en/textures/Texture.flipY

1 Like

The Animated textures tutorial needs a small revision.

https://developer.playcanvas.com/en/tutorials/animated-textures/
For animated texture:


to
image

3 Likes

I’ve updated it. Thanks!

1 Like

Published to the main developer site

We are currently getting the textures upside-down once we download the project since this change, but the popup to re-compress it nowhere to be found, should this show automatically or is there any other way to recompress all our textures?

@slimbuck

Are the textures themselves upsides down or is it only when it’s used for render targets/with shaders?

If it’s the textures that are upside down, you can remove the compression and re-apply it:
Kapture 2021-08-13 at 12.56.59

If it’s render targets, you will need to add an option to flip the target, eg;

    var renderTarget = new pc.RenderTarget(device, colorBuffer, {
        depth: true,
        flipY: true // This option
    });

If it’s a shader, you may need to do use the 1 - yUV method as suggested here:

If you generate UV coordinates at runtime you will have to ensure texture V coordinates are correctly flipped. For example you can add the following to your shader:

texCoord.y = 1.0 - texCoord.y;

This also applies to custom shader chunks. Specifically, if you have custom versions of the following chunks, you will need to ensure the V coordinates are correctly flipped:

Hi yaustar, thank you for your fast reply. It are the textures themselves.
Is there a way to batch this and do all the textures at once?

Thanks,
Dave

Yeah, you can select all the textures in one go via the method posted here: Texture changes in PlayCanvas - #3 by yaustar