fisheye view: cubemap or single image distortion ?
category: general [glöplog]
Hi all,
I've been thinking about this for quite a while since I saw a couple of demos from Farbrausch and Fairlight featuring very good fisheye view rendering.
I know that they render into a cube and then do some pixel shader magic.
I was wondering what is the effect if you can only render into a single texture (render the scene as normal, without the side "panels"). It is possible ? how much worst will it be ? Anyone that has tried it ?
Yes it's possible, but you need to render to a very very big texture for that to work, so the cube-map is generally faster if you're pixel-shader bound.
If your scene is highly tesselated, you could imagine reducing the size of that "very very big texture" by doing some fish eye hoolahoops in the vertex shader... i guess. If your life really depends on escaping the cubemap, that is.
In DX10, you can render to all of the cube-map faces in one pass. That kind of solves the 6x draw-call overhead problem.
lets say there is no way of cubemap rendering and no vertex shader bending path. No fisheye view then ? :-(
well in such a system i assume the video memory (and even the system memory) is limited. in that case, if you can't cover a decent portion of the framebuffer i guess it is quite unlikely.
Render scene to texture, render texture on lens-shaped mesh.. fish eye.
Of course, where the image is distorted a lot, it will be very stretched and blurry so you need to pump the res up a lot. And you'll only want the centre of the image, as the sides + bottom will be very curved and you don't normally want to see the missing part..
Of course, where the image is distorted a lot, it will be very stretched and blurry so you need to pump the res up a lot. And you'll only want the centre of the image, as the sides + bottom will be very curved and you don't normally want to see the missing part..
psonice won't that expose the image to the problem of map projection? despite the fact that all of them distort the texture, cubemap somehow sounds healthier.
Well, you can always get your FOV up to almost 180 degrees (no 360 tho, sorry) and render into a planar texture followed by a pass that applies the fisheye distortion, but as kusma said, that texture has to be very big (at least 2 times bigger than the screen I presume) if you want it to look any good.
you can render to a bigger 2d texture and post distort it but a) you need a big texture and b) it limits the amount of distortion a lot. doesnt look too cool.
you can do fisheye in the vertexshader as hyde said, but you need a highly - and consistently - tessellated scene for that to work.
you dont necessarily need all the faces of the cubemap for it to work btw. and of course you can visibility cull per face. and hey, who said at what stage you have to do the lighting and so on? (deferred..) :)
you can do fisheye in the vertexshader as hyde said, but you need a highly - and consistently - tessellated scene for that to work.
you dont necessarily need all the faces of the cubemap for it to work btw. and of course you can visibility cull per face. and hey, who said at what stage you have to do the lighting and so on? (deferred..) :)
psonice: Render scene to texture, render texture on lens-shaped mesh.. WORLD's UGLIEST fish eye.
smash: it's passable, if you can't do it any other way. But looking back, it seems navis wasn't suggesting doing it without shaders at all, just vertex shaders, so yeah not recommended :)
psonice: no, it's butt ugly. :)
Navis, it should depend on the angle. If you just want the curvature effect and not a very big angle, then maybe one texture is enough. If you want near 180 or more, cube mapping looks needed.
... or you render two almost-180° views into two fucking big textures and do a bit of pixel shader blending magic to put them back together, not caring about the seams. Then again, the seams you don't care about are always in the same places of the screen, so it might look ugly.
render-to-texture, draw fullscreenquad with it + mapping to polar coords and other faking math in pixelshader = super hacked, super ugly?
Do you need a _perfect_ fisheye? Or just something similar?
Do you need a _perfect_ fisheye? Or just something similar?
kb... I don't really understand your 2 almost 180 but...
Maybe with 2 textures, one near 180º and other with a lower angle, one for the borders and other for the inside of the screen... it might be a good solution...
Maybe with 2 textures, one near 180º and other with a lower angle, one for the borders and other for the inside of the screen... it might be a good solution...
I wonder if there is an online image of what it looks like in all these cases
Navis, I believe so... don't you remember the images of the fish-eye quake?
Ups... memory confusion... it doesn't show different methods, only cube-map, sorry
kb: dual parabaloid, yes?
smash: I'm note sure if it's exactly dual paraboloid what I was describing but very related, yes :)
I was basically thinking of this rather:
Navis, that looks like a 90/100 angle... I'm pretty sure that it can be done reasonably good with one texture, just a bit bigger than the final output.
http://strlen.com/gfxengine/fisheyequake/compare.html
http://strlen.com/gfxengine/fisheyequake/compare.html
FOV = 1000 ftw ;)