Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Stonemonkey on May 03, 2010

Title: Stereoscopic geometry test
Post by: Stonemonkey on May 03, 2010
Been having a bit of a look at the stereoscopy again and made a basic test to try some things out.

It's source and exe and the colours are for the colorcode glasses from CH4s 3d week but it's easy to alter colours for other glasses and make a few other adjustments for viewing.

Don't expect too much from it though, it's only a wireframe cube moving in and out but I think it is quite effective.
Title: Re: Stereoscopic geometry test
Post by: combatking0 on May 03, 2010
I'll have to get some better celophanes - everything is visible through my blue and yellow filters.

I tried adjusting the colours in the .bas file, but it had no effect.

It looks promising - better than my wire-frame ball test, which I built in Flash ages ago but gave up on. I'll see if I can dig it out.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on May 03, 2010
Even very slight ghosting can destroy the illusion so some sort of filter made for the job is probably best. Tthis is just something I'm trying out to mess around with the geometry without having to worry about anything else although the line drawing is a bit rough and needs some improvement.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on May 03, 2010
Added a solid version to the zip, it's a bit slow here atm but i think it's looking pretty good.

Not so simple to alter the filter colours now though so theres a colorcode sub and a redblue sub.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on May 05, 2010
After playing about with this a bit some things have become apparent, I kind of knew already but this has demonstrated it quite well to me.

If an object is centred in the view both the stereo images show it off centre but when viewed your brain manages to interpret it as being back in the centre, probably so obvious that it's not even really thought about but is handy for understanding how it works.

While the addition of stereoscopy adds a lot to the depth behind the screen giving a lot of scope for object placement the same is not true for in front of the screen. Imagine a pyramid on it's side with the tip at your eye and the base is the screen, that's the available space and if any object isn't entirely inside that pyramid then the illusion suffers a lot, the effect of perspective and closer objects appearing larger adds to this problem. So a lot of care has to be taken when objects are coming out the screen.
Title: Re: Stereoscopic geometry test
Post by: Clyde on May 05, 2010
Finally found my Channel 4 specs and very cool dude.
Title: Re: Stereoscopic geometry test
Post by: Kirl on May 05, 2010
Cool idea, unfortunatly I don't have any colored glasses around anymore. I always wanted to do this with 3d animation software but never actually did it. Doing it with code is much cooler anyway though!
Title: Re: Stereoscopic geometry test
Post by: Kirl on May 21, 2010
I recovered an old pair of RG glasses and I'd like to give this a try too. My recent game BackBack  (http://kirl.nl/bw3.html)
Title: Re: Stereoscopic geometry test
Post by: Jim on May 21, 2010
Fryer's the expert, but you need to cameras slightly apart, and they need to point inwards towards each other slightly so they intersect somewhere in the middle, depending on how far away you want them to focus.
You could also try pointing both cameras at the object of interest, that's kind of how your eyes work when they swivel in their sockets instead of turning your head.
Jim
Title: Re: Stereoscopic geometry test
Post by: bikerboy on May 30, 2010
this is a very interesting effect, i've never seen an anaglyph demo/intro before.

what you should do is to make the yellow line into red ;)

the correct color values for anaglyph imaging are those (bright turquoise) RGB is R-000 G-255 B-255.

and the direct opposite of the bright turquise is R-255 G-000 B-000.

the spacing between the two images/shapes should be approximately the spacing between the human eyes, but you can play around with spacing for the optimal effect.

hope i helped :cheers:
Title: Re: Stereoscopic geometry test
Post by: Kirl on May 31, 2010
I was planning on adjustable colors, so you could even adjust it to the color of your beverage and use your beer to filter out the yellows! :)

However, my problem is backBack is semi-3d and for the pop-out effect to work, I'll need to get both views to cross at a certain point. This would actually require true 3d rotations, around the aproximated eye positions. I initially thought it'd be a quick and easy adjustment by simply offsetting the vanishing point or the geometry for each eye, but failed to realize nothing would ever pop out this way, because the views don't actually cross.

So this has been put off for a little while until I finish some other, slightly more urgent projects. :(
Title: Re: Stereoscopic geometry test
Post by: bikerboy on May 31, 2010
it's seems confusing but it's not ;)

those two links here explaint the methods a lot better than me  :P

and have very nice examples of images and their distance for the left and right eye.

http://en.wikipedia.org/wiki/Stereoscopy

http://en.wikipedia.org/wiki/Anaglyph_image
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on June 03, 2010
I recovered an old pair of RG glasses and I'd like to give this a try too. My recent game BackBack  (http://kirl.nl/bw3.html)

First, this is all just my opinion on this and I may have some of it wrong but I have spent a bit of time on it and it seems to make sense to me even though some of the information I've found online doesn't really agree. In the demo I posted I get quite a good impression of the cubes coming right out the screen and floating somewhere between me and the screen which particularly in movies is something I often have difficulty with especially when there's even slight ghosting so I reckon I'm on the right track. I am of the opinion that any system just using two cameras, real or virtual, will not be quite right

Most of the information I found related to using two cameras with some seperation and either parallel or slight cross over but when I tried that there was always some problems and there were difficulties setting up the camera offsets and the perspective calculations.

So what I'm doing is the transforms to screenspace as usual with the virtual dimensions matching (or somewhere near) real dimensions then instead of the usual perspective I am tracing vectors from every vertex to both eyes and finding the points where they intersect the screen and draw the image using the points for each eye to different buffers then finally combine the buffers. Also, I'm not clipping on the z plane as the objects have to be seen on both sides of the screen but I will have to put it back in in some form (clipping to eyes instead of screen) for more complex scenes.

Because it uses the vertex->eye vectors I think it would work perfectly with headtracking too a long as the actual headtracking was accurate enough.
Title: Re: Stereoscopic geometry test
Post by: Dr_D on July 24, 2010
Heya... I messed around with this a bit a while back. It's pretty fun. I think I need to change the colors in yours for my glasses to work because I have those old style red/blue ones. Anyway, here's the thing I made if you wanna have a look. :p

http://drd.owlbox.net/download.php?id=88


I tried a few things, but where I got the best results was this: Render each eye to a separate image, fudge them over a bit and then blend. So, I moved the left render right by n pixels, and moved the right render left by n pixels.That fudging thing wasn't based on anything except messing around with images in Photoshop. It does seem to look a bit better to me, but that may just be me.
Title: Re: Stereoscopic geometry test
Post by: bikerboy on July 24, 2010
Heya... I messed around with this a bit a while back. It's pretty fun. I think I need to change the colors in yours for my glasses to work because I have those old style red/blue ones. Anyway, here's the thing I made if you wanna have a look. :p

http://drd.owlbox.net/download.php?id=88


I tried a few things, but where I got the best results was this: Render each eye to a separate image, fudge them over a bit and then blend. So, I moved the left render right by n pixels, and moved the right render left by n pixels.That fudging thing wasn't based on anything except messing around with images in Photoshop. It does seem to look a bit better to me, but that may just be me.

that is a very nice effect !! and it would also look awesome as a screen saver  :P
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on October 31, 2010
Been playing around with stereoscopic raytracing, sorry but only colorcode (amber/blue) glasses atm to view this image as it takes ages to draw.
Title: Re: Stereoscopic geometry test
Post by: Dr_D on October 31, 2010
Shit, that's awesome man!
Title: Re: Stereoscopic geometry test
Post by: Clyde on October 31, 2010
Loaded that up in paint shop, wOw!
Title: Re: Stereoscopic geometry test
Post by: ninogenio on November 01, 2010
after checking my bloody valintine 3d's case i realised i havent got the right glasses but thats awsome work fryer as always :).
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on November 01, 2010
That's the magenta and green glasses nino? I'll look into how to filter for those. I'm going to tidy up the code a bit too before I post it as it was just done over the weekend and it's all over the place.

Some very good 3d stuff in my bloody valentine, have you seen resident evil 3d? Some fantastic looking scenes in that too, also went to see pirahna 3d and it was awful, it was shot in 2d then converted to 3d and it doesn't work and just becomes distracting and from what I've heard clash of the titans suffered the same.
Title: Re: Stereoscopic geometry test
Post by: Clyde on November 01, 2010
I almost went to see Clash Of The Titans. And I missed Toy Story 3D :(
Title: Re: Stereoscopic geometry test
Post by: ninogenio on November 01, 2010
yeah thats right fryer magenta and green. i never got a chance to see resi 3d :( im a huge fan aswell played all the games and watched all the movies so i was dissapointed not to have seen it.

i did see scruge 3d with the new clear filter glasses method and it was a huge leap forward.

for some reason all the two toned 3d movies i try on my phillips 47 ambi light just doesnt work it does work on my old tv in the room though.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on November 01, 2010
i did see scruge 3d with the new clear filter glasses method and it was a huge leap forward.
Is that the dolby 3d?

Quote
for some reason all the two toned 3d movies i try on my phillips 47 ambi light just doesnt work it does work on my old tv in the room though.
Do you mean the effect doesn't work? Something was going wrong with some I've tried to play, it looked like either my player or tv was trying to align the 2 channels. Maybe try a different player or switching your tv to game mode or turn off some of the tv's image processing if you can.
Title: Re: Stereoscopic geometry test
Post by: ninogenio on November 02, 2010
sorry ment scrooge 3d :)

not sure what scrooge was. i went to the odieon to see it and got the clear glasses. when you remove the glasses you get the same effect as waking up with a very bad hang over. blurred vision.

Quote
Do you mean the effect doesn't work? Something was going wrong with some I've tried to play, it looked like either my player or tv was trying to align the 2 channels. Maybe try a different player or switching your tv to game mode or turn off some of the tv's image processing if you can.

yeah i bet thats it i have all the image processing switched on for movies and games, i play my movies through the ps3.

im going to have a play around now :).

cheers.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on November 02, 2010
In Dolby 3D, instead of using polarised light, the filters let very narrow bands of precise frequencies of light pass for each of the primary colours, the left and right filters having very slightly differing sets of frequencies. Unlike RealD which needs a silvered screen, Dolby 3D can use a normal screen but the glasses are expensive. I've not seen any movies with it yet and not actually sure if there's any local cinemas that do it, have to look into that.

I think playing through my PS3 was fine, it's possibly the image processing in your tv. I'd try switching to game mode and/or turning off any motion smoothing and stuff like that.

Not that you should be using things like motion smoothing when watching movies anyway, my dad keeps turning it on on his and it makes movies look like Eastenders or The Bill.
Title: Re: Stereoscopic geometry test
Post by: ninogenio on November 02, 2010
yeah i think it was in RealD, i dont think after looking any of my local cinemas do Dolby 3D either.

and it was my tv i tryed lots of diffrent things last night and started getting the 3d effect working. i didnt even realise the tv filtered images that much! and you were right its made a huge difference in normal movie playback also not so like easties :)

the one format i cant wait for is imax 3d. when it finally makes it round my way ill be going to watch just to see how good it is. im not even caring if its a chick flick lol
Title: Re: Stereoscopic geometry test
Post by: ninogenio on November 03, 2010
hey sm,

i was trying to adjust the colors on your solid example last night but i cant really get my head around your color scheme. and was just wondering if you could point me in the direction of changing it to blue/magenta.

cheers.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on November 03, 2010
For a simple solution a couple of things you could try:

red=0
green=green
blue=blue

Or:

red=50% blue
green=50% (original)red + 50% green
blue=50% blue

Or:

flip the image horizontally so left  becomes right then swap the green and blue channels, the image'll be the wrong way round but I think the depth should still be correct.

I'll post the code within the next couple of days so you can mess around with it then.
Title: Re: Stereoscopic geometry test
Post by: ninogenio on November 03, 2010
i meant the example from your first post mate, but i got it working and wow thats some of the best 3d iv seen its much better tham the movies iv seen. i always thought this sort of 3d was a bit pointless but i see it in a new light now! cheers for that.

i also tried what you said on your image i changed the color channels around and again its really really awsome work. i might have a go at 3d myself.

looking at your code it doesnt look too bad too do.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on November 03, 2010
Oops, sorry about that, glad you got it working.

With anaglyph it's not just a matter of making the left channel one colour and the right channel another, the side with two primary colours (magenta=red+blue) can be used to convey quite a bit of colour information while the side with only one colour is more about brightness, there will always be some problems but for something like a demo selection of particular colour schemes could minimise that but that could be tricky if you're going to cater for different types of glasses.

I see quite a lot of potential for 3D in movies and gaming and even though it's nothing new (except the new technology is a vast improvement) it looks like it's going to take a while for it to shrug off the opinion that it's only for the cheesy things jumping out the screen, Avatar and Res Evil are a step in that direction and some of the scenes in My Bloody Valentine were really well done but I think the movie makers are just starting to find out what they can do.
Title: Re: Stereoscopic geometry test
Post by: ninogenio on November 04, 2010
Quote
With anaglyph it's not just a matter of making the left channel one colour and the right channel another, the side with two primary colours (magenta=red+blue) can be used to convey quite a bit of colour information while the side with only one colour is more about brightness.

yeah it took me ages to figuare that out to be able to get the colors right for my glasses.i still have to break it down further to fully get it right in my head, im about 60% there with coloring and i can see whats going on with the projection so i think if i do some basic stuff i can get the basic effect going. im really inpressed that you figuared all that out and got it working as well as it is.

what i did notice with your example was that i was getting the effect much better than my girlfreind, but when changing the brightness and color slightly the opposit was happening. to me it seems like a fine line as to wether someone gets the effect or not, maybe a calibration test before the demo would be good to give the individual the best experiance.


Quote
I see quite a lot of potential for 3D in movies and gaming and even though it's nothing new (except the new technology is a vast improvement) it looks like it's going to take a while for it to shrug off the opinion that it's only for the cheesy things jumping out the screen, Avatar and Res Evil are a step in that direction and some of the scenes in My Bloody Valentine were really well done but I think the movie makers are just starting to find out what they can do.

yeah same here. i cant wait to get the right tv and try out some 3d games and movies at home when it all settles down although iv heard that gt5 doesnt work that well so i just hope sony and others get this right. its only just recently iv started taking a real interest.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on November 04, 2010
To explain how I'm doing the projection onto the screen:

Consider the screen as a rectangular frame within the scene, it stays in exactly the same position for both the left and right eye projections but each eye is looking through that frame from a slightly different angle.
For each vertex you have two vectors, one to each eye (each eye has to have it's own 3D coordinates), and you use the points where those vectors intersect the screen for the left and right eye screen coordinates. That also takes care of perspective.
Title: Re: Stereoscopic geometry test
Post by: ninogenio on November 04, 2010
yeah im sort of in the middle of a small demo trying it out the now. just a spining cube.

iv learned loads so far, i must admit i was off with the projection, mines the now doesnt look right but that makes sense cheers.

iv not done any coloring yet im just trying to get the projection looking right first.
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on November 10, 2010
Sorry, I've not had much time so here's the code for the raytracer as it is.

Code: [Select]
type vec3d
    x as double
    y as double
    z as double
end type

type sphere
   
    union
        coords as vec3d
        type
            x as double
            y as double
            z as double
        end type
    end union
   
    radius as double
    radius2 as double
    radius_recip as double
    min_dist as double
    argb as uinteger
    red as double
    gre as double
    blu as double
    dif as double
    ref as double
    next_sphere as sphere ptr
end type

type world
    first_sphere as sphere ptr
    first_light as sphere ptr
    current_sphere as sphere ptr
    eye as vec3d
    fac as double
    red as double
    gre as double
    blu as double
    ambient as double
end type

sub trace(byref world as world ptr,byval origin as vec3d,byval vec as vec3d)
    dim as sphere ptr sphere=world->first_sphere,current_sphere
    dim as double current_dist=100000,d
    dim as double dist,dx,dy,dz,dtc,lx,ly,lz,s,spec,ca
   
'find closest hit
    while sphere<>0
        if sphere<>world->current_sphere then
            dx=sphere->x-origin.x
            dy=sphere->y-origin.y
            dz=sphere->z-origin.z
            dist=dx*vec.x+dy*vec.y+dz*vec.z
            if dist>0.0 then
                dx-=vec.x*dist
                dy-=vec.y*dist
                dz-=vec.z*dist
                dtc=dx*dx+dy*dy+dz*dz
                if dtc<=sphere->radius2 then
                    d=dist-sqr(sphere->radius2-dtc)
                    if (d>0)and(d<current_dist) then
                        current_sphere=sphere
                        current_dist=d
                    end if
                end if
            end if
        end if
        sphere=sphere->next_sphere
    wend
   
    dim as double vecx,vecy,vecz,sv
    dim as double shadow
   
'if hit found then
    if current_sphere<>0 then
        origin.x+=current_dist*vec.x
        origin.y+=current_dist*vec.y
        origin.z+=current_dist*vec.z
       
        vecx=world->first_light->x-origin.x
        vecy=world->first_light->y-origin.y
        vecz=world->first_light->z-origin.z
        d=1.0/sqr(vecx*vecx+vecy*vecy+vecz*vecz)
        vecx*=d
        vecy*=d
        vecz*=d
        shadow=0
        sphere=world->first_sphere
        sv=1.0
       
'test for shadow
        while (sphere<>0)'and(shadow=0)
            if sphere<>current_sphere then
                dx=sphere->x-origin.x
                dy=sphere->y-origin.y
                dz=sphere->z-origin.z
                dist=dx*vecx+dy*vecy+dz*vecz
                if dist>0.0 then
                    dx-=vecx*dist
                    dy-=vecy*dist
                    dz-=vecz*dist
                    dtc=dx*dx+dy*dy+dz*dz
                    if dtc<=sphere->radius2 then
                        shadow=sqr(dtc)/sphere->radius
                        if shadow<sv then sv=shadow
                    end if
                end if
            end if
            sphere=sphere->next_sphere
        wend

'shade
        sv=sv*sv
        dx=(origin.x-current_sphere->x)*current_sphere->radius_recip
        dy=(origin.y-current_sphere->y)*current_sphere->radius_recip
        dz=(origin.z-current_sphere->z)*current_sphere->radius_recip
        ca=(dx*-vec.x+dy*-vec.y+dz*-vec.z)
        if ca<0.0 then ca=0.0
        lx=world->first_light->x-origin.x
        ly=world->first_light->y-origin.y
        lz=world->first_light->z-origin.z
        d=2.0*(dx*vec.x+dy*vec.y+dz*vec.z)
        vec.x-=dx*d
        vec.y-=dy*d
        vec.z-=dz*d
 
        d=1.0/sqr(lx*lx+ly*ly+lz*lz)
        s=((lx*dx+ly*dy+lz*dz)*d)*ca
        spec=(lx*vec.x+ly*vec.y+lz*vec.z)*d
        if s<0.0 then s=0.0
        spec=(spec-0.8)*5.0
        if spec<0.0 then spec=0.0
        spec=spec*spec*spec*spec*spec*current_sphere->ref
           
        world->red+=(current_sphere->red*s+spec)*world->fac*sv
        world->gre+=(current_sphere->gre*s+spec)*world->fac*sv
        world->blu+=(current_sphere->blu*s+spec)*world->fac*sv
       
        world->fac*=current_sphere->ref
        world->current_sphere=current_sphere
        if world->fac>0.125 then trace(world,origin,vec)
    end if
   
end sub


sub main
   
    screenres 1360,768,32,1
   
    dim as integer wwidth,height
    screeninfo wwidth,height
   
    dim as uinteger ptr buffer(0 to 1)
    buffer(0)=callocate(len(uinteger)*wwidth*height)
    buffer(1)=callocate(len(uinteger)*wwidth*height)
   
    dim as world world
    dim as sphere sphere1,sphere2,sphere3,sphere4,light
    sphere1.radius=150
    sphere1.radius2=sphere1.radius*sphere1.radius
    sphere1.radius_recip=1.0/sphere1.radius
    sphere1.x=210
    sphere1.y=-180.0
    sphere1.z=780.0
    sphere1.ref=0.6
    sphere1.red=rnd
    sphere1.gre=rnd
    sphere1.blu=rnd
   
    sphere2.radius=150
    sphere2.radius2=sphere2.radius*sphere2.radius
    sphere2.radius_recip=1.0/sphere2.radius
    sphere2.x=-20.0
    sphere2.y=-60.0
    sphere2.z=550.0
    sphere2.ref=0.6
    sphere2.red=rnd
    sphere2.gre=rnd
    sphere2.blu=rnd
   
    sphere3.radius=150
    sphere3.radius2=sphere3.radius*sphere3.radius
    sphere3.radius_recip=1.0/sphere3.radius
    sphere3.x=-180.0
    sphere3.y=-60.0
    sphere3.z=-1150.0
    sphere3.ref=0.6
    sphere3.red=rnd
    sphere3.gre=rnd
    sphere3.blu=rnd
   
    sphere4.radius=10000
    sphere4.radius2=sphere4.radius*sphere4.radius
    sphere4.radius_recip=1.0/sphere4.radius
    sphere4.x=2000.0
    sphere4.y=500.0
    sphere4.z=15000.0
    sphere4.ref=0.0
    sphere4.red=rnd*.25
    sphere4.gre=rnd*.25
    sphere4.blu=rnd*.25
   
    dim as sphere floor(0 to 2000)
    dim as integer sc
    for x as integer=0 to 30 step 4
        for y as integer=0 to 60 step 4
            floor(sc).radius=20
            floor(sc).radius2=floor(sc).radius*floor(sc).radius
            floor(sc).radius_recip=1.0/floor(sc).radius
            floor(sc).x=x*30-450
            floor(sc).y=200.0+10.0*sin((x+1.0)/2)*cos(y/1.73)
            floor(sc).z=y*40-800'+z_pos
            floor(sc).ref=0.2
            floor(sc).red=.6+rnd*.2
            floor(sc).gre=.6+rnd*.2
            floor(sc).blu=.2+rnd*.2
            floor(sc).next_sphere=@floor(sc+1)
            sc+=1
        next
    next
   
    light.x=1500
    light.y=-2000
    light.z=-1000
    dim as vec3d v,p
    dim as double d,red,gre,blu
    world.first_sphere=@sphere1
    sphere1.next_sphere=@sphere2
    sphere2.next_sphere=@sphere3
    sphere3.next_sphere=@sphere4
    sphere4.next_sphere=@floor(0)
    world.first_light=@light
    world.ambient=0.2
   
    p.x=-40.0
    p.y=0.0
    p.z=-3000.0
    dim as integer pix,q
for frame as integer=0 to 1
    for y as double=-384 to 383
        for x as double=-680 to 679
            q+=1
            if q=50 then
                'sleep 1
                q=0
            end if
           
            v.x=x-p.x
            v.y=y-p.y
            v.z=-p.z
            d=1.0/sqr(v.x*v.x+v.y*v.y+v.z*v.z)
            v.x*=d
            v.y*=d
            v.z*=d
            world.red=0.0
            world.gre=0.0
            world.blu=0.0
            world.fac=1.0
            world.current_sphere=0
            trace(@world,p,v)
if 1=2 then
            v.x=x+0.5-p.x
            v.y=y-p.y
            v.z=-p.z
            d=1.0/sqr(v.x*v.x+v.y*v.y+v.z*v.z)
            v.x*=d
            v.y*=d
            v.z*=d
            world.fac=1.0
            world.current_sphere=0
            trace(@world,p,v)
            v.x=x-p.x
            v.y=y+0.5-p.y
            v.z=-p.z
            d=1.0/sqr(v.x*v.x+v.y*v.y+v.z*v.z)
            v.x*=d
            v.y*=d
            v.z*=d
            world.fac=1.0
            world.current_sphere=0
            trace(@world,p,v)
            v.x=x+0.5-p.x
            v.y=y+0.5-p.y
            v.z=-p.z
            d=1.0/sqr(v.x*v.x+v.y*v.y+v.z*v.z)
            v.x*=d
            v.y*=d
            v.z*=d
            world.fac=1.0
            world.current_sphere=0
            trace(@world,p,v)
            world.red*=0.25
            world.gre*=0.25
            world.blu*=0.25
endif
            if world.red>1.0 then world.red=1.0
            if world.gre>1.0 then world.gre=1.0
            if world.blu>1.0 then world.blu=1.0
            pset(x+680,y+384),((world.red*255.0)shl 16)or((world.gre*255.0)shl 8)or(world.blu*255.0)
            pix=(x+(wwidth shr 1))+(y+(height shr 1))*wwidth
            *(buffer(frame)+pix)=((world.red*255.0)shl 16)or((world.gre*255.0)shl 8)or(world.blu*255.0)
        next
        sleep 1
    next
    p.x=-p.x
    'p.y=0.0
    'p.z=-1400.0
next
dim as uinteger argb0,argb1,red0,gre0
    for y as integer=0 to height-1
        for x as integer=0 to wwidth-1
            argb0=*(buffer(0)+x+y*wwidth)
            argb1=*(buffer(1)+x+y*wwidth)
           
            argb1=((argb1 and &hff)*178)+(((argb1 shr 8) and &hff)*39)+(((argb1 shr 16) and &hff)*39)
           
            red0=217*((argb0 shr 16)and &hff)+39*(argb0 and &hff)
            gre0=217*((argb0 shr 8)and &hff)+39*(argb0 and &hff)
           
            pset(x,y),(argb1 shr 8) or ((red0 shl 8)and &hff0000) or (gre0 and &hff00)
        next
    next
   
end sub

main

sleep
Title: Re: Stereoscopic geometry test
Post by: Stonemonkey on August 06, 2012
Hi all, got the chance to mess around with this a bit over the weekend.

Press A to cycle through glasses
amber/blue
red/blue (seems to be best for depth)
green/magenta

Press B to switch between light/dark background, light gives best effect though.

The colouring needs some work but I think the 3d effect works pretty well.