Ok, at first a few answers:
Ranguna259 wrote:...could you add rotation...
Yes, its on my TODO list.
WetDesertRock wrote:Is it possible to have a segment be a game object? ... Also, are you going to do directional light sometime?
The light engine is completely separated from the physics and "drawing stuff" part, so you just have to synchronize the shadow bodys and lights with your game. When you update the light engine, all light/shadow information's will be generated in different canvases, which you can draw over or under your scene.
Yes, directional light will be included, soon.
Error
Cannot compile pixel shader code:
Line 2: error: Syntax error: "smooth" parse error
Yes, smooth is a keyword for ATI shaders. I have changed it to "lightSmooth".
So, here are the new things, i worked on:
My first normal shader calculation wasn't that good, so i watched a few other examples and rewrote him (I hope you can see the differences
).
I have finally integrated some options to generate normal maps. So you don't need to pixel them (this options will be extended in the future). It's for now possible to generate flat/gradient normal maps, convert height maps to normal maps and use(convert) the image itself as normal map (usually gives poor results).
Normal map gradient generation:
Height map to normal map generation:
Here some code examples:
Code: Select all
-- generate a simple normal map, which can be only lighted from the front
lightWorldImage.generateNormalMapFlat("front")
-- generate a cone like normal map
lightWorldImage.generateNormalMapGradient("gradient", "none")
-- generate a circle like normal map
lightWorldImage.generateNormalMapGradient("gradient", "gradient")
-- Set the height map of the object. The normal map will be automatically generated with the given strength.
lightWorldImage.setHeightMap(imgHeight, 2.0)
-- The normal map will be automatically generated from the image.
lightWorldImage.generateNormalMap(2.0)
Shadow color and alpha (glass):
Code example:
Code: Select all
-- set the object half transparent
shadowObject.setAlpha(0.5)
-- give the shadow body a color
shadowObject.setColor(255, 0, 0)
More informations can be found on the
Wiki.