Posted: 12th Aug 2003 17:25
Edit: colour now works fine. Fixed by assigning R image both G and B channels.

Getting the idea from the other thread of similar nature and the new Spy Kids movies, anyone with a pair of 3d glasses and DBPro will be able to enjoy the delights of 3d graphics. The effect is totally camera-based, so there's no tinkering with objects to be done.

I'm now going to make a really, really nice fast racing game to go with this!

+ Code Snippet
make object cube 1,10
make object sphere 2,20 : position object 2,0,5,10


` Cameras
set camera to image 0,100,512,512
make camera 1 : set camera to image 1,1,512,512 : color backdrop 1,rgb(0,0,0)
make camera 2 : set camera to image 2,2,512,512 : color backdrop 2,rgb(0,0,0)



` Position cameras correctly
position camera 0,0,0,-30
position camera 1,-0.5,0,-30
position camera 2,0.5,0,-30


` Setup display : R images is used for both G and B channels
sprite 3,0,0,2
sprite 1,0,0,1
sprite 2,0,0,2

set sprite alpha 1,128
set sprite alpha 2,128

size sprite 1,640,480
size sprite 2,640,480
size sprite 3,640,480

set sprite diffuse 1,255,0,0
set sprite diffuse 2,0,0,255
set sprite diffuse 3,0,255,0

draw sprites first

` Main loop
do

text 10,10,"FPS: "+str$(screen fps())


  inc i#,0.5
  yrotate object 1,wrapvalue(i#)
  position camera 0,10,-30 + sin(i#) * 10

  gosub updatecam

  sync
loop

UpdateCam:

  x# = camera position x()
  y# = camera position y()
  z# = camera position z()
  ax# = camera angle x()
  ay# = camera angle y()
  az# = camera angle z()

  position camera 1,x#,y#,z# : rotate camera 1,ax#,ay#,az#
  position camera 2,x#,y#,z# : rotate camera 2,ax#,ay#,az#

  turn camera left 1,90
  move camera 1,0.5
  turn camera right 1,90

  turn camera right 2,90
  move camera 2,0.5
  turn camera left 2,90

return
Posted: 12th Aug 2003 17:37
D'oh "galses" is "glasses" please rich add an edit topic title button!
Posted: 12th Aug 2003 18:19
Nice one! - I've been dying to make a 3D game ever since I was a kid. Now I just gotta find some galsses to go with it . In fact I'm planning a little tech demo, so this will most likely feature in it.

The cool thing is that it's not a huge deal to impliment, I mean you could easily make it an extra option without affecting your game too much.


Van-B
Posted: 12th Aug 2003 18:22
Thanks I was trying to create a "plug-n-play" system - one that would not require every object to have a couple of duplicates.

What I really want to create with this is an extreme g 3 / wipeout sort of game, with lots of speed and fast tracks. And, of course, a VR headset to go with it!
Posted: 12th Aug 2003 18:39
where can I find 3d glasses ? pleease, david, give me yours pleeeease
Posted: 12th Aug 2003 18:54
Go down the newsagents and look for any kiddies magazine - you see them quite often with free posters on Disney magazines etc.

Or you could make your own with the coloured plastic wrappers from a box of quality street. Probably best worn when alone though, otherwise people might consider you for mental rehabilitation.


Van-B
Posted: 12th Aug 2003 19:16
...or you can go and watch the new Spy Kids movie! I got 3 pairs from them! (plus the movie is is ok - really inspires you to create your own game just like it).

Try the demo with the big head from the face demo - that works well too. You'll need to scale the object to 10% though to get it to work.
Posted: 12th Aug 2003 22:52
Nice one

I never though of mixing diffuse and alpha in that way. That's clever
Posted: 12th Aug 2003 23:45
Thanks , did you try it? And did it work?

Has anyone tried it with glasses? Did it work?
Posted: 13th Aug 2003 2:14
WOW! After emptying out a drawer I found 8 pairs of 3d glasses!

Very nice 3D. The colours are exactly the right shade of red and blue so the glasses work properly.

Posted: 13th Aug 2003 5:12
McDonalds has 3d glasses!!!...it comes with a comic book though
Posted: 13th Aug 2003 13:10
Very nice 3D. The colours are exactly the right shade of red and blue so the glasses work properly.


Thank you! Glad to know somebody got it to work. I'm going to be rewriting it now I've figured out how to do it (the code above was crated form a large amount of tesing, so it may not be the most op[timized version).

The code also work with red / green glasses.
Posted: 13th Aug 2003 20:24
Does anyone mind making an .exe of it? I have dbc...
Posted: 13th Aug 2003 21:00
http://www.aozf28.dsl.pipex.com/3dimage.zip There you are
Posted: 13th Aug 2003 22:06
Thx!!! I'll try it as soon as i can find my glasses from sk3
Posted: 13th Aug 2003 22:36
... though knowing my luck with dbp's compatability I won't be surprised if it doesn't work!

I tested mine with the spy kids 3d glasses, so it should work for you.
Posted: 13th Aug 2003 22:58
It was great! This is amazing!!! DO you mind if i were to put this in a game of mine?
Posted: 13th Aug 2003 22:58
When i get pro, that is...
Posted: 13th Aug 2003 23:24
Sure, put it in. It worked best for me when I put a spinning spaceship in, when the nose swung past I could almost touch it!
Posted: 14th Aug 2003 0:06
Probably impossible to do, but i am going to try to create this effect in dbc... Wish me luck...