Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - phlux

Pages: [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
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.


Support / Help with frustum culling and perspective
« on: August 20, 2013, 08:44:21 pm »

I'm quite helpless in figuring out how to choose the correct FOV and also adjusting the nearPlane so my objects are not cut off. As mentioned in previous threads I'm working on some kind of dungeon crawler (eg Grimrock or Dungeon Master, Realms of Arkania). In the old games it is possible to stand directly in front of a wall and see the complete facing wall and some portions of the floor and ceiling. This is exactly the perspective I'm aiming for. Here is an example:

one step closer (standing direct in front of the wall)

Okay you can see here that at least a small area of floor is visible.

My implementation
Each tile (wall, floor, ceiling) is a 2x2 units small Object3D. So if a floor tile is created with the coords (0,0) (2,0) (0,2) (2,2) I position the camera at point (1,1) for example.
When I rotate the camera 90 degrees, walls will be cut off during rotation and you can see what's behind that block. From my limited 3D graphics knowledge I knew that I need to fiddle with the clipping planes in order to reduce this effect. I reduced the nearPlane to a size of 0.78f which suited my needs at first.

Same scene as the first screenshot.

Now going one step forward...

*donk* looks like I'm hugging the wall.

I tweaked the nearPlane and also the world cams FOV, nearPlane size of 0.4f and FOV of 1.2f

step closer

Looks better but editing the two values anymore makes it looks like an alien view, especially when rotating the camera. Anyone got an idea how to accomplish the desired perspective?

Here's also a movie, showing off what I got till now. It was taken with just the adjusted nearPlane:

Support / Animated rotation of the camera 90 degree wise
« on: August 09, 2013, 04:31:50 pm »
Hi again.

I'm still on my prototype of my dungeon crawler thing demo. However I'm not quite sure how to implement 90 degree wise camera rotation.
I'm using the advanced example from the wiki as a source base. The example uses ticks for animation. My idea was that the camera needs some defined amount of ticks to finish a 90 rotation. So if a keypress to rotate the camera is detected I would use the animate() function from the example to rotate the camera until an amound of ticks is reached. Say a rotation would take 100 ticks for 90 degrees, so I would rotate the camera 0.9 degree each tick.

Is this the correct approach or is there a better way to accomplish this kind of camera movement?

I've seen that there is already some functions like checkCameraCollision() in the World class for basic cam movement (forward/backward). How are these implemented? Also are these suited for non rotational movement in a dungeon crawler?

Thanks again,

Support / Combining MD2 models?
« on: July 30, 2013, 04:55:10 pm »

I've already tried the search but to no avail. Right now I'm just playing around with the engine and have a look at whats possible and what not. I've seen that the engine supports loading MD2 models and also playing animations. However the models don't hold any weapons in their hands and my question now is, if there is a way to load two models combine them and play a skeletal animation?

For example let's say you have a MD2 model of a knight and also a model of a sword, can you add it programatically to the hand of the knight and the character model uses it correct in its animations?

Thanks in advance

Pages: [1]