Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream video blink in 8/16 update. #8

Open
idenn opened this issue Aug 26, 2022 · 2 comments
Open

stream video blink in 8/16 update. #8

idenn opened this issue Aug 26, 2022 · 2 comments

Comments

@idenn
Copy link

idenn commented Aug 26, 2022

Hi, I've tried the latest version, and it works great!
However, the FaceID stream video seems to blink noticeably at a very high speed frequency.
I think it's the limit of FaceID's record frequency in 30fps, but the scene is in 60fps or higher.
Tried to limit the scene to 30fps but had no luck.
Any solution? Thanks!

@marek-simonik
Copy link
Owner

I think this issue might be related to the spawn rate of VFX graph particles. I am going to take a closer look at this in the next few days and will notify you once I find the cause of the bug.

@marek-simonik
Copy link
Owner

I apologize for the delay. I was finally able to reproduce this issue, although only for the Record3D_Simple_Streaming object — did you experience flickering even with the Particles object?

After investigating the issue, I found that the flickering likely occurs due to the particles' Lifetime property being set to 1/FPS. This assumes that the iPhone/iPad will send new data exactly at FPS frame rate. But in practice, there can be delays and new camera data can arrive with slight delay, which what (I think) causes the occasional blinking, i.e. particles can sometimes die before new frame has been received. This is just a hypothesis, which might be wrong.

How to "fix" this?

To get rid of the flickering, I came up with a workaround specifically for the Record3D_Simple_Streaming object; all you need to do is to change the Record3D_Simple_Streaming VFX Graph so that it looks like the one in the attached image. Let me know if that worked for you.

Explanation

Since there are no visual effects and no dynamics in the Record3D_Simple_Streaming VFX Graph (only the raw stream is being shown), I unchecked the Lifetime checkbox in the Record3D_Simple_Streaming VFX Graph. This means that once the initial 307200 particles (for a 640x480 px frame) get spawned, none of them will die. Then, in the Update Particles section of the VFX Graph, I added a Set [Position|Color] from Map blocks (same as in Initialize Particle context). This ensures that the position and color of the "immortal" (already spawned) particles gets updated with the new camera data in each rendering loop.

I am not experienced with Unity / VFX Graph, but I feel like a cleaner solution (from the perspective of supporting continuous spawning of particles) would be to somehow use Events to trigger particle spawning and particle dying events. Maybe someone with more VFX Graph experience can help?

revised-vfx-graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants