gameprogcpp / code

Game Programming in C++ Code
Other
1.01k stars 354 forks source link

Blender Exporter UV coordinates problem. #32

Closed Scr3amind closed 4 years ago

Scr3amind commented 4 years ago

Hi again Mr Sanjay i have a problem with the blender exporter script. i´m trying to replicate the cube found in assets with a simple texture. (creating a cube in blender 2.79, unwrap and assign a texture)

imagen

but when is loaded on the program of chapter 6 seems that the uv coordinates are wrong imagen

Comparing the two .gpmesh files (original cube vs my cube) found that the original cube have way more vertices. 28 vs 8. While mi cube have only one UVcoord per vertex , the original cube have diferent combinations of the same vertex with diferent UVcoords. imagen

imagen

Am i missing some step before exporting the mesh?

Thanks you so much for the book. Sorry for my bad english. Greetings from México

chalonverse commented 4 years ago

Well, for a cube each side needs to have its own vertices. You can't share vertices between multiple sides because it won't work properly for lighting normals. So you can't just make your cube have 8 vertices for the corners. You need 4 vertices per side, 6 sides, so 24 vertices in total