Rotating Objects in UE4, Benchmarked (Get better FPS!)

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ต.ค. 2024

ความคิดเห็น • 70

  • @PendingKill
    @PendingKill  4 ปีที่แล้ว +14

    Suggested Improvements:
    1) You can make rotation with Tick frame-independent by multiplying the Rotator by the Tick event's DeltaSeconds. We've implemented this in the Github source code.

  • @antonlinden9677
    @antonlinden9677 3 ปีที่แล้ว +18

    When you want to draw the same mesh many times, I recommend using Instanced Static Mesh Component instead of having an actor for each. It renders a single mesh on multiple positions

    • @fiskergaming5750
      @fiskergaming5750 3 ปีที่แล้ว +1

      Yes, but to test framerates, this is a better solution

    • @OpenMawProductions
      @OpenMawProductions ปีที่แล้ว +1

      That's not going to work if you want to use this for pick ups.

  • @drummerman883
    @drummerman883 4 ปีที่แล้ว +6

    Great video, even with seeing this through out my dev time it's nice to see the hard numbers. Definitely a reality check.

    • @PendingKill
      @PendingKill  4 ปีที่แล้ว

      Thank you! We'll be incorporating more of these stats in our tutorials.

  • @Mireneye
    @Mireneye 10 หลายเดือนก่อน

    First and foremost an excellent video! Very thorough!
    It's not entirely true that you can't do anything about the shadow. You can give the shadow a custom shadow stencil and conceivably you could rotate that stencil. It'll never be as precise as actually casting the shadow, but for simple shapes (like a coin) you can probably cheaply model the appearance from some uv coords.

  • @rifat.ahammed
    @rifat.ahammed ปีที่แล้ว

    Great great . Thank you soo much for this episode. Want more optimization result comparing videos like this one.

  • @MarvelMaster
    @MarvelMaster 4 ปีที่แล้ว +3

    Good job defenitly learned something ;)

  • @QuiteDan
    @QuiteDan ปีที่แล้ว +1

    Do the normals also need to be rotated when using a material-based rotation?

  • @FerlinDev
    @FerlinDev 4 ปีที่แล้ว +7

    That is exacly why you multiply the delta time with rotation angle when using event tick 🤣

    • @FerlinDev
      @FerlinDev 4 ปีที่แล้ว

      Nvm, you wrote that in the comments

    • @OpenMawProductions
      @OpenMawProductions ปีที่แล้ว

      Or, just don't use tick whenever possible because it is still the worst performer here.

  • @ZimCrusher
    @ZimCrusher ปีที่แล้ว +1

    how do you get his to rotate around the local axis?
    I have a propeller I want to spin, but it is not perfectly aligned in X,Y, or Z. It's tilted at 45 degrees.
    I can easily make it a child of a Scene Component, so it only rotates in Y, but the Material method does not see it this way. It still rotates it in World Y.
    I tried ObjectPiviotPoint, ComponentPivotLocal, Local, and I'm running out of choices.

    • @PendingKill
      @PendingKill  ปีที่แล้ว +1

      On the NormalizedRotationAxis of the RotateAboutAxis material node, you'll want to specify a normalized (i.e. magnitude of 1) vector representing the axis you want the propeller to spin around. In the video, we're using a vector that represents a line pointing straight up in the Z axis (0,0,1). For your example of a 45 degree angle, you can try (0,0.707,0.707) or different combinations, as 0.707 is sin(45 degrees) and cos(45 degrees).

    • @ZimCrusher
      @ZimCrusher ปีที่แล้ว

      @@PendingKill yea... this still only gets me a fixed rotation.
      Meaning, I would have to know the object's angle in the game.
      I am randomly spawning fans, in a room.
      so... 1) trying to get the fan blade to face the correct direction.
      2) (advanced) trying to get the fan blade to face the correct direction, if I have a ossolating fan.
      currently, If I look at the fan in the blueprint, it looks fine, but once I place it in the scene, it is locked aligned to XYZ that was set in the blue print, and it ignores the rotation of the actor in the scene.

    • @ZimCrusher
      @ZimCrusher ปีที่แล้ว +1

      @@PendingKill Got it to work. I had some help on a discord forum.
      Adding 2 nodes in the material that enter the RotateAboutAxis/NormalizedRotationAxis (input).
      Take the colored XYZ(RGB) node, plug it into a Normalize node.
      Add a ObjectOrientation Node.
      Add RotateVector node.

    • @PendingKill
      @PendingKill  ปีที่แล้ว

      @@ZimCrusher Glad you figured it out! The ObjectOrientation node seems like the key to get it to rotate around arbitrarily placed objects in the scene. Thanks for writing this up, hopefully others will find it useful.

  • @boundlessunrealengine9467
    @boundlessunrealengine9467 ปีที่แล้ว

    You made my day! Thanks!

  • @dbarr49
    @dbarr49 3 ปีที่แล้ว +3

    I wonder how this test would differ if you used an instanced static mesh over regular static meshes. My guess is performance would probably increase dramatically for all of your tests

  • @robinj6997
    @robinj6997 9 หลายเดือนก่อน

    Have you done any testing in UE5.3? I've been dwelling in material to create some animation, to save on performance. Would be nice to know if there is a point to it still or if it's outdated nowadays. Like how would this compare to vertex animation?

  • @channieonline
    @channieonline 4 ปีที่แล้ว +11

    "omg these material-based coins are much faster to render!"
    of course they are, you don't spend 25ms per frame computing dynamic shadows anymore!

    • @legacythegame
      @legacythegame 4 ปีที่แล้ว +1

      It would be nice to see how much the shadows cost

    • @PendingKill
      @PendingKill  4 ปีที่แล้ว +4

      @@legacythegame We'll try to cover shadows in a future video!

  • @IllyasArt
    @IllyasArt 4 ปีที่แล้ว +1

    Really cool!

  • @Morderkainer
    @Morderkainer 4 ปีที่แล้ว +2

    Would be good idea disable coins shadows and fake the shadow with a texture rotation on stamps.

  • @liloupalomino8677
    @liloupalomino8677 3 ปีที่แล้ว

    Subscribed after watching that intro

  • @YouWillDoAsYouAreTold
    @YouWillDoAsYouAreTold 3 ปีที่แล้ว

    really great tutorial, thanks! subbed

  • @rifz42
    @rifz42 4 ปีที่แล้ว

    Great new channel, please make more tutorials! : )

  • @frozengemstudio9204
    @frozengemstudio9204 2 ปีที่แล้ว

    Thank you!

  • @dimaferox5133
    @dimaferox5133 3 ปีที่แล้ว +2

    Wow, very great optimization tutorial! It's very interesting to optimize games, thanks! Hope you will do more tutorials for optimization and possible issues like shadows but in very optimized material

  • @fenexj
    @fenexj 4 ปีที่แล้ว +1

    Good stuff, follow up video on a C++ implementation?

    • @PendingKill
      @PendingKill  4 ปีที่แล้ว +1

      Thanks! I believe that a C++ implementation would follow a very similar structure, especially for the Rotating Movement component. Of course, you wouldn't need C++ for the Material method.

  • @Wip3ou7
    @Wip3ou7 2 ปีที่แล้ว

    why do the objects have a wobble? even in the preview with the sphere you can see that the sphere isnt maintaining its position perfectly

  • @darkwere1
    @darkwere1 4 ปีที่แล้ว +1

    Why don't you try an instantiated static meshes?

  • @3sgamestudio
    @3sgamestudio 3 ปีที่แล้ว

    forgot to compare the "rotating movement" component. which is a native c++ component for rotating objects.

  • @zz6838
    @zz6838 ปีที่แล้ว

    Great video! please make more tutorials!!

  • @hiiammoot
    @hiiammoot 4 ปีที่แล้ว

    I was under the assumption that static mesh components in actors were auto instanced.
    Other than that, it would be interesting to see how instanced static meshes would work with.

    • @PendingKill
      @PendingKill  4 ปีที่แล้ว +2

      Typically they are auto-instanced as long as they're not moving. But once we add the Rotating Movement component or rotate the actor manually on tick, the auto-instancing no longer occurs.

  • @momomadi2
    @momomadi2 3 ปีที่แล้ว

    i wanna add if u use the material static mesh on BP - but set it as static not movable - the engine should realise it as instance (no more draw call for eatch)- and should get better performance ---- i test with another thing not ur test

  • @Tigerzhell
    @Tigerzhell 4 ปีที่แล้ว

    René Borrero Why use any of those methods when you can just make a simple animation for it. Also are these copies you made instanced?

  • @zenofar4761
    @zenofar4761 ปีที่แล้ว

    so i can use it for all my updates (tick) functions?

  • @FerlinDev
    @FerlinDev 4 ปีที่แล้ว +1

    Also, you should have tested Timelines and rotation lerps

    • @scarlindo
      @scarlindo 4 ปีที่แล้ว

      was about to type that

    • @philzan3627
      @philzan3627 4 ปีที่แล้ว

      Could've also done a recursive re-route with a delay but hey...

  • @sandromaric6226
    @sandromaric6226 4 ปีที่แล้ว

    Great Video! .... Thx for this

  • @OpenMawProductions
    @OpenMawProductions ปีที่แล้ว

    Did you turn tick off when you put the material in the actor?

    • @OpenMawProductions
      @OpenMawProductions ปีที่แล้ว

      Seriously. I have an actor that is my base pick up actor, and I turned tick off. My FPS stayed 120 FPS with over 300 actors on screen. Turned tick back on and it halved my FPS. So the material is really the best option.

  • @MrSofazocker
    @MrSofazocker 2 ปีที่แล้ว +1

    Now, what do I have to do If I want hundreds of coins that one can pickup when they're not actors?

  • @ThomasBaijot
    @ThomasBaijot 3 ปีที่แล้ว

    How to use a random value for the rotation rate with Rotation Movement Component ??

  • @Skyflairl2p
    @Skyflairl2p 4 ปีที่แล้ว

    This obviously doesnt matter, but for reference what are the specs of the pc used for these tests? Particularly cpu/gpu setup
    Great info though, and excellently presented!

    • @PendingKill
      @PendingKill  4 ปีที่แล้ว +1

      Thank you for the kind words! These tests were done on a somewhat dated machine, with an AMD FX-8350 processor and R9 380 GPU.

    • @Skyflairl2p
      @Skyflairl2p 4 ปีที่แล้ว

      @@PendingKill Oh my the nostalgia, the FX-8350! how come you still run that bad boy in the year 2020? haha, with the more recent ryzen cpu's being relatively cheap that is. (unless you actually own two rigs.) I used to have one aswell. It was a beast back when it was released!

    • @PendingKill
      @PendingKill  4 ปีที่แล้ว +1

      ​@@Skyflairl2p Haha it's served us well, though we're planning to upgrade that one soon :) the other machine we have is a Ryzen 3600 + RTX 2080. And yeah 8 cores was a flex back in the day.

  • @omri1324
    @omri1324 3 ปีที่แล้ว

    Wait, so shader based rotation isn't good anymore if it's inside a BP?

    • @PendingKill
      @PendingKill  3 ปีที่แล้ว +2

      Well, seems like once you put it into a blueprint, UE will treat it as separate objects and won't do auto-instancing with the static meshes. However, you're still avoiding having to rotate an object every frame, so it's substantially cheaper compared to using the RotatingMovement component (or any of the other non-shader rotation methods we discussed)

  • @xDemorn
    @xDemorn 2 ปีที่แล้ว

    hmm very interesting

  • @bestboy007
    @bestboy007 3 ปีที่แล้ว

    dude. you pro

  • @xboxoneoldmansregret1977
    @xboxoneoldmansregret1977 ปีที่แล้ว

    What about a timeline?

  • @sherifhany386
    @sherifhany386 3 ปีที่แล้ว

    Yes more please, i'll even subscribe to the channel

  • @jonathanxdoe
    @jonathanxdoe 2 ปีที่แล้ว

    I hoped the material wasn't the best. It is such a pain to code complex behavior without a graph

  • @littledemo3605
    @littledemo3605 ปีที่แล้ว

    so timers not that good in optimized it's any way = event tick!

  • @littledemo3605
    @littledemo3605 ปีที่แล้ว

    so witch better optimized method?

    • @PendingKill
      @PendingKill  ปีที่แล้ว

      Doing it in the material is the fastest!

    • @littledemo3605
      @littledemo3605 ปีที่แล้ว

      @@PendingKill but shadow not working. how i stop cast shadow on one specified component?

    • @PendingKill
      @PendingKill  ปีที่แล้ว

      ​@@littledemo3605 I'm not sure exactly what you're trying to do, but you can try unchecking the Cast Shadows checkbox on the rotating actor.

  • @stellarcommander3456
    @stellarcommander3456 ปีที่แล้ว

    умножь значение повората на дельта секунды, и тогда кадры в секунду не будут влиять на скорость поворота.

  • @cumuIonimbus
    @cumuIonimbus ปีที่แล้ว +1

    It is kinda weird that less FPS = slower rotation when using Tick... If you multiplied your RotationRate by DeltaTime, this shouldn't have been a problem.