1
Support / My lights are messed up
« on: September 01, 2015, 04:45:56 pm »
Hello everyone!
Working on my little 3D demo which is basically an old school FPS dungeon crawler lookalike. I got the basic rendering stuff done and I started to add light sources (torches) but I encountered some strange behaviour:
I strongly suspect my code which builds the blocks, that messes with the lighting as I read somewhere on the board that too many Object3Ds mess with the lighting.
I'll give you a quick rundown how I build my level:
Dungeon layout is defined in a txt file
Where # is a wall block and . is a block with only a floor and a ceiling.
I iterate over the layout and create an Object3D for each block. Because I'm a lazy slob, a non wall block only has the floor and ceiling which I inverted then during creation (so you basically stand inside the cube and can see the walls from inside).
After adding wall and floor tiles to a separate array (walls and tiles) I call Object3D.mergeAll with the arrays as parameter and add the result to the world.
When I add a red light for testing it results in the images shown above.
I'm also unsure on how the compileAndStrip() function works... If I call it on the wall and tile Object3Ds lighting gets removed completely. I added some fog via setFogging() and it gets removed too when I call compileAndStrip().
So, how can I fix my lights? I can add some code if anything needs clarification.
Cheers!
Working on my little 3D demo which is basically an old school FPS dungeon crawler lookalike. I got the basic rendering stuff done and I started to add light sources (torches) but I encountered some strange behaviour:
I strongly suspect my code which builds the blocks, that messes with the lighting as I read somewhere on the board that too many Object3Ds mess with the lighting.
I'll give you a quick rundown how I build my level:
Dungeon layout is defined in a txt file
Code: [Select]
######
#....#
#....#
#....#
######
Where # is a wall block and . is a block with only a floor and a ceiling.
I iterate over the layout and create an Object3D for each block. Because I'm a lazy slob, a non wall block only has the floor and ceiling which I inverted then during creation (so you basically stand inside the cube and can see the walls from inside).
After adding wall and floor tiles to a separate array (walls and tiles) I call Object3D.mergeAll with the arrays as parameter and add the result to the world.
When I add a red light for testing it results in the images shown above.
I'm also unsure on how the compileAndStrip() function works... If I call it on the wall and tile Object3Ds lighting gets removed completely. I added some fog via setFogging() and it gets removed too when I call compileAndStrip().
So, how can I fix my lights? I can add some code if anything needs clarification.
Cheers!