Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1382205 Posts in 66019 Topics- by 58435 Members - Latest Member: ahomewki

September 19, 2020, 05:50:19 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Raycaster Rending Examples
Pages: 1 [2] 3 4
Print
Author Topic: Raycaster Rending Examples  (Read 23748 times)
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #20 on: December 01, 2008, 02:15:26 PM »

Seconded, agj. I'd love to see natural curved lines in a 3d game.
It would be fun to play with wide FOV fisheye effects too...

Increpare and Terry, you two need to make a game where you play as an insect with compound eyes, and you have a 360 degree field of view. No wait, you play as a security camera and you have to pick bank robbers out of a crowd. Or maybe it could be a pretentious dream game where you explore your inner landscape to discover the true nature of loss. Oh wait, I know! You're inside a 3d maze, and you have a line that plays out behind you (like a bread crumb trail), and you have to, um, do stuff in the maze...

Sorry, this is exciting. If you guys make something, I'm sure whatever you choose will be great.
Logged
increpare
Guest
« Reply #21 on: December 01, 2008, 02:21:53 PM »

Seconded, agj. I'd love to see natural curved lines in a 3d game.
It would be fun to play with wide FOV fisheye effects too...
dungeon keeper had them Smiley

and...we're working on something right now...
« Last Edit: December 01, 2008, 04:37:38 PM by increpare » Logged
Zaphos
Guest
« Reply #22 on: December 01, 2008, 05:05:00 PM »

I noticed what is likely a glitch, though: walls parallel to one's line of sight that are toward the left of the screen appear properly deformed as by optics (with a 'convex' shape), but the ones toward the right appear with their deformation reversed ('concave'):
I think normally people want a planar projection, where straight lines to remain straight?

That's not how optics work, though.
Hmm ... wouldn't a pinhole camera with a flat film give a planar projection as well?

I guess you just mean that eyes and cameras in practice have curved lenses which add distortion?  I don't have a problem with planar projections, visually, but I guess it's probably true that they're preferred in rendering more for efficiency than for beauty.

edit: actually, as a thought experiment: if you held up a flat piece of glass and held your head very still, and traced the edges of the building on the glass, would straight edges of the building remain straight on the glass?

edit edit: my experiments with a mirror (should be same as a glass, right?) say it's at least indistinguishable from straight to me, in which case planar projection seems like the 'right thing to do' in some sense?

edit edit edit: yeah, actually thinking about it also says this result makes sense, and planar projection is the correct thing to do.  Unless you want to emulate photography, or just play with interesting non-real effects, which is always a fun thing to do!

and...we're working on something right now...
Neat Smiley
« Last Edit: December 01, 2008, 05:57:08 PM by Zaphos » Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #23 on: December 01, 2008, 05:20:47 PM »

and...we're working on something right now...
mysterious...

and I'm very exited!  Grin
Logged
Bennett
Jinky Jonky and the Spell of the Advergamez 3
Level 10
*



View Profile
« Reply #24 on: December 01, 2008, 07:33:38 PM »

You guys should forget making a game and just have a full Montreal-style exhibition!
Logged
agj
Level 10
*****



View Profile WWW
« Reply #25 on: December 01, 2008, 10:07:50 PM »

Zaphos, let me try to prove to you that we see straight lines as curved in practice (this has nothing to do with the curvature of a lens).

Take this diagram, below. Clearly, the distance between the eye and point a is shorter than the distance between the eye and point b, right? And you know, by experience, that the farther something gets, the smaller and closer to the horizon it appears. If you are in the middle of a long, straight highway, looking at a car drive away, it will seem as if it was shrinking and converging into a single point in space (what is usually called the vanishing point).



Now imagine that the two points seen above, a and b, are positioned in this box as shown in the picture, and that the eye is now you, looking at the image. Point b remains farther from your eyes compared to point a.



Therefore, point b should be closer to the horizon than point a, like shown in the picture below, which creates a slight curvature in the lines. The vanishing point, in this case, is the center of the box.

Logged

Zaphos
Guest
« Reply #26 on: December 01, 2008, 10:35:43 PM »

And you know, by experience, that the farther something gets, the smaller and closer to the horizon it appears.
I know that if you take that as an assumption, it's going to give you curved lines; I don't know from experience however that it's reasonable to scale by distance instead of distance projected along the view vector.  In fact the reason it gets smaller and closer to the horizon is because the rays are diverging away from the eye.

So if, as in this diagram, we have rays coming from an eye, and we're deciding how the object a should show up on some window (or computer screen), it's going to get smaller as the object moves away because the intersections between the screen and the rays to object a's endpoints are closer together.


However, if you consider moving object a along the screen, instead of away from it, the object's size on the screen does not change: the intersections between the rays to the object and the screen remain the same distance apart.

This is why you scale the object's apparent size only by distance along the the direction perpendicular to the image plane.

This is a planar projection, one property of it is that straight lines remain straight.
Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #27 on: December 02, 2008, 01:33:02 AM »

OK, you guys seem smart, so why don't you just implement webcam headtracking and be done with all this perspective arguing (it seems like it's become quite easy to implement over the last few months; lots of people seem to be messing with it; just google).  Implementing that will ensure that perspective not only appears correct, but appears 3D because the perspective responds to the location of the player's head in relation to the screen.  It's not really a gimmick in this case, because the player probably wouldn't move their head very much; it's just to ensure that even with minuscule head movements proper perspective is maintained.  And coupled with polarized glasses (not necessarily red/blue) you'd have the total 3D experience, which would make some very simple games very fun, simply because they would feel so much more real.

And although we do technically see curved lines agj, our brain "fixes" that for us.  I guess, then, curved lines may in fact be idea in a headtracking setup because it extends the real world perspective into the screen.
Logged
Zaphos
Guest
« Reply #28 on: December 02, 2008, 01:42:16 AM »

OK, you guys seem smart, so why don't you just implement webcam headtracking and be done with all this perspective arguing (it seems like it's become quite easy to implement over the last few months; lots of people seem to be messing with it; just google).  Implementing that will ensure that perspective not only appears correct, but appears 3D because the perspective responds to the location of the player's head in relation to the screen.  It's not really a gimmick in this case, because the player probably wouldn't move their head very much; it's just to ensure that even with minuscule head movements proper perspective is maintained.  And coupled with polarized glasses (not necessarily red/blue) you'd have the total 3D experience, which would make some very simple games very fun, simply because they would feel so much more real.
Those things don't remove the need to know how to render things correctly in the first place -- head tracking corrects a different issue than the one we're talking about.

And although we do technically see curved lines agj, our brain "fixes" that for us.  I guess, then, curved lines may in fact be idea in a headtracking setup because it extends the real world perspective into the screen.
Seeing curved lines doesn't mean we should curve them in the image we present to the eye; the eye will introduce the curving, so we don't have to.  I'm not sure what you mean by the second sentence.
Logged
brog
Level 7
**



View Profile WWW
« Reply #29 on: December 02, 2008, 01:49:29 AM »

Seeing curved lines doesn't mean we should curve them in the image we present to the eye; the eye will introduce the curving, so we don't have to.

The curving isn't introduced by the eye, but by the object being three-dimensional.  Since we're drawing stuff on a flat screen, to perfectly mimic reality we should curve things in the image.

Also, those raycasters are awesome.
Logged
Zaphos
Guest
« Reply #30 on: December 02, 2008, 02:24:15 AM »

Seeing curved lines doesn't mean we should curve them in the image we present to the eye; the eye will introduce the curving, so we don't have to.

The curving isn't introduced by the eye, but by the object being three-dimensional. 
That's just incorrect.
Logged
bateleur
Level 10
*****



View Profile
« Reply #31 on: December 02, 2008, 09:00:47 AM »

Once we start talking about what causes perception of curvature, language gets in the way a bit. In normal speech, when we say something "is curved" we are talking about its 3D geometry. When we say that a non-digital object in real (3D) space viewed with the naked eye "appears curved", we're already taking into account the way our brain processes visual data before interpreting it.

The statement by brog that "the curving isn't introduced by the eye, but by the object being three-dimensional" is therefore really ambiguous. The 3D object has a straight edge, so the "curve" is not intrinsic to it. We can talk with mathematical precision about the correct appearance of a particular projection of a 3D scene onto a plane. We cannot, however, talk with similar precision about the perceptions of the human eye. And that's true of just one eye, it gets even more complex when we talk about binocular vision.
Logged

Bennett
Jinky Jonky and the Spell of the Advergamez 3
Level 10
*



View Profile
« Reply #32 on: December 02, 2008, 09:26:38 AM »

Yeah, you guys are all talking at cross purposes.

How about this: a projection of a straight line from 3d space to a 2d plane appears curved, because the projection is a solid angle subtended around a point at the center of the focal sphere.  :D
Logged
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #33 on: December 02, 2008, 09:38:10 AM »

increpare, tell them about the flatland stuff we talked about!

dudes you gotta hear this stuff, we had some pretty cool ideas.
Logged

agj
Level 10
*****



View Profile WWW
« Reply #34 on: December 02, 2008, 11:20:33 AM »

And although we do technically see curved lines agj, our brain "fixes" that for us.

Yes, this is true. This is why photographers fix their pictures' perspective to look less curved, because it doesn't look natural otherwise. But if that picture were moving (i.e. any polygonal game), it looks awkward, like the whole geometry is flexing around. This is why, even though the curvature is not assimilated by our brains as easily as when looking at a real, volumetric image, in practice, and in motion, it looks much more natural than straight lines.

The curving isn't introduced by the eye, but by the object being three-dimensional.
That's just incorrect.

It isn't. As in, the screen is three-dimensional, so it does introduce curvature, but it isn't the same curvature that the objects projected on it would show if they were distributed in space. An object further away appears less curved than one very up close to the viewer, because of a simple matter of ratios (between the eye-to-a distance and the eye-to-b distance, if I may use the same example as my diagram before).
Logged

Zaphos
Guest
« Reply #35 on: December 02, 2008, 11:26:10 AM »

How about this: a projection of a straight line from 3d space to a 2d plane appears curved, because the projection is a solid angle subtended around a point at the center of the focal sphere.  :D
I'm not sure I understand what that sentence means ... if you take the set of rays going from a point to a line in space, you get a triangle, and if you intersect that with a plane you get a straight line on the plane?

It isn't. As in, the screen is three-dimensional, so it does introduce curvature, but it isn't the same curvature that the objects projected on it would show if they were distributed in space. An object further away appears less curved than one very up close to the viewer, because of a simple matter of ratios (between the eye-to-a distance and the eye-to-b distance, if I may use the same example as my diagram before).
I don't think that analysis was actually correct though.  (edit: sorry for being terse, but I already explained the correct analysis in an earlier response)
« Last Edit: December 02, 2008, 11:35:08 AM by Zaphos » Logged
Bennett
Jinky Jonky and the Spell of the Advergamez 3
Level 10
*



View Profile
« Reply #36 on: December 02, 2008, 12:53:12 PM »

I'm not sure I understand what that sentence means ... if you take the set of rays going from a point to a line in space, you get a triangle, and if you intersect that with a plane you get a straight line on the plane?

It's not an intersection though, it's a projection.
Logged
Zaphos
Guest
« Reply #37 on: December 02, 2008, 01:28:49 PM »

I'm not sure I understand what that sentence means ... if you take the set of rays going from a point to a line in space, you get a triangle, and if you intersect that with a plane you get a straight line on the plane?

It's not an intersection though, it's a projection.
What's the model for your projection?  A perspective projection is basically that intersection, it's just looking at how the rays of light (that go from the point to the object) intersect the image plane.  Which seems like the logical thing to do, to me.

edit: It sounds like maybe you're thinking about doing a spherical projection and then mapping that projection to a plane?  Not sure how that corresponds to optics though.

edit edit: perhaps you're thinking about map projection, while I'm thinking about 3D projection?
« Last Edit: December 02, 2008, 01:59:37 PM by Zaphos » Logged
Cymon
Level 9
****


Computer Kid


View Profile WWW
« Reply #38 on: December 02, 2008, 02:17:01 PM »

That's why I put this program on Cymon's Games.

I only just got around to checking out your programs and some of them are very cool. Very unfinished swan-like. Your text one reminded me that I wanted to do an ASCII raycaster with PDCurses, but I'd want to have a reason to play it, not just to navigate a maze. Like

.
Logged

Cymon's Games, free source code, tutorials, and a new game every week!
Follow me on twitter
Zaphos
Guest
« Reply #39 on: December 02, 2008, 06:23:59 PM »

Yes, this is true. This is why photographers fix their pictures' perspective to look less curved, because it doesn't look natural otherwise. But if that picture were moving (i.e. any polygonal game), it looks awkward, like the whole geometry is flexing around. This is why, even though the curvature is not assimilated by our brains as easily as when looking at a real, volumetric image, in practice, and in motion, it looks much more natural than straight lines.
Somehow I forgot to respond to this bit -- I think what you're reacting to is just the fov disparity.  If we did head tracking, the computer render (with straight lines) would match what you'd see if you actually just had a window to the physical geometry in place of the monitor.  Curving lines do correspond to the non-planar projection which actually must happen for your fov to change suddenly for a part of your view -- like looking through the lens in a hotel door to see the whole hallway.

Also, perhaps I should explain why I didn't accept the way you're thinking about perspective instead of just saying my way of thinking about things:
Therefore, point b should be closer to the horizon than point a, like shown in the picture below, which creates a slight curvature in the lines. The vanishing point, in this case, is the center of the box.
The horizon and vanishing point are features of the geometry, not intrinsic features of a view.  Since there is not necessarily a single horizon or single vanishing point in an image; it does not make sense to talk about moving b closer to "the horizon" or "the vanishing point."

Instead of starting from a rule of thumb, try to start from basic geometry: model the eye as a point, the image plane as a plane, and light as straight rays, and you should arrive at the perspective model which is ubiquitous in computer graphics.
Logged
Pages: 1 [2] 3 4
Print
Jump to:  

Theme orange-lt created by panic