Hi there, I’m new using OpenGL. I’m using openFrameworks to load a .3ds model. It loads fine, but it looks kind of ugly compared to what it “should” look like. As you can see in the pictures below, edges don’t look sharp, there are some dark patterns, etc.
I have tried to google this, but I don’t really know what I should look for. Can you guys please give me some idea about what are the possible causes, whether that’s a common problem, what can I do to fix it…? Or at least what terms should I google ?
You need to figure out how to get better normals. Looks like only have shared normals. Perhaps it is possible to export model with proper non shared normals, or information about smoothing groups, or at least max smoothing angles. This forum has a number of threads discussing how to calculate normals with smoothing angle, If you check my posts you may find some related replies.
Indeed verify carefully everything about the normals :
are they really present on the .3ds files ? what is the tool used to display your second image, and is 3ds a native format for it, can you load the .3ds and see exactly this image for example ?
are they correctly loaded by your openFrameworks tools ? ie. have several distinct normals at each edge, instead of sharing the same (which will look smoothed out). This would need some printf of the data, try a simple cube as example.
are you correctly doing the rendering using the data generated by openFrameworks ? Show your code.
Indeed.
The smoothing groups define the set of vertices that are smooth.
The “Add normal to all three vertex normals” part should not add normal to a vertex not belonging to the same smoothing group.
Now, I am not sure if your best bet is to fix the 3DS/model3DS.cpp code or use a different loading library, like http://assimp.sourceforge.net/ for example. Try the viewer to have a quick look if the features are enough for you.
I just tried the assimp viewer and the model loads perfect. I downloaded the library and had a look at the “simple opengl sample”, but it doesn’t look very simple though
I see in the openFrameworks addon code that the smoothing groups are actually already loaded into a vector, but they are never used. Is it very hard to fix?
It also looks like they are doing a full radiosity solve for the lighting or at least some pretty accomplished ambient occlusion lighting. So one the edges are sharper, that will be the next difference…
Thanks guys! I managed to solve this issue. I found out there is actually an Assimp addon for the latest version of openFrameworks. I was using an older version because I wasn’t able to render textures with the lastest one. Then I upgraded the graphics driver and everything seems to work fine now.