I’ve spent a couple of days searching for an answer to this but have had no luck. When applying lighting to an imported model (the dog.3ds model supplied in the modelNoiseExample), the lighting looks blown out (little contrast on surfaces of the model). I suspect this has to do with not having a material assigned to model, but I’m unsure how to remedy it. I can set a color with ofSetColor; for example, I set red with ofSetColor(255, 0, 0), but the model shows up as a very light shade of pink. Here are my setup and draw methods (proper declarations in .h, of course):
I’m a new to the forum, so can’t upload an image of what the above produces. I’m running openframeworks v0.8.0 with a Code::Blocks svn build on Ubuntu 12.04. Any insight anyone might be able to lend would be greatly appreciated.
Thank you for the suggestion. I had enabled an ofLight but had not assigned a diffuse color. Doing so does improve the scene considerably. However, using setDirectional makes the model appear almost black. Apparently the dog.3ds model does not have a texture, as I’m seeing errors in the debugger that confirm as much. Is there not a way to define a material to be used when drawing an imported model? If I attempt to create a material, assign properties to it (like shininess) and use it , I see no effect. I assume creating a mesh from the model might remedy that? Perhaps I’m not using ofMaterial correctly. Here’s what I’m attempting now:
I’ve made some progress. I created a pair of ofVboMeshes from the model meshes (there are two), created a material and applied it to said meshes (in a manner similar to that used in the drawWithMesh() function in the modelNoiseExample code), paying close attention to the light and material specular and diffuse colors. It looks beautiful now and solves the light/material issue for a simple model like dog.3ds, but with a more complex model my framerate goes from ~53 fps max when using model.drawfaces() to 5 (or worse) when using ofVboMesh! That’s obviously unacceptable. What could account for such a dramatic difference? Surely not just applying a material. Duplicate vertices, perhaps?
I don’t think it’s quite the same issue. If I follow that thread correctly, his model had a material when loaded that didn’t render properly when using ofLight. The models I’m attempting to use don’t have a material, but I also can’t apply a material without first creating a mesh from the model and drawing the mesh vice the model. I would think that distinction’s important?