Reply To: Unity issues

Home Forums Syphon Syphon Implementations – User Unity issues Reply To: Unity issues

#4496
vade
Keymaster

There are some issues with Syphon for Unity we are looking at currently. Some of the rendering issues in the server are partially because Unity has various render passes and rendering stages, deferred, back to front and front to back rendering, and depending on lighting render ‘happens’ in different places. Its also a total black box (unless you pay for the source), so that makes it a bit more difficult to deduce the optimal “one size fits all’ solution on where codewise to place servers and clients.

One of the people who has helped with the Unity Syphon port (Brian Chasalow) is going to the Unity conference inMontreal and will be trying to get some more concrete examples. However last night Brian had some issues and has a new script that might be of use client wise, and ill see if we can get it and a clean sample scene committed to SVN soon.

Try this out:

using UnityEngine;
using System.Collections;

 public class makeSyphonClientWork : MonoBehaviour {
 	//ridiculously dumb fix courtesy of brian [at] chasalow [dot] c o m
 	//attach this script to the main camera.
 	//then attach your SyphonClientBridge to whatever objects (plane, etc) you want to receive the texture on.
 	public string infos = "attachToMainCameraPlz!";
	void Start () {
	}

	static Material lineMaterial;
static void CreateLineMaterial() {
    if( !lineMaterial ) {
        lineMaterial = new Material( "Shader "Lines/Colored Blended" {" +
            "SubShader { Pass { " +
            "    Blend SrcAlpha OneMinusSrcAlpha " +
            "    ZWrite Off Cull Off Fog { Mode Off } " +
            "    BindChannels {" +
            "      Bind "vertex", vertex Bind "color", color }" +
            "} } }" );
        lineMaterial.hideFlags = HideFlags.HideAndDontSave;
        lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
    }
}

void OnPostRender() {
    CreateLineMaterial();
    // set the current material
    lineMaterial.SetPass( 0 );
	//    GL.Begin( GL.LINES );
    //GL.Color( new Color(1,1,1,0.5f) );
   // GL.Vertex3( 0, 0, 0 );
  //  GL.End();
} 

}

As for Server issues, ill see if Brian can chime in, I am admittedly a bit out of my element with the nuances of Unity

Server wise