A trick for doing light effect.

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
yoyoyoo
Posts: 1
Joined: Fri May 31, 2013 1:42 pm

A trick for doing light effect.

Post by yoyoyoo »

This is a trick I did for creating the look that a model had a light source shining on it. I first created a duplicate of the model that was going to have the light on it. This model's geometry is the same, but the texture is different. The texture is a pure white image, with an alpha value. I used the alpha value of around 0.1 for the entire image. (This made the model have a flat light in the light direction, shading this texture would give better results). The model's texture type flag was set to EMT_TRANSPARENT_ALPHA_CHANNEL The duplicate model was then moved towards the point of the point light source by a rage of about 0.01 By doing this when the transparent model gets drawn, it will blend the texture code of the model onto the none transparent model. This will produce the look of a light on it's surface, and in the direction of the point light. I imagine the same thing could be done in reverse, for a shadow.

It does have some inaccuracies for places where light shines as there is no point to light collision, but the effect does work for producing the illusion of light.

And if the texture for the transparent model was shaded, maybe at runtime, it would look even better.

This could only be done when the ambient light is turned on. As the drawing routine depends on existing color codes in the output image.

Wesley...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: A trick for doing light effect.

Post by hybrid »

If I understand you correctly, you do a manual lightmap implementation. I guess that using a lightmap material directly would be easier and more efficient - but this solution might be easier to load from arbitrary model formats of course. Still, lightmaps seem a better approach.
Post Reply