Wednesday, September 07, 2011

Sunshine: Fixed Normals

I'm finally starting to make some noticeable headway in my Sunshine app.  It feels like everything I do has such a little impact on the UI, but then I tell myself it's all "infrastructure" and soon I'll be able to start adding features like crazy.  I'm probably lying to myself.

Imported lamp OBJ with calculated normals
Infrastructure - boost::python bindings
After a lot of help from the boost::python mailing list, I've managed to expose my Scene object to python.  Although there isn't a lot of the C++ code exposed, the "infrastructure" for it is there so I can expose classes and individual functions quickly on a need-to-expose basis.  Right now I have a python script, which compiles to a Qt resource in the binary and use it to import OBJs.  Although it's fairly generic (lacks material support, ignores normals/UVs), it would be plenty trivial to import other geometry types with very little effort.

Fixed Normals
As I mentioned, I'm ignoring the normals provided in the lamp OBJ for now and recompute the normals per face (no smoothing).  I've had a bug in the fragment shader for the longest time that I've ignored until I started moving the cube mesh away from the origin.  Looking at the GLSL, it looks like I was transforming my incoming normal by my object-to-world.  That made the translation factor muck up the vector.  I ended up adding a normal object-to-world matrix that right now just consists of the model rotation matrix.  It looks a lot better!

Basic Features
Import OBJs
Write python-based mesh importers
Tumble around scene in Maya-like camera
Render "test" to aqsis window

Next Step
Add a face mode and some tools (?in python?)
Send scene to aqsis
Make render settings (resolution at least) adjustable

Download
https://github.com/strattonbrazil/Sunshine



No comments: