Image part as texture

Hi everyone,
I am trying to load a part of an image specifying the coordenades (in pixels) of the image that I want to use as a texture, but I can’t find the way to do it. I only am able to load an entire image as a texture. ¿How can I do this?

Thanks in advance,


I mean do you want to put an image as texture? It really meant that you have to do the changes in CSS. Changing in CSS will be effect the website

I don’t know of a direct way to only download a part of an image - you’re always going to have to download it all.

However, you could render the section of the image that you’re interested in into a 2D <canvas> - then use the canvas as a texture.

Alternatively, you could download the entire image into a texture and alter the UV coordinates on your mesh to use only the section that you want.

If you absolutely don’t want to download the entire image to the client for bandwidth or security reasons - then the only way to really be sure of that would be to write code in a PHP script on the server to extract just the part of the image that you need.