//TickAccumulation rate //if light change then update direct //if scene change then update probes void Update() { //set light direction for shader Light dirlit = FindObjectOfType <Light>(); Vector3 sunny = -dirlit.transform.forward; //boxProject.SetVector("_MainLight",sunny); //DirectLightMat.SetVector("_MainLight",sunny); Shader.SetGlobalVector("_MainLight", sunny); //updates shaders DirectLight.Update(); //LightAccumulation.Update(); //adjust scene hashing origin to mesh bound Mesh m = GIscene[0].GetComponent <MeshFilter>().mesh; Renderer r = GIscene[0].GetComponent <Renderer>(); Bounds b = r.bounds; Shader.SetGlobalVector("_Origin", b.min); //boxProject.SetVector("_Origin",b.min); //Debug.Log(b.min); //Debug.DrawRay(Vector3.zero,Vector3.one*16,Color.red); // const int numSamples = 64; // const float phi = 1.618033988f; // const float gAngle = phi * Mathf.PI * 2.0f; // Vector3 worldNormal = Vector3.up; // for (int i = 0; i < numSamples; i++) // { // float fi = (float)i; // float fiN = fi / numSamples; // float longitude = gAngle * fi; // float latitude = Mathf.Asin(fiN * 2.0f - 1.0f); // Vector3 kernel = new Vector3( // Mathf.Cos(latitude) * Mathf.Cos(longitude), // Mathf.Cos(latitude) * Mathf.Sin(longitude), // Mathf.Sin(latitude) // ); // kernel = (kernel + worldNormal).normalized; // if (i == 0){ // kernel = Vector3.up; // } // Debug.DrawRay(Vector3.zero,kernel*16,Color.red); // //traceResult += ConeTrace(voxelOrigin.xyz, kernel.xyz, worldNormal.xyz); // } }
private void SetDefaultsForSixthLab() { _labBase = new SixthLab(_image); var elements = new IAddable[7]; elements[0] = new AmbientLight(0.2f); elements[1] = new PointLight( new DoublePoint3D(2, 1, 0), 0.6f ); elements[2] = new DirectLight( new DoublePoint3D(1, 4, 4), 0.2f ); elements[3] = new Sphere( new DoublePoint3D(0, -1, 3), 1, new ColorRGB(255, 0, 0), 500, 0.2f, 0f); elements[4] = new Sphere( new DoublePoint3D(2, 0, 4), 1, new ColorRGB(0, 0, 255), 500, 0.3f, 0f); elements[5] = new Sphere( new DoublePoint3D(-2, 0, 4), 1, new ColorRGB(0, 255, 0), 10, 0.4f, 0f); elements[6] = new Sphere( new DoublePoint3D(0, -5001, 0), 5000, new ColorRGB(255, 255, 0), 1000, 0.5f, 0f); /*elements[6] = new Hexahedron( * new DoublePoint3D[] { * new DoublePoint3D(-1, -1, 4), * new DoublePoint3D(-1, 1, 4), * new DoublePoint3D(1, 1, 4), * new DoublePoint3D(1, -1, 4), * new DoublePoint3D(0, 0, 0), * new DoublePoint3D(0, 0, 0), * new DoublePoint3D(0, 0, 0), * new DoublePoint3D(0, 0, 0) * }, * new DoublePoint2D(0, 0), * new ColorRGB(255,0,0), * 1000, * 0f, * 0f * );*/ ElementsLB.Items.AddRange(elements); CameraX.Text = "0"; CameraY.Text = "0"; CameraZ.Text = "0"; CameraXAngleTB.Value = 0; CameraYAngleTB.Value = 0; _labParameters = ParseSixthLabParameters(); (_labParameters as SixthLabParameters).Initial = true; }