HI,

I had a couple questions regarding normal maps/custom shaders.

I've been trying to figure out the best way to update a
BitmapMaterial's normalMap ( along with the texture ) per frame.  The
current way I have been achieving this ( probably not correct ) is by
extending the BitmapMaterial class and overriding updateTexture():

override public function updateTexture():void
{
    super.updateTexture();
    var normal:BitmapData = _screenPass.normalMap;

    _screenPass.normalMethod.normalMap = null;
    _screenPass.normalMethod.normalMap = normal;
}

This invalidates the normalMap bitmapData ok and updates, however the
update is significantly slower in comparison to the existing
BitmapMaterial updateTexture() method when just updating the texture.
Is there any reason why updating normal maps would be slower, perhaps
because the Shader Program needs to be uploaded again when modifying
normal maps?

Second question, is as i'm calculating the normal map data from a bump
map on the CPU side of things which is really slow anyway, ideally i'd
like to be able to create a custom shader to receive a bump/height map
( which is initially updated on the CPU ) as a parameter and
recalculate the normal map on the GPU side.  Any ideas on how/if this
is possible to integrate with the current Away3d framework so that
you'd get a good framerate, bearing in mind i'm working on 64x64
textured tiles with may be 10-20 max being updated/calculated per
frame?

Thanks,

Jamie

Reply via email to