getTextureCoordinates does not return values in texture space

I would like to use getTextureCoordinates to pick the color from the underlying texture.

The problem is that the method does not return UV in texture-space as it claims to do, but rather returns coordinates which appear to be in mesh-space.

Here is a playground which showcases the issue:

The playground shows a repeating texture on a ground mesh. You would expect that if you click the bullseye at each point, you would get similar UV coordinates, but instead you see that the UV coordinates seem to correspond to the ground mesh rather than the underlying texture.

Am I not understanding these concepts properly or is this incorrect behavior?


maybe that can fix

but if you need just pickColor you can use rendertarget

1 Like

Hello, thank you. The problem with rendertarget is that it would apply lighting etc… when I really only want the color in the mesh texture.

you can fix it by alternative material that just have raw diffuse
you can manage it by CustomMaterial

Given the correction of the uvs as given by @nasimiasl in his first post, you can use them to lookup the value in the texture (you can use Texture.readPixels to get the pixel data of a texture).

1 Like