Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411482 Posts in 69370 Topics- by 58426 Members - Latest Member: shelton786

April 24, 2024, 12:26:23 AM

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 26186 times)
increpare
Guest
« Reply #40 on: December 02, 2008, 07:13:16 PM »

The horizon and vanishing point are features of the geometry, not intrinsic features of a view.
to my (ex-)geometer ears this sounds rather back-to-front... :D
Logged
Zaphos
Guest
« Reply #41 on: December 02, 2008, 07:24:49 PM »

The horizon and vanishing point are features of the geometry, not intrinsic features of a view.
to my (ex-)geometer ears this sounds rather back-to-front... :D
Hmm, sorry, I guess I should say they're a feature of the geometry and the view!  But the point is a scene can have arbitrarily many, so I don't know what it means for points in the scene to move towards the vanishing point from the algorithmic side of things.
Logged
Farbs
Man
Level 10
*


/Farbs


View Profile WWW
« Reply #42 on: December 02, 2008, 09:25:13 PM »

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

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

Speak up plz.
Logged
agj
Level 10
*****



View Profile WWW
« Reply #43 on: December 02, 2008, 09:32:32 PM »

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)

What you described was planar projection, though; an abstraction and simplification of how the eye actually works. Consider your projection to be on a bubble, instead.

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."

Hmm, yeah, that wasn't very clear on my part, sorry. But still, if you think of the eye as having that 'bubble projection', instead of a planar projection, it makes more sense. I actually don't know the lingo to discuss this with any further specificity, as I have studied little geometry and optics; most of my knowledge is intuitive. I have, nonetheless, thought about and studied (by observation and experimentation) these matters repeated times. Not that it lends any credibility to what I say, but, whatever. :)


Anyway, yeah, I wanna read all that crazy stuff, increpare.
Logged

increpare
Guest
« Reply #44 on: December 02, 2008, 09:35:46 PM »

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

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

Speak up plz.
Oh! I totally forgot to reply.  With a simple mod (changing the 'r' function to rectfill(b,x,0,x+10,480,c);  I was actually waiting until I had binaries (cross-platform, natch) up to talk about this I think ) you could make a basic flatland first person 2d game.  Aaah it's half five.  I have things to do in the morn! aaaaAAAAAHHH. 
« Last Edit: December 02, 2008, 09:41:39 PM by increpare » Logged
GregWS
Level 10
*****


a module, repeatable in any direction and rotation


View Profile
« Reply #45 on: December 02, 2008, 09:41:12 PM »

I take it those are important things by the nature of your "ah."  Well, try to get some sleep man, I find only a couple hours still goes a long way!  Gentleman
Logged
increpare
Guest
« Reply #46 on: December 02, 2008, 09:42:16 PM »

Oh wait, HAH.  I had overwritten the windows binary, but thanks to the .rar package that haowan made me make, I can put the windows version here, and a mac one here (250kb a pop or thereabouts, source in both).

It's not groundbreaking, but...it's something different from the other examples (and makes me feel like I'm keeping my pledge to release something each day this week...).

(nothing important in the morning except the morning ... )
Logged
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #47 on: December 02, 2008, 10:59:46 PM »

I never MADE you make anything! The cheek!

Check it out though guys.

One thing I noticed last night as I was reading Flatland was that in the second edition, the editor notes that one of the many objections to the first edition was that if Flatlanders see in (what to us would be) a horizontal line, then that line necessarily has a thickness, or what to them might be what we know as height, which leds their world a third dimension by default. This suggests that to render Flatland as seen by a native, one would draw a single line across the centre of the screen.

However, the editor goes on to note that just as we see from our individual eyes essentially a 2D version of the 3D world in front of us, and cannot comprehend a fourth dimension, Flatlanders (having flat eyes you understand) see a 1D version of their 2D world and cannot comprehend the third dimension. I believe it is therefore acceptable to fill the display with this representation as the result, although having height, is just as 1-dimensional as the line across the centre, with the additional property of being easier for Spacelanders to visually interpret and also benefiting from not inherently having a height property save for the height of the display itself.
Logged

increpare
Guest
« Reply #48 on: December 02, 2008, 11:13:31 PM »

I never MADE you make anything! The cheek!
Don't make me have to get my chat logs out on you...

Quote
one would draw a single line across the centre of the screen.
which can also be easily-enough...and..I just did...but...hmm...dunno...




*sleep*
Logged
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #49 on: December 02, 2008, 11:17:09 PM »

I never MADE you make anything! The cheek!
Don't make me have to get my chat logs out on you...
Quote
(23:16) increpare:     
nuts to try to experience it?
(23:16) increpare:     
how so?
(23:16) Alex:     
yeah, trying to figure out what you were seeing
(23:16) Alex:     
just by using vertical lines on a screen
(23:16) increpare:     
one sec
(23:16) increpare:     
I'm on windows
(23:16) increpare:     
I can put together a demo in a couple of seconds
(23:17) Alex:     
YOU'D FUCKING BETTER MATE OR I'M COMING UP TO EIRE TO SMASH YER FACE IN
heh okay

Logged

Zaphos
Guest
« Reply #50 on: December 03, 2008, 01:02:20 AM »

Hmm, yeah, that wasn't very clear on my part, sorry. But still, if you think of the eye as having that 'bubble projection', instead of a planar projection, it makes more sense. I actually don't know the lingo to discuss this with any further specificity, as I have studied little geometry and optics; most of my knowledge is intuitive.
Hmm ... I think an ideal pinhole camera conforms exactly to the planar projection model.  Not that those exist, either.

After reading this I thought maybe I could justify rendering curves just by looking at a pinhole camera with a non-ideal pinhole (a circular opening instead of a point), so I drew a diagram for that.  This seems to basically just make everything blurry, and the amount of blur changes in a neat way but the center of the blurriness remains a line if it came from a line.  So, no luck there.

Changing my model of the 'film' inside the eye (I mean, the surface on which the rods and cones are kept) seems unlikely to change things either because my reasoning has not relied on the shape of the film.  I'm just looking at the set of rays from the line to the eye -- or, in the aperture case, the region of eye-space -- since that's where the screen that's intersecting those rays has to be drawn.

I'm too tired to think through the effect of lenses right now ... I'll do that later though Smiley

I have, nonetheless, thought about and studied (by observation and experimentation) these matters repeated times. Not that it lends any credibility to what I say, but, whatever. Smiley
Could you describe any of the experiments?
« Last Edit: December 03, 2008, 01:15:25 AM by Zaphos » Logged
Loren Schmidt
Level 10
*****



View Profile WWW
« Reply #51 on: December 03, 2008, 02:41:57 AM »

For anyone who wants to read Flatland, here's an online edition with all the original illustrations. It's really quite charming.
Flatland
Logged
agj
Level 10
*****



View Profile WWW
« Reply #52 on: December 03, 2008, 11:31:23 AM »

windows version here

This link isn't working for me. :(

I have, nonetheless, thought about and studied (by observation and experimentation) these matters repeated times.
Could you describe any of the experiments?

Not really... I mean, when I say that I've thought about this and all, I mean mostly back when the Nintendo 64 came out and stuff. I was just a kid, I don't remember, mostly just my conclusions. Either way, when I say experiments I mostly mean comparing perspectives in photographs, renders, observing, and that kind of stuff. I think my curiosity was sparked when, in art class, we were asked to take a picture of something and then trace it using a ruler, trying to find a vanishing point, but I discovered that no line was ever straight--I must have been ten years old, heh.

Changing my model of the 'film' inside the eye (I mean, the surface on which the rods and cones are kept) seems unlikely to change things either because my reasoning has not relied on the shape of the film.  I'm just looking at the set of rays from the line to the eye -- or, in the aperture case, the region of eye-space -- since that's where the screen that's intersecting those rays has to be drawn.



That's how the eye seems to work, because the retina is curved. Still, I confess that I have no idea why cameras exhibit the same kind of curvature, though.
Logged

Zaphos
Guest
« Reply #53 on: December 03, 2008, 01:37:53 PM »

Not really... I mean, when I say that I've thought about this and all, I mean mostly back when the Nintendo 64 came out and stuff. I was just a kid, I don't remember, mostly just my conclusions. Either way, when I say experiments I mostly mean comparing perspectives in photographs, renders, observing, and that kind of stuff. I think my curiosity was sparked when, in art class, we were asked to take a picture of something and then trace it using a ruler, trying to find a vanishing point, but I discovered that no line was ever straight--I must have been ten years old, heh.
Hmm ... any idea how you ruled out that being an effect of the lens, and how you translated your observation to ideas on an algorithm for rendering?

Changing my model of the 'film' inside the eye (I mean, the surface on which the rods and cones are kept) seems unlikely to change things either because my reasoning has not relied on the shape of the film.  I'm just looking at the set of rays from the line to the eye -- or, in the aperture case, the region of eye-space -- since that's where the screen that's intersecting those rays has to be drawn.



That's how the eye seems to work, because the retina is curved. Still, I confess that I have no idea why cameras exhibit the same kind of curvature, though.
What I've been talking about though is how to draw the screen to present to the eye, so that it looks as if the object were there.  To do this we follow the ray from each point on the object to the eye, and we see where it intersects the image plane, and that's where we render the point.  That adds this to the diagram:

And you can see when we put the image plane down, the size of the boxes on the plane is the same.
Logged
agj
Level 10
*****



View Profile WWW
« Reply #54 on: December 03, 2008, 08:24:56 PM »

Hmm, yeah, I see what you mean. That makes a lot of sense. Then deformations are produced when the real viewpoint does not match the virtual viewpoint of the in-software camera. I guess that explains it!



Hmm ... any idea how you ruled out that being an effect of the lens, and how you translated your observation to ideas on an algorithm for rendering?

Looks like I didn't!
Logged

Zaphos
Guest
« Reply #55 on: December 03, 2008, 11:38:46 PM »

Hmm, yeah, I see what you mean. That makes a lot of sense. Then deformations are produced when the real viewpoint does not match the virtual viewpoint of the in-software camera. I guess that explains it!
Hooray, we agree Smiley

This also gives a good clue why it'd be most noticeable for video games, I think, as an FPS game has gameplay reasons to cheat and make the FOV too wide!

That makes me think -- an easy perspective to try with the raycaster would be a 360 degree unrolled cylindrical perspective ... that might be pretty fun to play around with.

ALSO: after looking at the code, here is a fix for the issue where one side of the screen bends differently from the other:
Code:
            while(map[int(t/100)][int(s/100)]==0 && c<800){
                c++;
                q=d+(i*0.0174)-0.5585;
                t+=sin(q);
                s+=cos(q);
            }
            c=(10000/c)/cos(i*0.0174-.5585);
I think you still get some bendy walls due to inaccurate depths, but it should be more correct as above?

edit:
and here is what a 360 degree view looks like, assuming I wrote it right:

(and here's the modified source plus windows binary)
« Last Edit: December 04, 2008, 12:01:04 AM by Zaphos » Logged
bateleur
Level 10
*****



View Profile
« Reply #56 on: December 04, 2008, 03:05:22 AM »

Incidentally, for anyone who enjoys the ideas in Flatland, I recommend Planiverse. A rather better attempt at the same concept (no disrespect to Abbot - Dewdney had his work as a starting point).
Logged

agj
Level 10
*****



View Profile WWW
« Reply #57 on: December 04, 2008, 11:17:44 AM »

and here is what a 360 degree view looks like, assuming I wrote it right:

(and here's the modified source plus windows binary)

Oh my god. A game needs to be made with this, soon.

edit: Maybe clicking in a particular 'column' would move the avatar in that direction?
« Last Edit: December 04, 2008, 11:24:54 AM by agj » Logged

increpare
Guest
« Reply #58 on: December 04, 2008, 11:36:10 AM »

edit: Maybe clicking in a particular 'column' would move the avatar in that direction?
hmm; that's an interesting idea...excepting that turning would still have some use insofar as having stuff on the edge of the screen is annoying (the alternative would be to wrap 540ยบ around, say).
Logged
Gold Cray
Level 10
*****


Gold Cray


View Profile WWW
« Reply #59 on: December 04, 2008, 03:37:54 PM »

For anyone who wants to read Flatland, here's an online edition with all the original illustrations. It's really quite charming.
Flatland



Source
Page Up/Down - angle
Right/Left Arrow keys - Forward/Backward
Up/Down Arrow keys - Straight up and down


It's not 3d, but it is raycasting. It loads the file called test.bmp and assume that black is empty space. Perhaps this could use 3d glasses instead of thickness to convey depth and be used for a first person 2d game.
Logged
Pages: 1 2 [3] 4
Print
Jump to:  

Theme orange-lt created by panic