Dev Blog

Hi, this is the Stranded III development blog (see also Forum Thread, Comment Thread).

Overview (115 Entries)

Entry 2 - Shadow Trouble & Lua - August 27, 2012

Lua added
Luckily using the Lua library in a C++ project is quite simple as Lua itself is written in C! So I managed to do this within a few minutes and I'm now ready to use Lua scripts in Stranded III.

Shadow Trouble
Shadows are giving me a headache though. I played around with shadows but there are a few problems:

• First of all: The part of the palm trees that is UNDER the ground (I made the wireframe visible to show that the trunk doesn't end at the ground) is rendered as shadow as well (red circles). This looks pretty odd and stupid. The easiest solution would be to simply don't put parts of models under the terrain. This leads to other problems though. Some models would partially fly in the air when placed on steep terrain for example.

• The leaves of the palm trees are not rendered in the shadowmap at all. Just the trunk. By default Ogre3D materials don't cast shadows when they have transparency. This can be disabled in the material script but it looks like I also have to enable "depth_write" to make it work, which makes all transparent shapes look crazy.
In the following screen you can see that the leaves cast shadows but if you look at the leaves themselves you can see that they cover the ground and trunks in an odd manner. This happens because I had to enable depth_write in their material script to make them cast shadows.

Hopefully there are solutions for those problems but I won't concentrate on shadows now. I'll continue with implementing game logic and a way to define and script objects, units and items. Moreover I have to choose/tweak the right Ogre3D scene manager to make everything run smoothly on large islands.

By the way: I found out that the Ogre3D Milkshape exporter can automatically create LOD (level of detail) versions of your models with reduced polygon counts. Ogre3D uses those versions automatically for objects which are far away from the camera to reduce the amount of polygons which need to be rendered.


blog comments powered by Disqus