Search Unity

htmlTexture plugin

Discussion in 'Made With Unity' started by bliprob, May 15, 2007.

  1. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Jasha, I agree with you. As HTML plugin its of course also very nice to have...
     
  2. bliprob

    bliprob

    Joined:
    May 13, 2007
    Posts:
    901
    jashan: you're right, in a lot of ways, an HTML renderer is sort of a portal to anything. Not just a high-scores board or in-game ads, but videos, live two-way streaming, in-game chat, remote desktop or VNC, etc. can be implemented. I mentioned in the WiiMote thread that I used this plugin with a Flash movie to capture mic input and call back to unity with the mic level to support a stupid form of "voice control" for one tech demo.

    iPhone: Assuming that Unity for iPhone supports plugins, I should be able to port this plugin to iPhone. It's mostly Cocoa with a little C shim for Mono to call into. Considering that iPhone development is where I spend a lot of my time these days, I'm sure I'll port it if Unity allows it.
     
  3. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    My guess would be that Unity will allow it (some day), if Apple allows it ;-)
     
  4. azuretttc

    azuretttc

    Joined:
    May 8, 2009
    Posts:
    75
    has the windows version of the htmltextureplugin finished?
     
  5. dansav

    dansav

    Joined:
    Sep 22, 2005
    Posts:
    510
    Why has this not been implemented for the web plugin.
    Even Blink3d had this so it can't be that hard?
    Is it on the todolist for UNity3D?

    Dan
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I think two reasons actually:

    1. Because the plugin size is a primary concern for the webplugin.
    2. It would bind unity against specific browsers to support it or make its webplugin size explode to support 5 browsers with 2-3 different variations (ff2, ff3, ff3.5, ie <= 6, ie > 6, safari, opera, chrome) and do so consistently.

    But would be a nice Pro feature for Unity 3.x
     
  7. baha

    baha

    Joined:
    Nov 2, 2009
    Posts:
    622
    hi, this is great work rob.

    i have a suggestion for the web player support.

    the plugin can be hosted at a server, the webplayer can send the requested URL to the server app, the server captures the image and send it back to the unity webplayer (some optimization techniques can be applied for performance and stream size) then the webplayer renders it as a texture, when the mouse is pressed then the raycast location is sent back to the server and the server applies the changes using the plugin and send the result back to unity.

    in this case no need for attaching the plugin to the webplayer, the only disadvantage is the need to connect with a webserver and the client-server communications overhead.

    i don't know if this can be applied or not with your plugin but i will try to do it.
    ;)
     
  8. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    429
    Does this plugin work with the current version of Unity in the Windows based authoring environment?
     
  9. koichisenada

    koichisenada

    Joined:
    Nov 4, 2009
    Posts:
    10
    let us have the sources to port them into windows compatible version of the plugin, please?
     
  10. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    He mentions that it is cocoa code and that basically can't be ported, it does not exist outside of OSX.

    So you are better off to just write a new plugin from ground up, either basing on the mozilla engine or the webkit
     
  11. nCore

    nCore

    Joined:
    Dec 5, 2009
    Posts:
    5
    Rob, first of all, this is great plugin, which is opening so much doors for developers... simply amazing!

    I have a little question, how to use the htmlTexture_sendJavascript() function?

    There's my piece of code, and obviously I'm doing it wrong:
    Code (csharp):
    1.  
    2. StringBuilder result = new StringBuilder();
    3.  
    and then

    Code (csharp):
    1.  
    2. RaycastHit hit;
    3.         if (Physics.Raycast (Camera.main.ScreenPointToRay(Input.mousePosition), out hit)) {
    4.             int x = width - (int) (hit.textureCoord.x * width);
    5.             int y = height - (int) (hit.textureCoord.y * height);
    6.            
    7.             htmlTexture_sendJavascript( m_Texture.GetInstanceID(), "getTransformData()", result, 512);
    8.             Debug.Log(result.ToString());
    9.         }
    10.  
    may You enlighten me?

    I just want to send getTransformData() js function and get returned string...

    and I'm getting Null in this case...

    Thanks in advance.

    Dave
     
  12. nCore

    nCore

    Joined:
    Dec 5, 2009
    Posts:
    5
    somebody ?

    please help...
     
  13. bliprob

    bliprob

    Joined:
    May 13, 2007
    Posts:
    901
    nCore: Sorry about the delay, I don't get emails from the forum when the thread changes anymore. Email or PM is your bets bet to contact me.

    Not sure what the problem in your code is -- first thing I'd try is placing a semicolon after the function invocation, because I don't think that's optional. Then I'd try simple things like "alert('test');" and "new Date();" to make sure basic communication is working. Then maybe check your own functions in Firebug.
     
  14. bliprob

    bliprob

    Joined:
    May 13, 2007
    Posts:
    901
    Baha: for static pages that would work, but for dynamic pages (i.e. with flash, css transforms, javascript animation, java, etc.) it wouldn't work so well.

    KoichiSenada, Zante: Like with the Wiimote plugin, I'm basically looking for a benefactor to pay for the dev time. I been have contacted by a couple of people about porting the plugin to Windows, but no one has followed through.

    I've added the basic htmlTexture code to the Unity iPhone Enhancement Pack:

    http://forum.unity3d.com/viewtopic.php?p=248317



    Whimsica: I have no idea why Unity doesn't add this to the engine. I've offered my code if they want it -- but it's so trivially small, I can't imagine they would. I'd guess there's concern about (a) the complexity of a cross-platform build and (c) opening a possible vector of attack. And I'd bet this plugin makes the testing matrix become significantly more complex.
     
  15. nCore

    nCore

    Joined:
    Dec 5, 2009
    Posts:
    5
    @bliprob: unfortunately it doesn't work... i tried in many ways... I have Null value, or " "... that's all :/

    would you send me a piece of code, of doing this ?

    thanks in advance, Dave.
     
  16. bliprob

    bliprob

    Joined:
    May 13, 2007
    Posts:
    901
    Dave: here is a chunk of code I use to get the level of the microphone from a Flash movie embedded in an HTML page. The function "reportLevel()" is javascript in the HTML page, and it uses Flash scripting to get the level of the microphone.

    So this is UnityScript -> calling Javascript function -> calling Flash function, returning string -> returning string -> getting string.


    Code (csharp):
    1. public int width = 128;
    2. public int height = 128;
    3. private Texture2D m_Texture;
    4. private string level = "";
    5.  
    6. void Start() {
    7.    m_Texture = new Texture2D (width, height, TextureFormat.ARGB32, false);
    8.    m_Texture.Apply();
    9.    htmlTexture_start(m_Texture.GetInstanceID(), width, height, (Application.dataPath+"/UnityVoice.html"));
    10. }
    11.  
    12. void Update()
    13. {
    14.     StringBuilder s = new StringBuilder(20);
    15.     htmlTexture_sendJavascriptWithReturn( m_Texture.GetInstanceID(), "reportLevel();", s, 20);    
    16.     level = s.ToString();
    17. }
    18.  
    19. void OnGUI ()
    20. {
    21.     GUI.Label(new Rect(10,10,100,20), "Mic Level: " + level);
    22.     int l= 0;
    23.     try { l = Convert.ToInt32(level); }
    24.     catch (Exception e) {}
    25.     int c;
    26.     for (c=0; c<l; c++) GUI.Box(new Rect(c*16,40,15,20),">");
    27. }
    28.  
    29. void OnApplicationQuit()
    30. {
    31.     htmlTexture_stop();
    32. }
    33.  
    The only difference I see is that my code is declaring a length for the StringBuilder in its constructor.
     
  17. nCore

    nCore

    Joined:
    Dec 5, 2009
    Posts:
    5
    And now it works! :)

    And there was one problem ;)

    probably the name of the function

    I had function htmlTexture_sendJavascript, should be htmlTexture_sendJavascriptWithReturn

    It's great ;)

    Thanks again.

    Dave.
     
  18. Deleted User

    Deleted User

    Guest

    Just a quick question - when you render the html texture onto object such as plane, is it interactive? Can you click the links with mouse to navigate, or does it just render the html on object and you can't do anything else?

    Thnx
     
  19. nCore

    nCore

    Joined:
    Dec 5, 2009
    Posts:
    5
    When You render to the object (such as plane) you can only see it's output (rendered html page)...

    if you wanna click and navigate through the pages you should use one of the functions such as htmlTexture_mouseup(), htmlTexture_mousedown(), htmlTexture_mousemoved() or htmlTexture_leftclick(), just like the wiki says:
    htmlTexture_leftclick() = a mousemoved, mousedown, and mouseup

    Cheers, Dave.

    PS. The wiki page: http://www.unifycommunity.com/wiki/index.php?title=HtmlTexturePlugin - there is everything you need to know ;]
     
  20. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Hello

    What a nice plugin. Congratulations Rob, and thank you for sharing it.

    Two questions:

    - If the click sent opens a new browser instance, how can we refer to it?
    Particularly, we want this new instance to be an actual browser window.

    - Therefore, how can we use the "htmlTexture_getURL". When used, we get the following error:

     
  21. slgooding

    slgooding

    Joined:
    Jan 12, 2009
    Posts:
    112
    Yes, I understand that the original code is in Cocoa. Still, having it for reference is much easier than writing from scratch.

    Is there any chance that it will be shared so that someone can take on the task?

    This plugin is awesome and needs to come to Windows :).
     
  22. CrystalVisions

    CrystalVisions

    Joined:
    Sep 11, 2007
    Posts:
    61
    Has anyone tried this plugin in Unity 3.0? I cannot get it to work.
     
  23. deskchicken

    deskchicken

    Joined:
    Oct 10, 2008
    Posts:
    9
    I've tried it with 3.0, and just get a black texture where the image should be. I tried the author's test project as well, same results. Would love to know if anybody's managed to get it working in 3.0
     
  24. bliprob

    bliprob

    Joined:
    May 13, 2007
    Posts:
    901
    I've got a new version underway for 3.0. I've got the new version working for iPhone now, and plan to get it ported to Mac and Windows (yes, Windows, finally!) in time for Unite.

    Some things changed under the hood with 3.0 and the technique the plugin previously used (re-binding the texture in OpenGL behind Unity's back) no longer works. Now texture plugins have to pass back an array of floats and have a script call SetPixels() (which on the iPhone is a show-stopper -- adding a single htmlTexture drops the framerate to 15 fps).

    So yeah, the plan is to get the plugin finished and give out the source at Unite.
     
  25. markis

    markis

    Joined:
    Oct 11, 2010
    Posts:
    51
    OH YEAH! I love it!
     
  26. CrystalVisions

    CrystalVisions

    Joined:
    Sep 11, 2007
    Posts:
    61
    Ideally I would like to use this for iPhone/iPod for a) nicely formatted help systems and b) nicely formatted high scores list
    For such things it just seems easier to write some pretty html and have it viewable than to struggle with the limitations of the GUI system (changing fonts etc)
     
  27. MrBodean

    MrBodean

    Joined:
    Jan 25, 2008
    Posts:
    103
    Did this get released at Unite like planned?

     
  28. PJvG

    PJvG

    Joined:
    Feb 11, 2011
    Posts:
    1
    When will this plugin be ported to Windows?
    I would love to use this.
     
  29. dansav

    dansav

    Joined:
    Sep 22, 2005
    Posts:
    510
    This has so many uses for in-game user interfaces. Potentially you could design a UI in html with your favorite framework and then see it in Unity3d.

    If lack of funding is stalling this project please let us know and maybe we can contribute some funds.

    Dan
     
  30. cemC

    cemC

    Joined:
    Dec 23, 2010
    Posts:
    214
    it seems to be great work but your project link is borken i can not download it.
     
  31. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    261
    This is from March 2008:
    :(
    Wouldn't it be possible to release a preliminary version or something? It would be quite important to the community to have *something* to work with when one is forced to stick to Windows development.
    Or are there other html-to-texture solutions out there by now?

    Thank you very much!
    Regards,
    Wolfram
     
  32. lubo3d

    lubo3d

    Joined:
    Mar 23, 2011
    Posts:
    75
  33. Thunder0ne

    Thunder0ne

    Joined:
    Mar 8, 2009
    Posts:
    23
    I have downloaded this sample project but with Unity 3.5.1 I only see a gray plane.
    The same occurs using the code and the plugin from this link
    http://www.unifycommunity.com/wiki/index.php?title=HtmlTexturePlugin
    I tried with a plane having its own material changed by the script, but I see only a gray plane.
    I have no error at compile time nor at run time.
    Any idea about what to look into?
    Many thanks.
     
    Last edited: May 8, 2012
  34. Xroft666

    Xroft666

    Joined:
    Dec 24, 2010
    Posts:
    24
    the same to me
     
  35. AmasterAmaster

    AmasterAmaster

    Joined:
    Aug 4, 2014
    Posts:
    3
    Is the windows version coming soon? It is already 3 years since the last message of this thread. It sure takes a long time just to make a port of the code to make a web texture script.
     
  36. grobm

    grobm

    Joined:
    Aug 15, 2005
    Posts:
    217
  37. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    awesome!
    ... lol
     
    Last edited: Aug 21, 2015
  38. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
  39. jbarbeau

    jbarbeau

    Joined:
    Dec 21, 2012
    Posts:
    46
    Does this work on Unity for UWP? Where can I get the DLL?
     
  40. grizazeo

    grizazeo

    Joined:
    Aug 28, 2015
    Posts:
    1
    Maybe it's to late but, in my research I found this Unity package, https://powerui.kulestar.com/, that look so good and I hope this can be help you.

    Greetings
     
  41. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    261
    Thanks for the update. But that project seems dead as well: "Last updated: Feb 17th 2018
    Unity versions supported: Unity 2017, Unity 2018"
    Have you tried it? With which Unity version?
     
  42. vijitendra

    vijitendra

    Joined:
    Jan 23, 2016
    Posts:
    6
     
  43. vijitendra

    vijitendra

    Joined:
    Jan 23, 2016
    Posts:
    6
    Hi, Sir
    I want use this plugin in my game,
    i want your help,
    sir please help me.
     
  44. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    335
    hi all :)

    powerui don't workd at all (999+ errors ) in 2020.
    Does anyone have a free web browsing displayer for unity yet ?