Quote:
Originally Posted by jbb
At the moment I have d3d lighting disabled and am just drawing the textures without lighting. I don't have any information on the location or nature of light sources in the new files so can't do proper lighting at this time although I think it likely there is some kind of lighting information in the .lit (?) files. Not sure.
I'm trying to get the bump map stuff working first. To do that I need to take the normal texture, and the vector to the light source and calculate the dot product at each pixel. And then use the resulting texture to modulate the main texture. D3D can do this using the D3DTOP_DOTPRODUCT3 texture combiner mode. I believe that opengl has a similar extension. The problem I'm having is that the lighting vector to apply is the vector of the light source in *texture space* so I have to transform the light vector for every polygon. And I don't yet understand the math well enough to do this. Working on it though... Lot of reading to do.
On the subject of alpha, I've only seen 0 and 255 in the "new" zones which makes it a bit easier as no sorting is required for that, just use an alpha mask. There could be some other values in files I've not yet looked at I suppose.
|
It might be easier to just use a bump-mapping shader for this.
Also, I suggest you check out NeHe's bump mapping tutorial... it's somewhere at
http://nehe.gamedev.net
Their examples are all for OpenGL, but the concepts should map directly to DX.