- Home /
Having trouble with getting a image to a fit on a face of a cube
I have a problem with a Unity project that I'm working on. I'm creating an 3D art gallery which will be developed into a VR application in the future.
In a 3D scene, I have created a paint canvas GameObject (a cube) but I have some trouble getting images fit on the whole canvas. When I try to apply an image as a material, it is treated as a texture and only a small part of the image is visible on the canvas.
I am planning to make a UI where the user can upload pictures and the application will automatically render the gallery with these pictures
I did not configure the martial properties like a texture. Just dropped it on the canvas. I need to know is there a way I can show any image in full size and fit in to the size of canvas frame
Unity's default cube is already uv unwrapped to fit a whole texture on a face. It looks like you're using a custom cube which has not been properly uv unwrapped.
Yes. I created the cube using blender. That way the frame and the canvas are children of the cube. Do I need to unwrap that in blender before importing it on to unity? Note that cube is in fbx format.
Answer by Arano · Oct 09, 2019 at 01:01 PM
seems to me that this is just a scaling option.
in script you could read the width/height of a texture and change scaling of your object to correctly represent this width/height.
public Texture tex;
plane.transform.localScale = new Vector3(tex.height/scaleFactor,1, tex.width/scaleFactor);
Your answer
Follow this Question
Related Questions
Splitting a full image into smaller images 1 Answer
How do I "page" multiple images across a surface? 0 Answers
8 bpp TIFF images are not supported ? 2 Answers
How can encode an image with Unity to be displayed in the website using Javascript and HTML? 1 Answer
Obtaining pixels from line renderer 0 Answers