
Perpective View
Posted Wednesday, 19 October, 2011 - 11:45 by OpenTKstart inHello,
i want to move the perspective view without transform the graphic object. As you can see on the following pics...
1.

2.

...the object changes it´s position and we can see the side of the cube. Thats not what i want, i want just to move the previewfield, imagine that i have a bigger field-of-view and want to scroll up/down without changing the preview of the object, like this:

I get this effect when i make scaleZ=0. But when i scale the object will lose it´s transformation, like when i zommed in before, the zoom effect get lost.
How can i solve this problem. Sry for my bad english :D
thx


Comments
Re: Perpective View
maybe the orthographic projection would suit your needs.
Re: Perpective View
As avc81 said, the orthographic projection is what you want. What you do not want is the perspective distortion, yet this is exactly what the perspective projection does. Either you use the orthographic projection or you implement an algorithm known from billboarding such that the cube always faces the camera. The first one is the way to go.
Re: Perpective View
Wow thx, thats what i want. But everything is now bigger, how can i zoom. The transformation in x,y-direction works, but not in z-direction...
Re: Perpective View
i implement zoom by means of the Matrix4d.CreateOrthographicOffCenter function
Re: Perpective View
i implement zoom by means of the Matrix4d.CreateOrthographicOffCenter function
And when you want to zoom, you always call this method or do you call MatrixMul. And i dont know how to change the values (left,right,top,bottom) to zoom in and out. I tried a lot but the object just change its form...
Re: Perpective View
every time there is a "zoom action" i recalculate left,right, top, bottom values and then i call that method.
And i dont know how to change the values (left,right,top,bottom) to zoom in and out
Basically a "n0-zoom" scene is given by
while a "zoomfactor-scene" is given by
where zoomfactor must be >0 (just play with this value and see what happens ;))
Hope this helps
Re: Perpective View
...obviously i'm assuming that your entity is centered at 0,0,0
Re: Perpective View
Thx, i got it now.
My second problem now is to fix the object at the mouse while i move it (right, left, top, down). Because the ratio changes in every zoom-position. I move the object by Transformation. I calculated the moveDivFactor based on the screenSize:
like this:
800x1 + 600x2 = 36
800x1 + 800x2= 48
...so i got x1=0 and x2=0,06
however it worked fine but only when i dont zoom
But know when i zoom the proportions change and the object isn´t fixed at the object 1:1 when i move it. Do you have any clue?