Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Runtime generation of Substance textures on theWebGL platform

Discussion in 'General Discussion' started by idrug, May 1, 2014.

  1. idrug

    idrug

    Joined:
    Sep 18, 2013
    Posts:
    2
    What about the runtime generation of Substance textures on the WebGL platform? I understand it will not be possible in the early access version, but should we expect it to be available in the 5.x cycle? Thanks for any info :)
     
  2. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I can't really be much help there sorry but but I do have my own question about Unity's webgl implementation that i may as well throw in here to save forum space. Is cross domain policy still an absolute pain in the arse? If it's still as obnoxious as it was when I last used webgl are there now tiny, suitable, proxys for changing headers available for this task available after I failed in writing one in both php and python and iirc several other server side languages. Are there more elegant methods now?

    This problem ruined a perfectly good project that could have turned into a nice library for javascript for dealing with text in WebGL, including all the functionality you expect from text on the web, even inserting images like animated gifs. So yeah i'd def like to know if that's no longer a problem when using WebGL - I don't see webGL as just a way to get your stuff running on web browsers. It increases Unity's scope enormously and I wouldn't just use WebGL for publishing games on other targets verbatim.. too much really amazing stuff to be done with webgl for any of that
     
  3. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Copy-pasting my comment from the blog post:
    Substance support should definitely be possible on WebGL. For this, we are dependent on Allegorithmic porting Substance to WebGL, so it is outside of our hands a bit, but I’d be surprised if we would not have this working eventually.
     
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Cross domain access of resources in WebGL is managed by the CORS mechanism. See more here.
     
  5. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Well i figured my post would have made it clear I was aware of CORS, there was just only slivers of documentation when i was doing it with nothing particularly helpful coming from mozilla and none of the code I could find working on the hosts I had or the language that would work i couldnt figure out the code for adding the necessary headers for access-control-allow-origin i think it was. Anyways however, there's some helpful links there (weren't there 2 years ago)so thankyou.

    The project I was working on involved reading a chatroom network i liked's DOM and turning it into a 3D environment with webgl, was very fancy, CORS didnt like me trying to get the images for the emotes though. Thought that might be relevant for unity
     
  6. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    It is relevant, as you would still need the same setup to get resources from other hosts as without Unity - that is mandated by the platform, and not something we can change. CORS should not be all that difficult to set up, but you do need access to the web server configuration to set it up it to send the right reply headers (unlike the cross-domain setup used in Unity's web player, which only requires putting an xml file on the server).
     
  7. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I think it's something that will probably come up a lot as WebGL use catches on then, it drove me completely mad at the time and it wasn't hugely obvious what the problem was or how to fix it - hence my comments about my failed attempts to write little proxies that would add the headers in php and python (i think node,js too or something like that, i cant remember that much about the whole mess). It was a bit of a black art at the time with those who did know how to fix it hosting their own proxy and their quota being bombed straight away.

    It probably wasn't a real problem for an adept web coder but WebGL wasn't exactly big news back then thanks to ms and CORS anyway but yes it might be worth putting in the documentation or somewhere obvious something about CORS, I really don't think i'll be the only person to think the idea of dynamically grabbing textures from places on the web is a neat idea