private void InitRenderingScene()
        {
            if (!d3DImage.IsFrontBufferAvailable)
                return;
            factory = new SceneGraphFactory();
            wpfRenderer = factory.CreateRenderTargetA8R8G8B8Asset();

            /////////////////////////////////////////////////////////////

            cameraAsset = factory.CreateCamera();
            cameraAsset.Perspective(34.0 , (double)RESOLUTION_X / (double)RESOLUTION_Y, Z_NEAR, 0.0);

            targetRenderer = factory.CreateRenderTargetAsset();

            clearTargetBuffer = factory.CreateClearBuffer();
            targetRenderer.SetRoot(clearTargetBuffer);
            clearLayerBuffer = factory.CreateClearBuffer();
            wpfRenderer.SetRoot(clearLayerBuffer);

            TextureLayerNode targetTextureLayer = factory.CreateTextureLayer(targetRenderer);
            targetTextureLayer.MakeParent(clearLayerBuffer);

            effectAssetMesh = factory.CreateEffect("Position.DirectX9.obj.fx");
            effectAssetMesh.SetValue("Time", 1);

            ObjMeshAsset objMeshAsset = factory.CreateObjMesh("bigguy_g.obj");
            drawMockNode = factory.CreateDrawMock();
            drawMockNode.SetMesh(objMeshAsset);
            drawmockTransformNodeFirst = factory.CreateTransform();
            drawmockTransformNodeSecond = factory.CreateTransform();
            drawmockTransformNodeFirst.MakeParent(clearTargetBuffer);
            drawmockTransformNodeSecond.MakeParent(drawmockTransformNodeFirst);
            drawMockNode.MakeParent(drawmockTransformNodeSecond);

            ///////////////////////////////////////////////

            cudaRenderer = factory.CreateCudaRaytraceRenderAsset();
            TextureLayerNode cudaTextureLayer = factory.CreateTextureLayer(cudaRenderer);
            cudaRenderer.SetRoot(drawMockNode);
            cudaTextureLayer.MakeParent(clearLayerBuffer);
            cudaRenderer.SetTextureTarget(4, factory.CreateTextureAsset(targetRenderer));

            ////////////////////////////////////

            effectAssetLayer = factory.CreateEffect("TextureLayerWpf.DirectX9.fx");

            // set the back buffer using the new scene pointer
            sceneIntPtr = (IntPtr)wpfRenderer.GetDirect3D9Surface(0);
            d3DImage.Lock();
            d3DImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, sceneIntPtr);
            d3DImage.Unlock();

            // leverage the Rendering event of WPF's composition target to
            // update the custom D3D scene
            CompositionTarget.Rendering += OnRendering;
        }