Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Question regarding a 3D game engine for lasers

  1. #1
    Join Date
    Jul 2010
    Location
    Netherlands
    Posts
    3,236

    Default Question regarding a 3D game engine for lasers

    I know there are some *but not much* 3D to laser converters.
    also 1 realtime by pangolin.

    Now I'm currently learning how to use openGL properly.
    Together with the constant practicing of 3D modeling and animation
    *there always things to improve, or practice to do specific things faster*.

    Besides that, I heard zoof on LEM talking about a sort opengl for laser, which is very interesting.

    I read direct3D is able to get outlines / silhouettes in a way, *wonders if anyone could make a game injector or a wrapper for that*. Then by removing textures you often get basic colours which allows fairly accurate tracing from a Direct3D application in realtime.

    Now besides that:

    I actually was more referring to OpenGL.
    Since I'm still learning it, my knowledge on OpenGL is still limited.
    But has anyone got any idea how 3D coordinates get passed on to a dac?
    as in coordinates for the scanning x and y?

    I'd like to try and give it a shot to make some OpenGL based 3D games that output to a laser projector
    *Preferably QM2000 and Easylase at the moment.

    !Start reading here if you don't want to read the whole upper text!
    I still need to get familiar with laser programming overall and will do my best to master it

    I'm just wondering how a program gets the right coordinates from something 3D to pass on to the DAC / laser controller

  2. #2
    Join Date
    Feb 2009
    Location
    East Coast of Southern Virginia
    Posts
    402

    Default

    Well that is a very good question.

    This answer is from my knowledge and perspective.

    A laser projector is essentially 2D. You have X and Y. The same for a computer screen.

    I think you would like to know how you take 3D coordinates from 3 dimensions to 2 dimensions right? You simply use a projection which "transforms" the coordinates from 3 dimensions to 2. The wikipedia has a good explanation for it: http://en.wikipedia.org/wiki/3D_projection

    Basically you "map" through a calculation the 3 coordinates onto 2. The perspective projection that wikipedia talks about is a good one although there are other types such as the orthographic projection (the simplest one because it basically just throws the Z away).

    BTW -> The stars screen saver that comes with Windows is a good demonstration of the Perspective Projection. It basically makes random stars with 3D coordinates and then has them advance towards the screen by moving them on the Z axis. With an orthogonal projection it would look like the starts just simply stay put and then disappear. The perspective projection actually adjusts their X and Y coordinates to make it look like you are flying through them.

    So all this assumes that you have 3D coordinates that form lines and such. If your question actually is ... How do I get 3D coordinates out of an OpenGL scene on my computer and display it on my projector? I am sorry that I don't know the answer to that question.

  3. #3
    Join Date
    Jul 2010
    Location
    Netherlands
    Posts
    3,236

    Default

    It partually gives answer to my question yes.

    Getting that coordinates is the other part off course.
    I might leave it for now and get familiar with opengl first.

    I'm still doing C# at the moment, I saw there is Opengl for C#
    however there are multiple things to choose from:
    - Tao
    - SharpGL
    - CsGL <= however I think not CsGL With every sample i need to refresh the screen constantly to either see what's on the screen or having the movement continue.

    I don't know which one to choose.

  4. #4
    Join Date
    Feb 2009
    Location
    East Coast of Southern Virginia
    Posts
    402

    Default

    It might be better in that case to learn the basics of 3D. I would start by making a 3D cube in a window. Since this is laser a wireframe one will work just fine. Then make it rotate at different speeds in different directions... and then maybe with the mouse.

    It doesn't have to be OpenGL or DirectX. You can use the GDI+ to draw lines. Start with an orthogonal projection and then use a perspective projection.

    Basically a list of 3D points. Which you do rotation and then projection math on. Then use the line drawing functions of GDI+ to draw onto the screen.

    Once you can do that, you can add laser support which will be fairly straight forward by making a Laser equivalent of the GDI+ interface.

    Does that sound like a good path?

    Do you program in C++ too?

  5. #5
    Join Date
    Dec 2009
    Location
    Seattle, Wa
    Posts
    413

    Default

    If you are using C# then your best bet is using XNA instead of OpenGL. http://msdn.microsoft.com/en-us/aa937791.aspx

    It's capabilities are fairly advanced and designed to be coded to from C#. OpenGL is great for cross platform development. XNA is quite a bit easier, and there are a ton of tutorials and examples.

    http://www.bing.com/search?setmkt=en-US&q=xna
    http://blogs.msdn.com/b/xna/

    Gamasutra is a great place to learn about 3D development.
    http://www.gamasutra.com/

    Mike

  6. #6
    Join Date
    Jul 2010
    Location
    Netherlands
    Posts
    3,236

    Default

    Thanks

    Also I got GDI+ to work a bit.

    so XNA um well off course there is no XNA to laser yet that I know off.
    I will look into it thanks.

    But how do I get coordinates from for example a cube ?

  7. #7
    Join Date
    Feb 2009
    Location
    East Coast of Southern Virginia
    Posts
    402

    Default

    You make up the coordinates of course.

    Take a square for example listed in X,Y,Z coordinates so you can copy and paste into your program:

    0.0, 0.0, 0.0
    1.0, 0.0, 0.0
    1.0, 1.0, 0.0
    0.0, 1.0, 0.0

    Those are floating point numbers for a square... multiply by your scale (how big you want it) to get your actual size. Also don't forget to go from the last point to the first one.

    Now you can expand that to a cube means that you have 2 squares and each of the four corners are connected along the Z axis. The second square is offset in the Z (+Z is into the screen). I will only list the coordinates for the 2 squares since those are essentially the 8 coordinates needed for a cube.

    0.0, 0.0, 0.0
    1.0, 0.0, 0.0
    1.0, 1.0, 0.0
    0.0, 1.0, 0.0
    0.0, 0.0, 1.0
    1.0, 0.0, 1.0
    1.0, 1.0, 1.0
    0.0, 1.0, 1.0

    Now that we have listed the coordinates for a cube you will want to draw the cube. That is a little different since you have to connect the dots in pairs of coordinates.

    0.0, 0.0, 0.0 -> 1.0, 0.0, 0.0
    1.0, 0.0, 0.0 -> 1.0, 1.0, 0.0
    1.0, 1.0, 0.0 -> 0.0, 1.0, 0.0
    0.0, 1.0, 0.0 -> 0.0, 0.0, 0.0

    0.0, 0.0, 1.0 -> 1.0, 0.0, 1.0
    1.0, 0.0, 1.0 -> 1.0, 1.0, 1.0
    1.0, 1.0, 1.0 -> 0.0, 1.0, 1.0
    0.0, 1.0, 1.0 -> 0.0, 0.0, 1.0

    0.0, 0.0, 0.0 -> 0.0, 0.0, 1.0
    1.0, 0.0, 0.0 -> 1.0, 0.0, 1.0
    1.0, 1.0, 0.0 -> 1.0, 1.0, 1.0
    0.0, 1.0, 0.0 -> 0.0, 1.0, 1.0

    Now that is how you get the coordinates for a cube and how you draw it with lines.

    Keep in mind that you will want to keep the original pre-transformation (Scale, Translation, Rotation, and Perspective) coordinates and always do your transformations on those in the order listed (I think the order is right). Then write it to the screen. So you will have 2 arrays. One for original cube and one for the transformed ready to put on screen cube. If you want to rotate from 45 to 90 degrees start with the original cube and then rotate it 45 degrees display that... then take the original cube and rotate it 90 degrees and display that. If you overwrite your original coordinates you will end up with accumulative error and weird things will happen to your cube.

    Look at wikipedia for the rotation equations. All of the matrix math can be expanded for easier viewing.

  8. #8
    Join Date
    Jul 2010
    Location
    Netherlands
    Posts
    3,236

    Default

    Thanks I consider both of this as real valuable info.
    I will look into it later on tomorrow.

    well I will browse around a bit for information and look at the links on my phone in bed before going to sleep.

    My dad's birthday is tomorrow and I do want to wake him up

  9. #9
    Join Date
    Jul 2010
    Location
    Netherlands
    Posts
    3,236

    Default

    *typing this on my mobile*
    I've carefully read about what you told me and I completely understand ehat you mean.
    I wont have trouble with inserting coordinates i sometimes insert coordinates in 3ds max for a more precise placement along the x y and z-axis.

    Thanks alot, I apreciate the help.
    I will train using XNA a bit.
    Also because i need to wait for my laser projector at the moment I can only do the coordinates at the moment.
    Thats ok, I already looked in code on how laser output works and understand it.

  10. #10
    Join Date
    Jul 2010
    Location
    Netherlands
    Posts
    3,236

    Default

    Finally have XNA installed.

    And yaj my first XNA program:
    Click image for larger version. 

Name:	First-XNA-program.png 
Views:	11 
Size:	195.1 KB 
ID:	22555

    Next step: 3D
    ----------------------------------
    *update 13:13*
    first 3D:
    Click image for larger version. 

Name:	First-XNA-3D-program.png 
Views:	9 
Size:	174.3 KB 
ID:	22556

    --------------------------------
    *Update 15:55*
    first 3D wireframe Landscape
    Click image for larger version. 

Name:	XNA-3D.png 
Views:	17 
Size:	238.3 KB 
ID:	22558

    http://www.facebook.com/v/152331684819390

    ------------------------------------
    *Update 18:39 * (also was downstairs with my family for quite a while*)
    Click image for larger version. 

Name:	XNA-3D-landscape.png 
Views:	6 
Size:	302.0 KB 
ID:	22559
    ---------------------------------------------------------
    *update 22:24*
    First Demo done, has full shading and colouring.. also has coloured wireframe but I switched it off.
    It runs on your GPU and is fully optimized.
    and no It doesn't output to laser yet... =3 But after making a playable shooter or just game then I will.
    The scene in this demo can be rotated with the delete and Page down key
    Click image for larger version. 

Name:	XNA-shading.png 
Views:	9 
Size:	408.4 KB 
ID:	22560

    demo: http://www.mediafire.com/?kvb3nvbnsm36mis

    This one uses the left and right key:
    Coloured wireframe with shading version: http://www.mediafire.com/file/7xebg5...20XNA%203D.zip
    Last edited by masterpj; 12-26-2010 at 16:27.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •