Author Topic: Has anyone ever seen a game rendered in curvilinear projection?  (Read 10532 times)

0 Members and 1 Guest are viewing this topic.

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile


I've always wanted to make one of those pseudo 3D dungeon crawlers in curvilinear perspective. We all have seen games done in 3D (aka 3 vanishing points perspective). I just wonder if anyone has attempted a curvilinear viewing port. It is more realistic than what we commonly call 3d today. Something to do with the human eye seeing lines as slight curves. perhaps this is in the wrong forum my appologies if it is.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
If you can come up with an equation for the perspective calculation (instead of just dividing by z), then it could probably be done in a vertex shader...
I seem to remember experimenting by dividing by distance to the camera, rather than distance to the projection plane.
Or do you mean something else?

Jim
Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Using the distance to the camera idea might work. I'm not totally sure of the algorithm but the image takes on a spherical appearance. I'm not totally sure how you would tell the graphics processor to draw curved cubes rather than strait ones. In the art world it may be called 5 point perspective. The problem is that all strait lines become curved as they do in a human's eyes. The effect looks like a very wide angle lens.

Here is an example:
http://www.bodhitree.com/gallery/bookstore/images.large/fisheye.side.room.1970.132.jpg

I think it would be very cool to go through a maze with that kind of distortion going on.
« Last Edit: November 28, 2007 by Pixel_Outlaw »
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
I wouldnt go that route for a game as that is how our eyes see images but those images make no sense until our brains interpret what the eye is seeing. our brains correct for this lensing effect so that we see straight lines as straight lines. I know its a neet effect but it is disorientating. So for a game its maybe not so good but for a demo it would be a great effect

Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
It would be realistic if you were able to use a less severe bend in the view. If you look at where a wall meets a ceiling you will notice a slight bend towards the sides of your perepheral vision. The image I have shown is really not the best image.
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
If you like the effect then go for it man, I had some similar effects with my early raycasters but only in one axis. I liked it but its easy to correct so now I use a camera plane. I have a feeling that you have done some research into technical draughtsmanship where there really are vanishing points but raycasting is faster and easier to implement. the vanishing point dont really exist in a raycaster its an illusion but i think it could be done. do you have routines for intersecting lines?

Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Just quickly tried using the distance instead of z for the perspective and here's the result (some bugs with clipping and stuff), no idea how to go about drawing triangles with curved edges or how z could be interpolated across them.

Fryer.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
You don't draw tri's with curved edges, you just subdivide them.
Nice image!
Jim
Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
That is pretty badass!

Are you using software rendering?

EDIT: I see that I have not seen some questions.

I've been an artist all my life. I started drawing very young then in about 5th grade I started learning to draw in perspective thanks to a show for kids called Imagination Station with Mark Kistler. LINK( http://www.draw3d.com/ ) In middle school I taught my art teacher about higher vanishing point perspectives (most art classes stop at 2 or 3 point). In later middle school I had my first taste of drafting in Oblique,Isometric and Orthographic projections. I was instantly hooked. I've been programming for about 5 or 6 years and started in the lowly "Game Maker". I feel the program did more damage than good for my learning. I now code in Blitzmax which is still a fairly high level language. In high school I started CAD. It was magic. I graduated top of my drafting class and taught a "green" drafting teacher many tricks and techniques. He would often hand the class over to me and I would go around helping. I'm not trying to come across as arrogant but I had been doing 3D drafting about 2 years prior. I had purchased TurboCAD and had made many small plans for friends family and personal interest. AutoCAD was fairly similar to TurboCAD so it became a matter of learning commands.

Why do I like graphic programming?
It is the intersection of art and mathematics. The artist seeks to express themselves and the mathematician seeks to discover new theories and define formula. Drafting is the expression of the artist confined within the arena of mathematics. I'm constantly at odds with artists who don't want to spill math in their art, but constantly wonder how to draw something.

That said I'm not nearly as educated in programming as I am in art. You guys are light years ahead of me in coding and finding algorithms.
« Last Edit: November 28, 2007 by Pixel_Outlaw »
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
yep, it's software. I'm not sure if or how you could get hardware to calculate the perspective like that but you could do that with software and have the hardware draw the triangles. Maybe someone else'll know.

Fryer.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Quote
Why do I like graphic programming?
It is the intersection of art and mathematics. The artist seeks to express themselves and the mathematician seeks to discover new theories and define formula
Excellent summary, that really nails it for me too.  I guess there's some perverse pleasure in animating all those technical drawing classes.

Quote
I'm not sure if or how you could get hardware to calculate the perspective like that
I'm pretty sure this would be simple with a vertex shader. Taj will know for positive.

Jim
Challenge Trophies Won:

Offline staticgerbil

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 8
    • View Profile
This doesn't really help / explain anything but they did this in ea's skate.

It looks very cool.  They only do it very slightly though but it is quite noticable on things like light poles.

That game is awsome by the way if you haven't played it :)

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile

Quote
I'm not sure if or how you could get hardware to calculate the perspective like that
I'm pretty sure this would be simple with a vertex shader. Taj will know for positive.

Jim


Lunchtime! OK, first off check out this demo by FR. It has an interactive bit at the end you can use to explore the perspective using the mouse.
http://www.pouet.net/prod.php?which=27000

It uses polar mapping, a variation on your fish-eye distortion. Although they don't provide shaders, I'm pretty sure of what they are doing. The distortion would be done like this:
Pass 1:
1. Render the scene to texture using FBOs or render to back buffer and copy into texture
Pass 2:
2. Bind the texture you just created.
3. Enable a shader to do the distortion
      - this is a pixel shader, it reads from the texture.
      - the texel it reads depends on screen position *and* a distort equation
4. Draw a full screen quad

If you look closely you can see at the top and bottom of the demo from FR this is what they are doing. You can see the texels being stretched - there is no geometry distortion here. Using a vertex shader to distort triangles will only work if the triangles are very small and even then I mean in screen space, not world space which is incredibly hard to guarantee.

This seems like it shouldn't work because you can't use Z when you do pass 2. Although I can't prove this, I will offer justification why you dont need Z in pass 2. In essence Pass 1, normal rendering, projects a point in space into the screen depending on its Z co-ordinate. In other words the image after pass 1 has the Z "encoded" in it simply by the pixels that things project to. You then, in pass 2 , are applying a transformation of this Z to get a different perspective simply by mapping the pixels in the first image to the second image with the distortion equation.

Its essentially an oldskool lens effect!

Taj


Challenge Trophies Won:

Offline DruggedBunny

  • ZX 81
  • *
  • Posts: 8
  • Karma: 2
    • View Profile
Just popping out of lurk mode since nobody's mentioned Fisheye Quake!

http://strlen.com/gfxengine/fisheyequake/

You need the Windows version of Quake installed to try it...

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
You need the Windows version of Quake installed to try it...

Seriously check that link, I had no idea that people could use this type of modification to cheat at a game like quake.. Apparently it is possible to use fisheye view to see behind you.

Even the examples given made me feel kind of sick to look at tbh.

Maybe this type of effect would have to be implimented quite carefully top avoid it causing motion sickness.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
I think the effect would be more natural if the programmer used something like 180 degrees of view not the shown 360. Basically, I think the effect could look quite natural given the proper parameters. Not really a forced fish eye but something that hinted at slightly curved lines. The target goal would not be 360 degree vision but just a hint of linear distortion. I think the curvature of the lens would be flatter for this effect. I suppose a flatter shape would bend the light rays a bit less but this is untested speculation on my part.
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
A fairly simple way to achieve that sort of effect that comes to mind would be to render to a texture with a wide angle view then fill the screen with a load of tris with slight distortion of the texture coordinates.

Fryer.

Offline Pixel_Outlaw

  • Pentium
  • *****
  • Posts: 1382
  • Karma: 83
    • View Profile
Gentilemen, I must eat my hat. The answer came on my forum in my favorite flavor of genre.

You can't probably see the attachment unless you are a member sadly...
http://www.shmup-dev.com/forum/index.php?topic=1467.0
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
You can't probably see the attachment unless you are a member sadly...
http://www.shmup-dev.com/forum/index.php?topic=1467.0

A good reason to register :)
Shockwave ^ Codigos
Challenge Trophies Won: