Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Unity 3D to Ether-Dream 2 -> Laser output

  1. #1
    Join Date
    Apr 2020
    Posts
    5

    Default Unity 3D to Ether-Dream 2 -> Laser output

    Hi all,


    I would like to connect my Ether-Dream 2 to Unity 3D to output graphics to a laser projection. The only problem is I am quite new to coding (and lasers). I can manage to write basic unity scripts for the graphics but have no idea how or where to begin to control the Ether-Dream API with unity?


    Would this involve building a custom asset or is there a simple script that will allow me to draw shapes and images in c# that can then convert to laser output using the Ether-Dream 2 connected to an ILDA laser?

    Can any of you point me to any pre-made scripts or tutorials? I noticed there was someone on this forum who made a 3D game in Unity with Laser output but I can not find any documentation? However, this is pretty close to what I want to make: https://photonlexicon.com/forums/sho...er-Need-advice


    I would appreciate your help.

    Thanks!

  2. #2
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,292

    Default

    Last time I used Unity four years back it was mono based and I assume it still is. In that case, the best way to interface with the DAC is via straight up networking protocols so that your game will work on PC/MAC and even mobile.
    Creating a asset to do that would mean creating some GameObject that wraps the driver, and accepts frame data. Since Unity is single threaded you will have to be creative with how you handle that so that it doesn't block. There are a lot of implementations of the driver in GitHub so I think this part is relatively simple compared to the rest.

    For the rest of the project, it depends on what you want to display. In the past I considered doing something like you are but never really came up with an interesting idea. Overlaying laser on video seems interesting. Using the physics engine aspects of the game to do something could be fun. If the shapes are simple enough, you could create a game using the game engine and your script code, but instead of attempting to do a straight video/texture to vector conversion, maybe you could take the resulting GameObject coordinates so that you are doing a custom render of each game object and combining them into a frame to send to the laser. If you want 3D then it might be tricky. I don't know if you can use Unity to tell you which parts of the GO are visible so that you don't draw the culled parts.

    If you just want to do edge detection you can do that. If there are not too many objects and there is good contrast in the shapes, the edge detector should give you good results and with a good computer I think you can get near or more than 30fps, depending on complexity. I can offer advice on this as well. The implementation of this I created in Spaghetti for webcam/video works pretty well.

    I'd really love to be involved in trying something like that but I have very little time for it at all. I do know Unity to some extent and I do have an Etherdream. If you would like me to assist or give ideas I would be willing to at least take your code, run it, review it, offer advice, etc. I am fine with an Non Disclosure Agreement, etc, if that makes you happy. You already have my email from our previous communications regarding this (in case you don't know I am the same person).

    If you are just looking for some code to do all of this for you I don't think you will currently find it.

  3. #3
    Join Date
    Apr 2020
    Posts
    5

    Default

    Hi again,


    Thanks for the reply. Right now I am looking for something very simple to connect to Unity. I think just basic shapes and text would be nice to create an interface that I would overlay a laser projection onto a normal LCD projector. I imagine once I can get the basic connection from the Ether-dream to Unity I can make it more elaborate.


    My project is going to be for an art installation. I will probably run it on a PC in a gallery and people can use the game projected on the wall. This is not for anything commercial.


    For me the main problem is getting started with the initial connection and where to go from there. I have never made a Unity asset before or know how to adapt the drivers for the Ether-dream to anything Unity can read. Would you be happy to share the original code from your earlier attempts?


    It would be great to have something to base this on to get me started with the basic connection between the Ether-dream and unity. Also, I imagine this could be a useful Unity asset that I would be happy to share if I could get it working. Also, Thanks for offering to look at my code. I will definitely take you up on it once I get it going.


    Cheers!

  4. #4
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,292

    Default

    Quote Originally Posted by Jsmilt View Post
    Hi again,


    Thanks for the reply. Right now I am looking for something very simple to connect to Unity. I think just basic shapes and text would be nice to create an interface that I would overlay a laser projection onto a normal LCD projector. I imagine once I can get the basic connection from the Ether-dream to Unity I can make it more elaborate.


    My project is going to be for an art installation. I will probably run it on a PC in a gallery and people can use the game projected on the wall. This is not for anything commercial.


    For me the main problem is getting started with the initial connection and where to go from there. I have never made a Unity asset before or know how to adapt the drivers for the Ether-dream to anything Unity can read. Would you be happy to share the original code from your earlier attempts?


    It would be great to have something to base this on to get me started with the basic connection between the Ether-dream and unity. Also, I imagine this could be a useful Unity asset that I would be happy to share if I could get it working. Also, Thanks for offering to look at my code. I will definitely take you up on it once I get it going.


    Cheers!
    I thought about doing this years back but never did. I don't have any code to share. Creating a unity asset is not hard. Basically you create a gameobject that you add to your unity heirarchy. The game object has a method that gets called for every frame. Typically, that is where you would write code to move your gameobject a step or whatever else is expected of it in that time slice. In your case, you would need to examine all of the OTHER game objects of interest to compute a frame of laser vector information and then send that to a thread which in turn sends it to the etherdream interface.

    There are a lot of Unity tutorials on youtube to help you with the fundamentals of unity, if you are new to it. Gameobjects are just C# classes with various functions that get called by the game engine. Each gameobject is attached to a tree so that gameobjects can be parents of other gameobjects. Some are used for rendering. Some are just there as help classes. It's been awhile and I can't remember if there is an object class for non-visual items. You can certainly define helper classes that aren't game objects. Fun stuff!

  5. #5
    Join Date
    Apr 2020
    Posts
    5

    Default

    Quote Originally Posted by JohnYayas View Post
    I thought about doing this years back but never did. I don't have any code to share. Creating a unity asset is not hard. Basically you create a gameobject that you add to your unity heirarchy. The game object has a method that gets called for every frame. Typically, that is where you would write code to move your gameobject a step or whatever else is expected of it in that time slice. In your case, you would need to examine all of the OTHER game objects of interest to compute a frame of laser vector information and then send that to a thread which in turn sends it to the etherdream interface.

    There are a lot of Unity tutorials on youtube to help you with the fundamentals of unity, if you are new to it. Gameobjects are just C# classes with various functions that get called by the game engine. Each gameobject is attached to a tree so that gameobjects can be parents of other gameobjects. Some are used for rendering. Some are just there as help classes. It's been awhile and I can't remember if there is an object class for non-visual items. You can certainly define helper classes that aren't game objects. Fun stuff!
    Thanks. Yes I understand the basics of unity. I have made a few games within the unity engine. There are a lot of great tutorials out there. What I am wondering is this initial connection to the Ether-Dream? For instance, how do write a vector or frame from Unity to be output to the Ether-Dream then to ILDA laser output or a laser vector? There are no tutorials I can find on this and I am unclear about how to implement the code in the Ether-Dream APi? If anyone has any experience with this initial hookup between Unity c# vector to Ether-dream output that would be very helpful. Sorry If I was not clear. I imagine the initial hookup would involve some kind of protocol or dialogue between the Ether and Unity which I cannot figure out?

  6. #6
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,292

    Default

    Quote Originally Posted by Jsmilt View Post
    Thanks. Yes I understand the basics of unity. I have made a few games within the unity engine. There are a lot of great tutorials out there. What I am wondering is this initial connection to the Ether-Dream? For instance, how do write a vector or frame from Unity to be output to the Ether-Dream then to ILDA laser output or a laser vector? There are no tutorials I can find on this and I am unclear about how to implement the code in the Ether-Dream APi? If anyone has any experience with this initial hookup between Unity c# vector to Ether-dream output that would be very helpful. Sorry If I was not clear. I imagine the initial hookup would involve some kind of protocol or dialogue between the Ether and Unity which I cannot figure out?
    Etherdream will take an array of bytes which is XYRGB data. That represents your points. It's generally the other way from what you described. ILDA files are converted to raw XYRGB data and then sent to the DAC. The DAC does the rest although you do have to deal with timing.
    The etherdream code is on github and there are several people who have written interfaces to it using C#, C++, java, etc. You just need to take that code and make it work for you.

  7. #7
    Join Date
    Jul 2010
    Location
    Netherlands
    Posts
    3,314

    Default

    Quote Originally Posted by JohnYayas View Post
    Since Unity is single threaded you will have to be creative with how you handle that so that it doesn't block. There are a lot of implementations of the driver in GitHub so I think this part is relatively simple compared to the rest.
    It indeed used to be the case that unity used the first cpu thread for most things like draw calls and much more.
    However quite a few version back and newer ones this has changed and multi threading has become much better.

    I saw this work some time ago too and tried to reach out and never recieved a response sadly.
    3D to laser conversion is kind of tough.. most of the attempts have seen are using line shaders that are configurable and then center tracing the results of each shader configured object and grabbing the diffuse texture.. however grabbing texture color is a lot slower.

    I'm questioning about the possibility of realtime output going single threaded and multi threading this is even more difficult!

    Nevertheless I recommend delving into shader coding and look at various line renderers.. then you come to the tough part: the centerline tracer which you need to code in C#

  8. #8
    Join Date
    Apr 2020
    Posts
    5

    Default

    Quote Originally Posted by JohnYayas View Post
    Etherdream will take an array of bytes which is XYRGB data. That represents your points. It's generally the other way from what you described. ILDA files are converted to raw XYRGB data and then sent to the DAC. The DAC does the rest although you do have to deal with timing.
    The etherdream code is on github and there are several people who have written interfaces to it using C#, C++, java, etc. You just need to take that code and make it work for you.
    Thanks for your answers,
    At the moment I would be happy to just get a simple line or circle drawn with the laser and xy coordinates from Unity. Then I could more easily make it complicated with shaders and such. @JohnYayas is this the c# library you where thinking: https://github.com/tebjan/VVVV.LaserDAC I cant find any other c# library for the Ether?


    I am a little worried that my lack of c# knowledge could result in me ruining my laser. I will give it a try but I am not sure I understand the code completely to implement it.


    Also, I found this: https://github.com/Blagodetelev/RayComposer using RayComposer so maybe I can try to mash the ether code and this together to get it to work with the Ether-Dream?


    @masterpj I also tried to contact the developer of the star wars unity laser game with no reply. Even offered to buy his asset. It is a shame he wont share.


    Cheers.

  9. #9
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,292

    Default

    Quote Originally Posted by Jsmilt View Post
    Thanks for your answers,
    At the moment I would be happy to just get a simple line or circle drawn with the laser and xy coordinates from Unity. Then I could more easily make it complicated with shaders and such. @JohnYayas is this the c# library you where thinking: https://github.com/tebjan/VVVV.LaserDAC I cant find any other c# library for the Ether?


    I am a little worried that my lack of c# knowledge could result in me ruining my laser. I will give it a try but I am not sure I understand the code completely to implement it.


    Also, I found this: https://github.com/Blagodetelev/RayComposer using RayComposer so maybe I can try to mash the ether code and this together to get it to work with the Ether-Dream?


    @masterpj I also tried to contact the developer of the star wars unity laser game with no reply. Even offered to buy his asset. It is a shame he wont share.


    Cheers.
    I don't have a specific GitHub implementation in mind but the one you referenced won't work because it is just referencing one of the premade DLLs. Here is a raw implementation in typescript.
    https://github.com/Volst/laser-dac/b...c/EtherConn.ts I am not suggesting that you use typescript but you could reference it and port. Also, you could just port the C code from the Etherdream main github repo. Lot's of options but I will leave to you to research. Just dive in and try something. You aren't going to break your laser. I have my own laser show software and have mistakenly put my lasers and galvos through all kinds of hell without any problems. Just turn them off when they start screaming at you.

  10. #10
    Join Date
    Apr 2020
    Posts
    5

    Default

    Quote Originally Posted by JohnYayas View Post
    I don't have a specific GitHub implementation in mind but the one you referenced won't work because it is just referencing one of the premade DLLs. Here is a raw implementation in typescript.
    https://github.com/Volst/laser-dac/b...c/EtherConn.ts I am not suggesting that you use typescript but you could reference it and port. Also, you could just port the C code from the Etherdream main github repo. Lot's of options but I will leave to you to research. Just dive in and try something. You aren't going to break your laser. I have my own laser show software and have mistakenly put my lasers and galvos through all kinds of hell without any problems. Just turn them off when they start screaming at you.

    Hi Thanks for this info. Unfortunately, things got pretty busy on my end and I have not been able to try it out yet. This is starting to make more sense to me though and I am looking forward to playing around. I will definitely send you the code once it is working or if I have some concrete troubles. It is good to know that you have been in a similar position and managed to make some great Laser software! Also, if there are anymore pointers you can think of let me know. Cheers!

Posting Permissions

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