Is there a way to pre-render a virtual panoramic scene? - algorithm

I would like to put a photorealistic virtual scene on a tablet so when the user rotates the tablet, it shows as if the tablet is a window to an virtual world.
Pre-rendered scenes can be rendered photorealistic, while real-time rendering has a "computer-made look". Given that for one scene, the POV can be rotated but not translated in space, is it possible that a pre-rendered virtual panoramic scene give an immersive impression?
I doubt that this is easy, since rotating the view point will cause some sort of distortion. This kind of distortion is easy for apps like Starwalk, but difficult for photos. Can anyone point me out a direction?
I know that this will be tremendously easy for restricting motion in only one direction, but I would like the user to have a full 3d experience.

You need to either warp the photographs before applying them as textures to your "sky dome" or use non uniform texture coordinates. If done right this will even out most of the distortions giving a more realistic appearance.
Another alternative is to use more photographs so that you are only actually using the central area of each one.

I've found that http://code.google.com/p/panoramagl/ can render cubic, spherical and cylindrical panoramic images, so the problem transforms to how to make render a panorama which can be solved by stitching. I will still leave this answer open to see if anyone else has better answers.

Related

Non rectangular camera matrix

My project combines a projection screen with a head tracking device, where the screen should act as a window through which I could see my virtual "world". Basically, this.
Initially, I thought this would be easy: Map the camera position to the head tracking, have it point towards my window in the virtual world, adjust camera parameters to fit its frustum to the window, and voilà!
Except it doesn't work because I'm viewing the window (both real and virtual) at an angle, so the regular perspective camera doesn't do the trick: If I understand correctly, that camera 'input' is always rectangular, but I need to 'fit' it in a trapezoïd instead.
I think I should be able to achieve that by making my own projection matrix, but I'm a bit lost on how to do that: I have played a bit with basic matrix transforms (translate, scale, rotate), but I have zero experience with more complex stuff (ie perspective).
My best guess for now is trying to deduce the projection matrix from known transformed points (the corners of my window => the corners of the screen) but I feel like it's going to be quite expensive to do that each frame, and that doesn't account for the perspective inside the "window".
thanks for any help!

Light 2D and Performance issues

I want to make a 2D game that will use 2 kinds of lights (Spotlight and Point Light). I need the game to be completly dark unless there is a light in the area and the light to not pass through walls. I tried lots of stuff and plugins to try and make this possible but nothing worked for me.
So I thought I would try to add 3D walls with an Orthographic camera so that I would have the light stop at the walls and cast shadows and make it look 2D at the same time. (Top-down View)
My questions are:
Is there a better way to do this without needing the 3D stuff?
I believe that I will probably have some performance issues if I keep the 3D stuff. Is there a way to fix that since the final output from the orthographic camera is 2D? Like maybe an option to render it as 2D and not having the game process all those triangles? (I want it as light as possible because I also want to port on phones)

Using three.js, how would you project a globe world to a map on the screen?

I am curious about the limits of three.js. The following question is asked mainly as a challenge, not because I actually need the specific knowledge/code right away.
Say you have a game/simulation world model around a sphere geometry representing a planet, like the worlds of the game Populous. The resolution of polygons and textures is sufficient to look smooth when the globe fills the view of an ordinary camera. There are animated macroscopic objects on the surface.
The challenge is to project everything from the model to a global map projection on the screen in real time. The choice of projection is yours, but it must be seamless/continuous, and it must be possible for the user to rotate it, placing any point on the planet surface in the center of the screen. (It is not an option to maintain an alternative model of the world only for visualization.)
There are no limits on the number of cameras etc. allowed, but the performance must be expected to be "realtime", say two-figured FPS or more.
I don't expect ayn proof in the form of a running application (although that would be cool), but some explanation as to how it could be done.
My own initial idea is to place a lot of cameras, in fact one for every pixel in the map projection, around the globe, within a Group object that is attached to some kind of orbit controls (with rotation only), but I expect the number of object culling operations to become a huge performance issue. I am sure there must exist more elegant (and faster) solutions. :-)
why not just use a spherical camera-model (think a 360° camera) and virtually put it in the center of the sphere? So this camera would (if it were physically possible) be wrapped all around the sphere, looking toward the center from all directions.
This camera could be implemented in shaders (instead of the regular projection-matrix) and would produce an equirectangular image of the planet-surface (or in fact any other projection you want, like spherical mercator-projection).
As far as I can tell the vertex-shader can implement any projection you want and it doesn't need to represent a camera that is physically possible. It just needs to produce consistent clip-space coordinates for all vertices. Fragment-Shaders for lighting would still need to operate on the original coordinates, normals etc. but that should be achievable. So the vertex-shader would just need compute (x,y,z) => (phi,theta,r) and go on with that.
Occlusion-culling would need to be disabled, but iirc three.js doesn't do that anyway.

how to limit an image to it's real shape

How can I use an image that whenever I want to make a collision in XNA, it happens only for area of the shape not around of it.
For example when I use below picture, I want collision detection happens only when arrow in shape is touched.
The collision detection happens in the area in this picture
How can I make limitation for area of image only?
What you can do is also to create two rectangles. That makes the overlapping area (the area there the image isn't but the rectangle) a bit smaller. But if you need to do this pixel excact you have to use the recource-expensive per-pixel-collision.
You shouldn't try restricting the image shape, because regardless of your efforts - you will have a rectangle. What you need to do is work with detecting pixel collisions. It is a fairly extensive topic - you can read more about a Windows Phone-specific XNA implementation here.

360 degree photo viewer

I have a photos that is taken by 360 degree lance now does anyone know how to create 360 degree photo viewer ?
please don't send the link of already developed softwares , it would be better if someone has
the road map / example code / articles.
Preferred Technologies Could be
Java/Flash/Flex/HTML 5 / javascript
Well I haven't done it myself yet but it basically boils down to projecting the photos you have to some camera surrounding primitive.
Easiest would be a cube but this will probably result in not so good results especially at the edges and corners. Better would be a sphere on which the images are projected.
But basically, adding 3D-primitives and mapping textures on it should easily be capable with Java or Flash. If you try to program it for browsers, have a look at WebGL. This would be a more future-oriented approach that doesn't need Flash... And it already provides good methods for texture mapping on surfaces.
If by 360° you only mean the horizontal plane you could also use a cylinder, which makes it much easier than projecting on spheres. You'll just need a wide panorama photo that goes around completely and map it to the cylinder.
So basically no matter which primitive you choose you'll need to position your camera within this primitive, project the photos to the primitive and implement some controls that allow the user to rotate the camera freely.
Can you provide any example photos? This would make it easier to find a way to solve your problem and find a good way of projecting the texture...
Hope that helps... if not, keep asking...

Resources