FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Top-down View

3 posters

Go down

Top-down View Empty Top-down View

Post  lz Tue Oct 28, 2008 10:29 pm

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.

lz

Posts : 1
Join date : 2008-10-28

Back to top Go down

Top-down View Empty Re: Top-down View

Post  sio2interactive Wed Oct 29, 2008 12:18 am

Can you send me a .blend file that cause problem? So I can check it out Wink

Tks!
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Top-down View Empty Re: Top-down View

Post  sio2interactive Wed Oct 29, 2008 1:21 am

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 Wink

ps: On my side I modify the exporter for theses extreme case.

Cheers,
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Top-down View Empty Re: Top-down View

Post  michele.balistreri Wed Oct 29, 2008 5:17 am

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

Back to top Go down

Top-down View Empty Re: Top-down View

Post  sio2interactive Wed Oct 29, 2008 6:00 am

Modify the sio2LookAt function to use double instead of float... I think that would do the trick...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Top-down View Empty Re: Top-down View

Post  michele.balistreri Thu Oct 30, 2008 8:06 am

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!

michele.balistreri

Posts : 5
Join date : 2008-10-21

Back to top Go down

Top-down View Empty Re: Top-down View

Post  sio2interactive Thu Oct 30, 2008 8:20 am

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,
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Top-down View Empty Re: Top-down View

Post  michele.balistreri Thu Oct 30, 2008 8:41 am

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

Back to top Go down

Top-down View Empty Re: Top-down View

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum