Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

WebGL conways game of Life?!

Discussion in 'WebGL' started by Arowx, Dec 15, 2015.

  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,158
    Found this great WebGL GPU driven version of Conway's Game of Life.

    http://nullprogram.com/blog/2014/06/10/

    Is this possible with Unity to WebGL?

    It looks like the only way of running code on the GPU in Unity is the DirectCompute API which is DX11 dependent?

    Also is it possible in Unity to run a Mandelbrot set on a shader in WebGL.
     
  2. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,633
    Any shader code runs on the GPU. As long as you can write your code in a shader and read the results back from a texture, you can use this. Proper computer shader functionality will probably be added in a future (post 2.0) version of the WebGL spec.

    Yes. See here: http://blogs.unity3d.com/2014/10/07/benchmarking-unity-performance-in-webgl/[/QUOTE]
     
  3. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,158
    Cool have you released the mandelbrot set code, I would be interested to see how it works?

    Found it http://docs.unity3d.com/460/Documentation/Manual/SL-VertexFragmentShaderExamples.html

    OK but does the Unity WebGL shader Model support the features needed to do this?

    I think Unity has limited the WebGL graphics API to OpenGL ES levels.
     
    Last edited: Dec 16, 2015
  4. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,158
  5. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653

    Attached Files:

  6. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,158
    Yes. This works in WebGL but not in the Editor???
     
  7. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,158
    Even forcing the editor into OpenGL mode does not help?

    I can work around it by working in tandem on the HLSL shader in the editor and the GLSL in the build but it's not a great way to work.
     
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,653
    you can have HLSL and GLSL versions as two separate SubShader's in the same Shader. that's what we do.
     
    Arowx likes this.
  9. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    7,158
    Cheers, that should speed things up a bit, but just learning the ropes with shaders.