Top-down View
3 posters
Top-down View
Currently I'm working on a project that uses a top down view. The problem I'm having, is when the camera is at position looking straight down, the screen is render black. If I rotate the camera to be on a slight angle, the scene is render as expect. My guess is the camera is blocking the default light source (I haven't setup any lamps). I don't have a great deal of experience programming OpenGL/AL, so I'm a little stuck at the moment. Any ideas or comments would be greatly appreciated.
Cheers,
Leon.
Cheers,
Leon.
lz- Posts : 1
Join date : 2008-10-28
Re: Top-down View
Ok I check it, the problem comes from a floating point precision problem that when the axis is purely at 0 it inverse the view to the opposite direction due to some trailing value of the camera direction vector, since the direction vector at that point in time is basically normalize that will cause the view to be flipped at 180 degree (as far as the direction vector is concerned) so the clipping algorithm will not function properly.
To fix this:
Choice #1: Modify the exporter for:
tar = ( Blender.Mathutils.Vector( 0.001, 0.001, -1.001 ) * obj.matrixWorld )
Choice #2: Always give an angle to your X axis, like 0.1 or something to your camera.
Choice #3: In code after you call sio2CameraUpdateDir(), check if this exception happen and give a little offset to you X and Y value (ex: 0.001f).
That should do the trick
ps: On my side I modify the exporter for theses extreme case.
Cheers,
To fix this:
Choice #1: Modify the exporter for:
tar = ( Blender.Mathutils.Vector( 0.001, 0.001, -1.001 ) * obj.matrixWorld )
Choice #2: Always give an angle to your X axis, like 0.1 or something to your camera.
Choice #3: In code after you call sio2CameraUpdateDir(), check if this exception happen and give a little offset to you X and Y value (ex: 0.001f).
That should do the trick
ps: On my side I modify the exporter for theses extreme case.
Cheers,
Re: Top-down View
I was experiencing the same problem and modifying the exporter did the trick. However the camera rotation is quite noticeable when the object you are looking at doesn't lie in the origin. Isn't there a better way to prevent this from happening at all?
michele.balistreri- Posts : 5
Join date : 2008-10-21
Re: Top-down View
Modify the sio2LookAt function to use double instead of float... I think that would do the trick...
Re: Top-down View
Had no luck modifying the sio2LookAt. The solution which does not affect the scene at all is to give a slight rotation on the X axis on every element in the scene as well as the camera.
Thank you a lot for your help!
Thank you a lot for your help!
michele.balistreri- Posts : 5
Join date : 2008-10-21
Re: Top-down View
So which solution you are currently using for your project? The modified exporter solution or? If yes, you might also wanna include that change for the direction of the lamp, Im afraid that the same thing would occur if you try to render the scene from the lamp point of view (for shadowmaps or something)...
If you have other problems lemme know,
Cheers,
If you have other problems lemme know,
Cheers,
Re: Top-down View
I am using solution #2, because the modified exporter actually affects the scene (the slight rotation on the z-axis becomes evident once the camera is distant from the other objects). What is important is to rotate everything in the scene on that axis so that it has no side effect on the projected result.
michele.balistreri- Posts : 5
Join date : 2008-10-21
Similar topics
» 2D View Issue
» Not able to view texture
» about the camera view in tutorial03
» Looking for some guidance on game loop and 2d/3d view switching
» Not able to view texture
» about the camera view in tutorial03
» Looking for some guidance on game loop and 2d/3d view switching
Permissions in this forum:
You cannot reply to topics in this forum