放慢剧本,而不会减慢相机供稿

发布于 2025-02-04 15:26:00 字数 171 浏览 4 评论 0 原文

我想在屏幕记录过程中放慢3D增强物体的运动,而不会影响相机供稿。矩阵喜欢效果,有可能吗?

我已经尝试了 arview.session.pape(),但它也冻结了相机提要。我可以管理所需的渲染框架吗?在这种情况下,我可以将FPS放在3D渲染上,不确定是否有更好的方法可以做到。感谢您的建议。

I would like to slow down the movement of the 3D augmented object during screen recording without effecting the camera feed. Matrix like effect, is it possible?

I have tried arView.session.pause() but it also froze the camera feed. Can I manage the needed rendered frames? in that case I can just drop the fps on the 3D render, not sure if there is a better way to do it. thanks for any advice.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月蹉跎了容颜 2025-02-11 15:26:00

关于文献,

无需改变文献的速度,因为这不仅破坏了所需的效果,而且会破坏用户的AR体验。会话必须在60 fps运行,必须继续跟踪所有在场景中,一定不能停止。

realialekit中的冻结动画2.0中的动画

是一种强大的解决方案是使用2种不同的动画速度 - normal andimation speed 当您不录制时,子弹时间动画速度(甚至 freeze 动画)在屏幕录制过程中。

var speed: Float { get set }               // Default value is 1.0

可以实现“冻结”效果

import RealityKit
import ReplayKit

var ctrl: AnimationPlaybackController!

let neo = try ModelEntity.load(named: "Neo_with_Animation")

ctrl = neo.playAnimation(neo.availableAnimations[0].repeat(count: 50), 
                             transitionDuration: 2, 
                             startsPaused: false)

func startRecording(sender: UIButton!) {
    ctrl.speed = 0.02                      // animation speed is 2%
    // some code to start recording...
}
func stopRecording(sender: UIButton!) {
    ctrl.speed = 1.0                       // animation speed is 100%
    ctrl.speed = -1.0                      // reverse animation speed is 100%
    // some code to stop recording...
}

可以使用 AnimationPlayBackController :如果您需要有关资产动画的更多信息, -a-a-models rotation-in-RealityKit/59336962#59336962“>此帖子。

在MAINE KIT 2.0中冻结物理学

时,当您模拟物理时,可以使用 .static PhysicsBodyMode enum 枚举并使用案例。但是,冻结物理学的过程看起来并不像冻结动画一样令人印象深刻。

let neoScene = try! Experience.loadNeoWithPhysics()

let neo = neoScene.developer!.children[0] as? (ModelEntity & 
                                               HasCollision & 
                                               HasPhysicsBody & 
                                               HasPhysicsMotion)

func startRecording(sender: UIButton!) {
    neo.physicsBody?.mode = .static       // freeze simulation
    // some code to start recording...
}
func stopRecording(sender: UIButton!) {
    neo.physicsBody?.mode = .dynamic      // resume simulation

    // it's quite possible that after unfreezing  
    // an additional impulse will be required...
    neo.physicsMotion?.linearVelocity.x = 1.0
    neo.physicsMotion?.linearVelocity.z = 0.5

    // some code to stop recording...
}

据我所知,RealityKit 2.0中没有参数可以帮助您放慢速度(而不是冻结!)物理模拟而不会破坏它。因为RealityKit的引擎可以实时计算物理。

阅读此帖子 RealityKit。

Scenekit中的物理学冻结

,Scenekit具有改变模拟速率的属性。它的名称为 speed

var speed: CGFloat { get set }

About ARSession

There is no need to change the speed of the ARSession, as this not only spoil the desired effect, but also ruin the user's AR experience. The session must be running at 60 fps, it must continue to track all the anchors in the scene and mustn't stop.

Freezing animation in RealityKit 2.0

A robust solution would be to use 2 different animation speeds - normal animation speed when you aren't recording and bullet-time animation speed (or even freeze animation) during screen recording.

var speed: Float { get set }               // Default value is 1.0

The "freezing" effect can be achieved using AnimationPlaybackController:

import RealityKit
import ReplayKit

var ctrl: AnimationPlaybackController!

let neo = try ModelEntity.load(named: "Neo_with_Animation")

ctrl = neo.playAnimation(neo.availableAnimations[0].repeat(count: 50), 
                             transitionDuration: 2, 
                             startsPaused: false)

func startRecording(sender: UIButton!) {
    ctrl.speed = 0.02                      // animation speed is 2%
    // some code to start recording...
}
func stopRecording(sender: UIButton!) {
    ctrl.speed = 1.0                       // animation speed is 100%
    ctrl.speed = -1.0                      // reverse animation speed is 100%
    // some code to stop recording...
}

If you need more info on asset animation, read this post.

Freezing physics in RealityKit 2.0

When you're simulating physics you can stop the process using .static case of PhysicsBodyMode enum and resume the process using .dynamic case. However, the process of freezing the physics does not look as impressive as freezing the animation.

let neoScene = try! Experience.loadNeoWithPhysics()

let neo = neoScene.developer!.children[0] as? (ModelEntity & 
                                               HasCollision & 
                                               HasPhysicsBody & 
                                               HasPhysicsMotion)

func startRecording(sender: UIButton!) {
    neo.physicsBody?.mode = .static       // freeze simulation
    // some code to start recording...
}
func stopRecording(sender: UIButton!) {
    neo.physicsBody?.mode = .dynamic      // resume simulation

    // it's quite possible that after unfreezing  
    // an additional impulse will be required...
    neo.physicsMotion?.linearVelocity.x = 1.0
    neo.physicsMotion?.linearVelocity.z = 0.5

    // some code to stop recording...
}

As far as I know, there's no parameter in RealityKit 2.0 that helps you just to slow down (not freeze!) physics simulation without breaking it. Because RealityKit's engine calculates physics in realtime.

Read this post to find out how to quickly setup physics in RealityKit.

Freezing physics in SceneKit

Nonetheless, SceneKit has such a property that changes simulation's rate. Its name is speed.

var speed: CGFloat { get set }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文