Hi all, I've been using Away3D for a while now, but this is my first post here. I've been struggling with something that, so far, I can't really see any way to solve...
I'm building an object on the fly within AS3 - the vertices can change position with each frame. It's kind of like a wave running through a texture-mapped plane. This all works fine, but my problems come when I attempt to add some sort of lighting to the equation. I'm having trouble calculating the normals properly.. I've tried several pieces of example code I've found around the web without success, but I can't see anything in particular wrong with my method. However, at the same time, I've noticed that repeatedly calculating normals every frame is quite CPU-heavy. Even if I get it working, I don't think it'll be fast enough. Now, I'm thinking that in actuality, I might be able to save on CPU time and not worry about the normals by simply modifying the faces directly in some way to represent the shading that should be going on. All I really want to do is just darken a face depending on its angle - that way I could just cut out the whole lighting issue altogether. But, is there any way I could actually darken or lighten a face or apply some sort of shading over the top of the texture? It doesn't seem to be possible. I'm contemplating drawing onto the BitmapData of the material I'm using in some way, but I'm not sure if that would be the best approach. Any ideas or thoughts would be greatly appreciated. Cheers, Chris.
