dilevin / computer-graphics-meshes

Computer Graphics Assignment about Meshes
1 stars 5 forks source link

Cannot understand Cube Texture #49

Closed jarenworme closed 10 months ago

jarenworme commented 10 months ago

I cannot understand what I am misunderstanding about this, can someone let me know what I am doing wrong that my textures are not showing up? From all the resources I could find this is how the obj file is supposed to look..

cubeChart cubeObjFile malformedCube

Zhecheng-Wang commented 10 months ago

It looks like your face might be inverted -- in addition, I think your face is having the same issue in #44. Can you double-check your face matrix?

I think you are following your vertex ordering in the write-up, which will make the face intersect with itself and invert the face orientation.

jarenworme commented 10 months ago

Why would that cause the face to intersect itself? Is there a certain order I need to define the faces in??

Zhecheng-Wang commented 10 months ago

Because the face is connecting vertices following the order of the vertex indices. Connecting vertices in the order of 1/2/3/4 and 2/1/4/3 -> two different topologies.

Think of 4 points in space, now you need to connect them to make a quad with one stroke. You certainly wouldn't want to connect them across the diagonal. The shining line on the left face of the cube in your image implies your face is connected in the wrong order.

jarenworme commented 10 months ago

Ok I traced through all the faces and made sure to align their vertices sequentially, but still no luck with the texture. It wraps around half the cube and is black. Any other suggestions? Screenshot 2023-10-24 174855 Screenshot 2023-10-24 175054

Zhecheng-Wang commented 10 months ago

I think your NV might also be wrong -- here is what I get when I inverted all the NV but one row, as you can see the shading can't shine on the faces with the wrong normal. image I think your UV is on the right track. I would suspect it is a UF issue.

jarenworme commented 10 months ago

The issue was that the cube was not accessing the texture file. It was correct since the last post. Since I am on windows, I had to change the file path to include an extra ../ since the code is in the debug folder.