Original Post
Hey all. I've been developing a dynamic lighting system for the 2D space game I am making. I have tried out a number of methods to achieve the proper effect. The goal is to have multiple light sources that cast a light, which is then used to render a normal mapped image for my space crafts, asteroids, etc. I've tried 3 different methods of rendering so far. 1. Get the normal mapped argb values, draw them on a separate blank image, and then simple draw the ships image, and then the normal mapped image (which is roughly half transparent) to the screen. Thus giving the effect of a proper normal mapped image. 2. Get the normal mapped argb values, combine each value with that of the corresponding ship image's argb value for the particular pixel. Draw each combined pixel value to a new rendered image, which is then drawn to the screen. 3. Get the normal mapped argb values. Draw the ships image to the new rendered image (java, bufferedImage), then set the alpha composite to 50% and draw the normal mapped image on top. The result ends up looking something like this...
All of these methods require the program to run through each pixel in the heightMap image in order to calculate the correct normal mapping value for each pixel (This is if there is only 1 light source by the way). This sadly is not very efficient. So my question is,... is there anyway to optimize normal mapping? Is there a way to get hardware support for this sort of thing?
All of these methods require the program to run through each pixel in the heightMap image in order to calculate the correct normal mapping value for each pixel (This is if there is only 1 light source by the way). This sadly is not very efficient. So my question is,... is there anyway to optimize normal mapping? Is there a way to get hardware support for this sort of thing?