Start a new topic

Unity Custom Camera

Hello everyone.


I am trying to apply a greyscale filter on the camera and I've started to play around with the Advanced Custom Camera example in Unity. Unfortunately, there are two obstacles right now that I cannot overcome and hoped that I could find some help here.


In play mode I can't use the remote camera, even if I have selected it on the Wikitude Camera script, but it only renders from the web cam.

Second, the camera renders three frames one on top of the other and I can't figure out why (as seen in the image)

image


I've tried to understand what's written in the scripts CustomCameraController.cs and CustomCameraRender.cs, but most of it was too complex for me. Perhaps, eventually I'll find out how to change what I need, but maybe there's someone here who could point me towards the right direction.



1 Comment

Hi,


The Advanced Custom Camera sample was designed to handle camera initialization, so the setting in the WikitudeCamera is intentionally ignored. If you want to access the remote camera from that sample you can update the Initialize method of the CustomCameraController.cs script, right after the `if (!firstStart)` check according to the following snippet:

    private IEnumerator Initialize(bool firstStart) {
        if (!firstStart) {
            /* If we are resuming from background, we wait a frame to make sure that everything is initialized
             * before starting the camera again.
             */
            yield return null;
        }

        if (Application.isEditor) {
            while (_feed == null) {
                foreach (var device in WebCamTexture.devices) {
                    if (device.name.Contains("Remote") && !device.isFrontFacing) {
                        _feed = new WebCamTexture(device.name, 640, 480);
                        _feed.Play();
                        break;
                    }
                }
                yield return null;
            }
        }

        if (_feed == null) {
            ...


As for the second issue, this is caused by having the Game view in a portrait aspect ratio. Resizing it to a landscape aspect ratio will fix the issue. This issue is already fixed internally and will be released with the next update of the SDK.


Best regards,

Alexandru


1 person likes this
Login or Signup to post a comment