Surfaces Not Illuminated

Blitz3D Forums/Blitz3D Programming/Surfaces Not Illuminated

Newbunkle(Posted 2004) [#1]
I'm fairly new to Blitz3D, and I've just run into my first major obstacle.

I've begun creating my own surfaces and meshes, but I run into problems when I add lighting effects. Some surfaces seem unaffected by lights. I created a corridor section which was hex shaped and I then placed a point light inside. Even though all the surfaces are visible from inside, and all are equally distant from the light source, some are illluminated and others aren't. Usually its the floor and the lower left hand wall that are lit up:

unlit --> _
unlit --> / \
unlit --> /

lit --> \_

NB: Each wall is a seperate surface, but the whole section is one mesh.

I can't post the code as I'm not at home. Does anyone have any idea why this might be happening? =/


Newbunkle(Posted 2004) [#2]
PS: Oops, I've just seen Captain Laser's similar thread. I should point out that I have used UpdateNormal on the object.

The diagram didn;t turn out too good either. Doh.


Caff(Posted 2004) [#3]
Yep, updatenormal is your friend. The other time a surface is unaffected by lights is when you use the Fullbright flag on the texture (e.g. you have a lightmap covering the mesh)


Floyd(Posted 2004) [#4]
Maybe the normals are pointing the wrong way, out of the corridor rather than into it.


Newbunkle(Posted 2004) [#5]
Floyd, I think you've hit the nail on the head, but I'm not sure how to get around it. I've used UpdateNormal at the end of the code once the six sides have been generated. Is there a way to update the normal for each of the six sides seperately? Using ambient light, I've taken a walk around it and the surfaces are inward-facing. Does Blitz usually throw a fit when dealing with meshes with only internal surfaces?


Stevie G(Posted 2004) [#6]
You sometimes get some dodgy results if it a very low poly. You could set the normals manually using the VertexNX / NY / NZ commands or ... I think SSwift has a function in the code archives which calculates the normals of a mesh and may produce better results for you.


Newbunkle(Posted 2004) [#7]
Aha... thanks for the advice. I'll check it out when I get home! =)


big10p(Posted 2004) [#8]
Hmmm, I seem to be pimping my own stuff alot lately but this little lib may be of use. It'll actually draw the normals so you can visually check they look right.

http://www.blitzbasic.com/codearcs/codearcs.php?code=1085


Rook Zimbabwe(Posted 2004) [#9]
Um just a noob myself but did you set AMBIENTLIGHT to at least 12,12,12??? That does help with shadows as well!!!


John Blackledge(Posted 2004) [#10]
Don't know if this is relevant, but I had a lot of trouble trying to use single-sided rects with ambient lighting. The light just 'gathered at one corner'.
In the end I had to make all my village fences out of flattened cubes.


Newbunkle(Posted 2004) [#11]
Hi everyone. I sorted out the problem. My corridor was too long, and the light was right at the middle. I did a test where the light was following the camera. It lights up when you get close to the edge but darkens near the middle. I'm guessing its because the light is worked out at the corners. Thanks for all your help though. I've certainly learned a lesson! From now on... lots of smaller surfaces.