need help with normalmapping (again)

Blitz3D Forums/Blitz3D Programming/need help with normalmapping (again)

Kalisme(Posted 2006) [#1]
Sorry people, but I need help with normal mapping again...
I was working on my code to get animated models to work with normalmaps.... and I finally got it working... then I lost the code... (yeah... I know it sounds like I'm lying... but oh well)
it was really simple, the whole thing was based around:
some normalmapping functions (dot3 lights)
fast realtime cubemap reflection code (from archives)
and a sphere.

Instead of applying the normal maps to the animated mesh, the sphere was normal mapped from the places where the lights were meant to come from... then the cubemaps were taken from inside the sphere (it was rendered with double sided polygons)... my computer isn't very fancy so I used low-res textures for my cubemap... then the cubemap was placed onto the animated 3d model...
it seemed to run pretty well on my not-so-great computer...

I had most of the code backed up... but I can't find the normalmapping code that I used....
can anyone help?
I need something that can have multiple lights (well... I'd like) and (here's the tricky part... I guess) uses each vertex (individually) on the sphere and creates the correct colors... for some wierd reason when I used alot of the differant verson of this code (done by differant people) if the light was in front, it worked perfectly... but if it was behind... it didn't work... and if I raised the light to high it screwed around with the lighting... and I know the models aren't normal mapped wrong... I'm using other peoples I found for testing =P

Can someone please help?
Thanx for reading


Alienforce(Posted 2006) [#2]
Kalisme: Check out this.
www.rosscrooks.pwp.blueyonder.co.uk/normalmapping1.zip


Kalisme(Posted 2006) [#3]
Alienforce: thank you for pointing this out to me, but this is actually where I got the idea from.

I'm hoping to make it possible to use normalmapped objects in games that are animated and can have moving lights effect them (eg: level lights and gun shots)
I had it working pretty well, but now I can't find the per-vertex dot3 lighting functions I found around here once.
And not every per-vertex dot3 lighting function works with it


Ross C(Posted 2006) [#4]
If you use that code from above, i don't think you can use the vertex colouring. You would need to drop the cubemaps i'm afraid. Also, the code posted above, will only work for tangent space normal maps.


Kalisme(Posted 2006) [#5]
tangent space eh?
well that explains alot...
maybe I looked that up last time...
I'm not sure...
I know this can work because I did it before...
I just hafta redo it
thanx Ross C, I guess I can narrow down the search for code a bit now :)


Kalisme(Posted 2006) [#6]
ok ok... I think I finally know what I need...
I need code that can get a model... go through the vertexes and find if the normals are pointing towards the light...
if they are perfectly, they should appear blue... if the light doesn't touch... it should be grey.. if it hits on the sides... well... people who understand dot3 lighting will know all about it... I don't.
but dot3 coloring the vertexes depending on the direction of the vertexes normal...

can someone direct me to the kind of code I'm blabbering about? I thought fredborgs code would work... but for some reason when the light went beind the model the colors weren't right... it was odd... or maybe I had one of the versions someone played with... I'm a tad confused

sorry for being anoying


Kalisme(Posted 2006) [#7]
YAY! I found it...
and it works fine n_n
I used the Raitsun dot3 lighting code... (same one as I used b4)...
unfortunatly he said he couldn't get more than one light working.... so I'm guessing I'll hafta re-write the code...
I'll probably put up a few shots in graphics showcase just to show that it works


Alienforce(Posted 2006) [#8]
Can you share a link to the code ? please :)


skyfire1(Posted 2006) [#9]
i second alien's request!


Kalisme(Posted 2006) [#10]
oh, lol... sorry about that...
here you go:
http://www.filefactory.com/get/f.php?f=6ba1be98a1180a79abba60d2

hope it's helpful :)
tell me if anything goes wrong with the download


skyfire1(Posted 2006) [#11]
very nice. it looks like the 3d model has lots of polygons.