1
\$\begingroup\$

I am having some problems with developing my game in OpenGL with java (Using LWJGL3). I have been following a guide for the more complex steps of the process, like loading meshes.

When using the basic mesh of a cube that was provided by the guide it works as it should, so it seems like it is not my software that is the problem? The problem comes when I attempted to create my own models using blender. I made sure to triangulate faces and include normals when exporting, but for some reason even when I created a simple cube it does not work correctly. The textures get smeared, only one face is intact. I have both tried the automatic UV projection, and making my own seams.

I have been stuck on this for a while and I have no idea where I am doing something wrong. I would greatly appreciate some help. Example 1 Example 2

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

Did you export the UV coordinates?

Did you unwrap the model?

Maybe this answer can help you.

Is the OBJ file loader provided by WJGL3? Or did you roll your own? If it's the latter.. note that OBJ indices start counting at 1, not 0. This easily trips up any programmer trying to parse Wavefront OBJ files.

\$\endgroup\$
1
  • \$\begingroup\$ I have made sure to export the UV coordinates. I can also confirm this as if I change the UV map in blender it appears different in-game, while still distorted. I have also unwrapped the model. I wrote the OBJ loader myself, with a lot of help from a guide. Because the provided mesh from the guide is displayed correctly it leads me to believe that it is the OBJ file that is the problem, and not the loader. \$\endgroup\$ Dec 10, 2018 at 17:58
1
\$\begingroup\$

It turned out to be a small and stupid mistake. I had forgotten to split the edges, with the "Edge Split" action in blender. My game engine could not assign multiple texture coordinates to the same vertex so I had to give every face its own vertices. Nice.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .