That ahihi guy with the webcam tutorial repo has a YouTube video, too. https://www.youtube.com/watch?v=oVyGHeYWYU0
I had to change a few things to get it working with my setup but it works! Now I’ve started building out a UI for capturing shots and animating them.
Actually, my webcam setup is much simpler than ahihi’s. Apparently a lot of webcams produce two images which need to be combined to produce the desired picture. They used a shader to solve that. I didn’t need a shader for mine. Not sure if that’s because of the camera or the system or what.
I did need to modify the code to wait for a CameraServer.camera_feeds_updated signal to be emitted before running initialization. Otherwise it looked like my camera wasn’t being picked up at all.
I also needed to set the format to use for my camera. The camera outputs a bunch of possible formats with the frame dimensions, frame rate, and encoding.
I went with:
{ "width": 1280, "height": 720, "format": "Motion-JPEG", "frame_numerator": 1, "frame_denominator": 24 }
Hard-coded it for now.
Then, instead of using the aforementioned shader I can just set the texture property on a TextureRect and I’m in business.
I’m also learning to work with textures through this. About time, eh?
I made a WebcamManager class which provides a CameraTexture instead, that way I can plug it into other things as needed.
_texture.camera_feed_id = _camera.get_id()
_texture.which_feed = CameraServer.FEED_Y_IMAGE
So far so good.
I’m also figuring out how to do UIs a little better. For example, if I’m making a custom control to embed in the UI, don’t subclass Control. It doesn’t resize to fit its contents. I think that’s what was messing me up with the audio controls when making Unearthed for the game jam. I should use a MarginContainer or a CenteredContainer or something instead.
I think this menu threw me off a bit:
In what situations would you actually want to use a Control as the scene’s root?