Wednesday, June 4, 2008

Red herrings

I got a little distracted by some issues yesterday.

The first was the sphere mesh I was using for planets and star objects. No matter what texture I applied to it nothing would display on the surface except for the general colour of the texture. For some reason I decided it would be cool to generate a sphere in code using the "create a sphere" code snippet. It cost a bit of time to adapt the code and finally I got stuck at the part using pointers anyway. What I did in the end was to create a new sphere mesh in blender with the texture coordinates applied.


Here's the stars and planets with a texture (from vega strike again!) applied. It is very faint, but the "glow" of the star has an issue as well: it runs into the image border and looks cropped. Once again, I spent time fooling around with different image formats and Ogre's scene blending options to try and fix the problem. I also tried creating flares with a transparent background but Ogre doesn't like that, it requires a black background instead. The cause and solution was found in this forum thread, which is to adjust the levels and make the outer glow invisible.

So anyway, I was trying to create a selection boundary around the selected object, and came across this cool thread detailing the use of stencil buffers and render queue listeners. After a while, I had adapted the code over to python but found what seems to be a bug in python-ogre: RenderQueueListener methods require a return value which is a pointer to a c++ bool object. Even with a listener stripped of all code it would still have the error, and I'm not sure how to create a c++ type. This might have been fixed in the latest Python-Ogre, but compiling that is quite a chore.


What I went with in the end was a simple billboard pasted over the selected object, which is still better than using the bounding box. I'm currently wondering if this sun, with the glow exposed, is more 'sunny' than the previous one.


After adding a few different types of planets and stars.

No comments: