-
Hi! I'm extremely new to three js, and am using react three fiber for something I am building in a web app. I would like to create a cube, and put grid data on the surface of this cube, like so: https://i.stack.imgur.com/bmGNT.png. Is there an easy way to do this? I thought of a couple ways that I am not sure even works:
This doesn't scale though, because I want to be able to interact with the grid data on the cube later.
Any ideas and guidance would be amazing. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You can use a Here is an example https://codesandbox.io/s/canvas-animated-texture-10p7ws If you don't need to change the grid, I'd recommend using a texture. If you need a different grid on every face of the cube, I'd make a cube in something like Blender, and create a UV map. 6 doesn't divide evenly into 1024, so you'll have some dead space, but, you should be able to tell the canvas renderer exactly where to draw. The only issue with this is that you need to upload canvas image data to the GPU per frame. That will be an issue if the data you want to render requires that the canvas is high resolution (like 2K and up). If you need high fidelity data, I'd recommend using geometry to do it. |
Beta Was this translation helpful? Give feedback.
You can use a
<canvasTexture>
to draw a grid on the surface of the cube.Here is an example https://codesandbox.io/s/canvas-animated-texture-10p7ws
If you don't need to change the grid, I'd recommend using a texture.
If you need a different grid on every face of the cube, I'd make a cube in something like Blender, and create a UV map. 6 doesn't divide evenly into 1024, so you'll have some dead space, but, you should be able to tell the canvas renderer exactly where to draw.
The only issue with this is that you need to upload canvas image data to the GPU per frame. That will be an issue if the data you want to render requires that the canvas is high resolution (like 2K and up). If you need…