Field of view and textures.

Started by CuriousGeorge, December 29, 2005, 01:19:53 AM

Previous topic - Next topic

CuriousGeorge

Hi,
jPCT's great but i've run into two small problems (the former being probably my interpretation and the latter looking like a limitation).

Firstly, i'm using jPCT to place 3D objects atop of a 2D tiling engine but i'm having problems getting things to line up properly.

My 2D canvas is 512x512, this is blitted to the FrameBuffer. I've then got the 3D render which is done with a camera at 0,0,-512 and a FOV of 1.

This seemed to work but there's some drift. The 3D objects seem to wander slightly from their positions on the 2D map. Any pointers on this one?

Second thing I noticed was that there didn't seem to be any way of removing texutres from the TextureManager, is this correct? (We'd need to be constantly adding and removing textures in order to stream stuff).

Thanks!

George

EgonOlsen

The drift is most likely caused by the perspective projection. Your tile map is in parallel projection while jPCT works with perspective projection. You should be able to get a close matching by moving the camera far away with a small fov, but it seems to me that you are already doing this. However, maybe it's still possible to improve the results. It will never be exactly the same though.
About the TextureManager: Yes, you can't remove them and the reason are the objects/polygons referencing them. The TextureManager doesn't know which textures are still referenced by objects and which aren't. The objects know, but the TextureManager doesn't know the objects...so it's a bit difficult to add this. Maybe you can write your own TextureManager2 that relies on ITextureEffect-implementations to replace the pixel content of unused textures.

CuriousGeorge

Helge,
Thanks for your help.

The perspective problem is frustrating. If I move the camera really far away and use a FOV, the buildings don't drift but they then just look 2D and all you see is their roofs.

If I use a lower camera height and a wider FOV, I get the effect I need but the buildings then drift massively.

I'm trying to go for the GTA1/2 effect. A 2D tiling system with 2D sprites but 3D buildings.

Any suggestions on my approach? I'm thinking maybe i'm going about things in the wrong way..

Thanks for your help!

George

EgonOlsen

Quote from: "CuriousGeorge"I'm trying to go for the GTA1/2 effect. A 2D tiling system with 2D sprites but 3D buildings.

Any suggestions on my approach? I'm thinking maybe i'm going about things in the wrong way..
GTA 1/2 was 3D with 2D sprites viewed from above. The map was flat and the models were quite simple, but it was real 3D. I suggest to take that way too. You'll never succeed in combining a parallel projected, tiled map with perspective projected models on top. They simply don't match...as you've already noticed... :wink: