public void TakeScreenshot()
    {
        tracerLayer = gazeTracers[0].layer;
        foreach (GameObject obj in gazeTracers)
        {
            // Change the layer of the Tracer to Default so it can be visible by the camera;
            obj.layer = 0;
        }


        Debug.Log("Gaze Screenshot taken !");
        cameraScreenshot = I360Render.Capture(screenshotResolution, false, myCamera);


        string path = Path.Combine(Application.dataPath, "ScreenGaze.png");

        File.WriteAllBytes(path, cameraScreenshot);

        foreach (GameObject obj in gazeTracers)
        {
            // Change back the layer of the Tracer to be invisible
            obj.layer = tracerLayer;
            Debug.Log(obj.layer);
        }
    }
Example #2
0
    public void SaveImage()
    {
        //z++;
        z += jumpDelta;

        if (z >= zMax)
        {
            z = zMin;
            //y++;
            y += jumpDelta;
        }

        if (y >= yMax)
        {
            y = yMin;
            //x++;
            x += jumpDelta;
        }

        if (x < xMax)
        {
            Invoke("SaveImage", 0.01f); //funciono con 0.005
            string route = url;
            string name  = route + FloatToString(x) + " " + FloatToString(y) + " " + FloatToString(z) + ".jpg";
            camarita.transform.position = new Vector3(x, y, z);
            //Debug.Log("Comienza imagen");
            //le puse false en el último parámetro
            File.WriteAllBytes(name, I360Render.Capture(imageSize, true, camarita.GetComponent <Camera>(), false));
            //Debug.Log("Termina imagen: " + name);
        }
        else
        {
            Debug.Log("termine");
        }
    }
Example #3
0
    private static void Generate360Screenshot()
    {
        int    imageWidth   = 4096;
        bool   saveAsJPEG   = true;
        bool   newFileName  = false;
        int    currentCount = 1;
        string path;

        byte[] bytes = I360Render.Capture(imageWidth, saveAsJPEG);

        if (bytes != null)
        {
            while (!newFileName)
            {
                if (File.Exists("Assets/360Photos/360Render_" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name + "_" + currentCount + (saveAsJPEG ? ".jpeg" : ".png")))
                {
                    currentCount++;
                }

                else
                {
                    path = Path.Combine("Assets/360Photos", "360Render_" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name + "_" + currentCount + (saveAsJPEG ? ".jpeg" : ".png"));
                    File.WriteAllBytes(path, bytes);
                    Debug.Log("360 render saved to " + path);
                    newFileName = true;
                }
            }
        }
    }
        protected void Awake()
        {
            KeyCapture      = new SavedKeyboardShortcut(Config, "Take UI screenshot", "Capture a simple \"as you see it\" screenshot of the game. Not affected by settings for rendered screenshots.", new KeyboardShortcut(KeyCode.F9));
            KeyCaptureAlpha = new SavedKeyboardShortcut(Config, "Take rendered screenshot", null, new KeyboardShortcut(KeyCode.F11));
            KeyCapture360   = new SavedKeyboardShortcut(Config, "Take 360 screenshot", "Captures a 360 screenshot around current camera. The created image is in equirectangular format and can be viewed by most 360 image viewers (e.g. Google Cardboard).", new KeyboardShortcut(KeyCode.F11, KeyCode.LeftControl));
            KeyGui          = new SavedKeyboardShortcut(Config, "Open settings window", null, new KeyboardShortcut(KeyCode.F11, KeyCode.LeftShift));

            ResolutionX = Config.Wrap("Render Output Resolution", "Horizontal", "Horizontal size (width) of rendered screenshots in pixels. Doesn't affect UI and 360 screenshots.", Screen.width);
            ResolutionY = Config.Wrap("Render Output Resolution", "Vertical", "Vertical size (height) of rendered screenshots in pixels. Doesn't affect UI and 360 screenshots.", Screen.height);
            ResolutionX.SettingChanged += (sender, args) => _resolutionXBuffer = ResolutionX.Value.ToString();
            ResolutionY.SettingChanged += (sender, args) => _resolutionYBuffer = ResolutionY.Value.ToString();

            Resolution360 = Config.Wrap("360 Screenshots", "360 screenshot resolution", "Horizontal resolution (width) of 360 degree/panorama screenshots. Decrease if you have issues. WARNING: Memory usage can get VERY high - 4096 needs around 4GB of free RAM/VRAM to create, 8192 will need much more.", 4096);

            DownscalingRate     = Config.Wrap("Render Settings", "Screenshot upsampling ratio", "Capture screenshots in a higher resolution and then downscale them to desired size. Prevents aliasing, perserves small details and gives a smoother result, but takes longer to create.", 2);
            CardDownscalingRate = Config.Wrap("Render Settings", "Card image upsampling ratio", "Capture character card images in a higher resolution and then downscale them to desired size. Prevents aliasing, perserves small details and gives a smoother result, but takes longer to create.", 3);
            CaptureAlpha        = Config.Wrap("Render Settings", "Transparency in rendered screenshots", "Replaces background with transparency in rendered image. Works only if there are no 3D objects covering the background (e.g. the map). Works well in character creator and studio.", true);

            ScreenshotMessage = Config.Wrap("General", "Show messages on screen", "Whether screenshot messages will be displayed on screen. Messages will still be written to the log.", true);

            SceneManager.sceneLoaded += (s, a) => InstallSceenshotHandler();
            InstallSceenshotHandler();

            if (!Directory.Exists(ScreenshotDir))
            {
                Directory.CreateDirectory(ScreenshotDir);
            }

            Hooks.InstallHooks();

            I360Render.Init();
        }
Example #5
0
        void TakePhoto()
        {
            var go = Fsm.GetOwnerDefaultTarget(camera);

            if (go == null)
            {
                return;
            }

            if (imageWidth.Value < 1)
            {
                return;
            }

            if (_camera == null)
            {
                Debug.LogError("Playmaker error: No camera component for 360 screen shot found on " + go.name);
                return;
            }

            // take a photo
            byte[] bytes = I360Render.Capture(imageWidth.Value, useJPEG.Value, _camera);
            if (bytes != null)
            {
                string path = Path.Combine(Application.persistentDataPath, photoSaveName + (useJPEG.Value ? ".jpeg" : ".png"));
                File.WriteAllBytes(path, bytes);
                Debug.Log("360 render saved to " + path);
            }
        }
Example #6
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         byte[] bytes = I360Render.Capture(imageWidth, saveAsJPEG);
         if (bytes != null)
         {
             string path = Path.Combine(Application.persistentDataPath, "360render" + (saveAsJPEG ? ".jpeg" : ".png"));
             File.WriteAllBytes(path, bytes);
             Debug.Log("360 render saved to " + path);
         }
     }
 }
    // パノラマでキャプチャしてSkyBoxに割り当てる
    public void Capture()
    {
        byte[] bytes = I360Render.Capture(imageWidth, false);
        if (bytes != null)
        {
            Debug.Log("Capture 360");

            skyboxBaseTexture.LoadImage(bytes);
            customSkybox.material.mainTexture = skyboxBaseTexture;
            customSkybox.material.SetInt("_Rotation", Mathf.RoundToInt(-cameraObj.transform.localRotation.eulerAngles.y + 90));

            SkyboxEnable(true);
        }
    }
        private IEnumerator Take360Screenshot()
        {
            yield return(new WaitForEndOfFrame());

            try
            {
                var filename = GetUniqueFilename();
                File.WriteAllBytes(filename, I360Render.Capture(Resolution360.Value, false));

                Utils.Sound.Play(SystemSE.photo);
                Logger.Log(ScreenshotMessage.Value ? LogLevel.Message : LogLevel.Info, $"360 screenshot saved to {filename}");
            }
            catch (Exception e)
            {
                Logger.Log(LogLevel.Message | LogLevel.Error, "Failed to take a 360 screenshot - " + e.Message);
                Logger.Log(LogLevel.Error, e.StackTrace);
            }
        }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        int  imageWidth = 1024;
        bool saveAsJPEG = true;

        if (Input.GetKeyDown(KeyCode.P))
        {
            Debug.Log("360 SCREENSHOT");

            byte[] bytes = I360Render.Capture(imageWidth, saveAsJPEG);
            if (bytes != null)
            {
                string path = Path.Combine(Application.persistentDataPath, "360render" + cptScreen + (saveAsJPEG ? ".jpeg" : ".png"));
                File.WriteAllBytes(path, bytes);
                Debug.Log("360 render saved to " + path);

                cptScreen++;
            }
        }
    }