Modified normal mapping. looks awesome.
Community Forums/Graphic Chat/Modified normal mapping. looks awesome.
| ||
Hey, i have made some very small changes to this guys code: http://www.blitzbasic.com/Community/posts.php?topic=39353 Basically, slapped on a new normal map and texture. This technique is brilliant! I've put a slightly larger cubemap texture too. Arrow keys to move the camera around the rotating dragon and rotating landscape. A big hand to MSW! A and Z to zoom in and out. http://www.rosscrooks.pwp.blueyonder.co.uk/normalmapping1.zip And the Imp version: http://www.rosscrooks.pwp.blueyonder.co.uk/imp.zip |
| ||
Cool!!! Thanks for sharing the code |
| ||
Basically, as described in MSW's posts, you don't need to adjust any colours, as the cubemap handles all this. So just apply your normal map, light map, texture and cubemap, and your sorted. |
| ||
yeah thats the same as the cubemap I use...it updates the normals correctly. Looks good Ross :) Sam |
| ||
I found this code a while back. I can't remember who posted it, but i hope they don't mind it being reposted. This will generate a cubemap for correct lighting. Saves the image as "cubemap6.bmp";------------------------------------------------------------ ; creates cubemap textures and saves one too as a single image Graphics3D 800,600 SetBuffer BackBuffer() Global texture = CreateTexture(256,256,128) MakeCubeFace(texture) Function MakeCubeFace(tex) image = CreateImage(256,256) cubeimage = CreateImage(256*6, 256) SetBuffer ImageBuffer(image) ; left SetCubeFace tex,0 For y=0 To 255 For z=0 To 255 Color 255, y, 255-z Plot z,y Next Next CopyRect 0,0,256,256,0,0,ImageBuffer(image),TextureBuffer(tex) CopyRect 0,0,256,256,0,0,ImageBuffer(image),ImageBuffer(cubeimage) ;back SetCubeFace tex,1 For x=0 To 255 For y=0 To 255 Color 255-x, y, 0 Plot x,y Next Next CopyRect 0,0,256,256,0,0,ImageBuffer(image),TextureBuffer(tex) CopyRect 0,0,256,256,256,0,ImageBuffer(image),ImageBuffer(cubeimage) ; right SetCubeFace tex,2 For y=0 To 255 For z=0 To 255 Color 0, y, z Plot z,y Next Next CopyRect 0,0,256,256,0,0,ImageBuffer(image),TextureBuffer(tex) CopyRect 0,0,256,256,512,0,ImageBuffer(image),ImageBuffer(cubeimage) ;front SetCubeFace tex,3 For y=0 To 255 For x=0 To 255 Color x, y, 255 Plot x,y Next Next ;EndIf CopyRect 0,0,256,256,0,0,ImageBuffer(image),TextureBuffer(tex) CopyRect 0,0,256,256,256*3,0,ImageBuffer(image),ImageBuffer(cubeimage) ; top SetCubeFace tex,4 For z=0 To 255 For x=0 To 255 Color 255-x, 0, 255-z Plot x,z Next Next CopyRect 0,0,256,256,0,0,ImageBuffer(image),TextureBuffer(tex) CopyRect 0,0,256,256,256*4,0,ImageBuffer(image),ImageBuffer(cubeimage) ;bottom SetCubeFace tex,5 For z=0 To 255 For x=0 To 255 Color 255-x, 255, z Plot x,z Next Next CopyRect 0,0,256,256,0,0,ImageBuffer(image),TextureBuffer(tex) CopyRect 0,0,256,256,256*5,0,ImageBuffer(image),ImageBuffer(cubeimage) SaveImage (cubeimage,"cubemap6.bmp") FreeImage(image) FreeImage(cubeimage) SetBuffer BackBuffer() End Function |
| ||
wow I missed that one, took me forvever to track down a normalizing cubemap..heh I got the one I have from the Shader site. thanks for the repost :) Sam |
| ||
Np's. Here's the imp you sent, using that code... http://www.rosscrooks.pwp.blueyonder.co.uk/imp.zip |
| ||
What would be nice tho is to have a moving light work with tangent space normal map (like the one in the imp.zip you sent). I havent looked into this at all, but do you think its possible to have the light rotate? Perhaps by animating the cubemap? |
| ||
I think animating the cubemap would be feasable yeah. Probably be best off with a smaller cubemap than the one i have just now. To shift the light though, you can simply use entity colour. It will only give directional light though, but hey, you could have every entity's colour, calculated from the lights source. |
| ||
Or maybe i'm talking through my arse... hehe, oops! |
| ||
I sent another email :) added a few things, used blend mode 5 to make it stark...like D3, (I preffer the orginal myself tho) tried my hand at some specular masks . you can control the brightness with q(brighter) and w(darker) keys. also theres a differnt lcube with it...really a greyscale version of the normals cube..but you can change its color to have colored lights. and it looks a bit sharper and brighter. I had some luck with generating the Cube in realtime using the Dot3light code from the forums. Only lighting a Cube then flipping it and rendering the cubemap. it worked...but you would need a cubemap rendered for each entity , except for directional lights. Sam |
| ||
I got your email man, but the code doesn't seem to do anything over here... Just a full bright Imp and a fullbright landscape... tis odd. :o) |
| ||
That is kinda Odd, it should start with no light at all..heh the only thing I changed was the blendmodes. You might try leaving them default instead of blend mode 5 on the Duffuse textures. wait , gf4 might only have 4 texture stages per pass. I used 5 ...try taking the Spec mask out :) Sam |
| ||
Ok man :o) I will do. I had a similar problem a while back, with more than 4 textures. |