Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Android] WebCamTexture.requestedFPS not working

Discussion in 'Scripting' started by friuns3, Feb 25, 2016.

  1. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    hi i created WebCamTexture with 10 fps but it still unity is processing camera every update frame, why is that?

    Code (CSharp):
    1. w1 = new WebCamTexture(_cameraTargetWidth, _cameraTargetHeight, 10);
    2. w1.requestedFPS = 10;              
    3. rimg.texture = w1;
    4. w1.Play();
     
  2. Cromfeli

    Cromfeli

    Joined:
    Oct 30, 2014
    Posts:
    202
    My humble take on this is that this is how generally Unity handles camera on mobile devices as it also happens on iPhone the same way. When the hardware gets very low exposure times (e.g. daylight where there is plenty of photons available), the camera pictures are ready from sensor in fraction of time what it takes in roomlight overwheling the system and you see rapid succession of Webcam.Update. Further making the WebCamTexture.requestedFPS problem very dramatic in terms of performance inconsistency.

    That is what you see in the middle, Webcam.Update is returning every frame when camera is pointed into daylight scenery. Everything looks OK when you see those subsequent frames coming in at left and right side of profiler, very consistently every few game updates. But once the underlying hardware can push out frames at super fast speeds it totally overwhelms the Unity running on Android in this case.

    I really hope Unity would take a look into the camera system. This kind of inconsistency is not really helping :(
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,957
    WebCamTexture is simply not usable in anything but little development prototypes. Check out NatCam instead.
     
    Cromfeli likes this.