private void SetShaderParameters() { _cameraSettings.SetData(tracingShader); tracingShader.SetInt("_SPPS", spps); tracingShader.SetTexture(0, "_SkyboxTexture", skyboxTex); tracingShader.SetFloat("_Seed", Random.value); for (int i = 0; i < _theScene.diffuseTextures.Count; i++) { tracingShader.SetTexture(0, string.Format("_Texture{0}", i), _theScene.diffuseTextures[i]); } Vector3 l = sun.transform.forward; tracingShader.SetVector("_DirectionalLight", new Vector4(l.x, l.y, l.z, sun.intensity)); // bvh data SetComputeBuffer("_BVHNodes", _nodesBuffer); SetComputeBuffer("_BVHWoopTris", _woopTrisBuffer); SetComputeBuffer("_BVHTriIndices", _triIndicesBuffer); // scene raw data // per vertex SetComputeBuffer("_Vertices", _verticesBuffer); SetComputeBuffer("_Normals", _normalsBuffer); SetComputeBuffer("_UV0s", _uv0sBuffer); // per triangle SetComputeBuffer("_Triangles", _trianglesBuffer); SetComputeBuffer("_MatUbers", _materialsBuffer); SetComputeBuffer("_MatIndices", _matIdxBuffer); tracingShader.SetTexture(0, "_DiffuseTextures", _diffuseTextures); }