Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Animation, 3D development
Forum Updated to NodeBB v4.3 + New Features

Animation, 3D development

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
30 Posts 4 Posters 10.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #2

    Hi! Yes it's possible using Qt3D. KDAB has a few nice demos.

    dodge viper

    jet engine

    hyundai

    Naveen_DN 1 Reply Last reply
    2
    • ? A Former User

      Hi! Yes it's possible using Qt3D. KDAB has a few nice demos.

      dodge viper

      jet engine

      hyundai

      Naveen_DN Offline
      Naveen_DN Offline
      Naveen_D
      wrote on last edited by
      #3

      @Wieland Thank you for the reply,
      Can get sample code for this? so that i can get more idea how to develop the 3D module
      Thank you.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #4

        Just ask them. KDAB website, twitter, facebook.

        Naveen_DN 1 Reply Last reply
        1
        • ? A Former User

          Just ask them. KDAB website, twitter, facebook.

          Naveen_DN Offline
          Naveen_DN Offline
          Naveen_D
          wrote on last edited by
          #5

          @Wieland Ok thank you :)

          1 Reply Last reply
          0
          • Naveen_DN Offline
            Naveen_DN Offline
            Naveen_D
            wrote on last edited by
            #6

            Hi,
            can anyone help me how to create and .obj object for 3D rendering and how to load it and display in Qml?

            for example, if i want to display on 3D car module how to do that ?
            Thanks in advance

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #7

              Hi!

              @Naveen_D said in Animation, 3D development:

              can anyone help me how to create and .obj object

              You don't do that yourself but either buy ready-made models or pay a digital artist to create one specifically for you. Google "buy 3d models".

              how to load it and display in Qml?

              See Mesh QML Type,

              Mesh {
                  id: mesh
                  source: "cars/BMW/i8.obj"
              }
              
              Naveen_DN 2 Replies Last reply
              0
              • ? A Former User

                Hi!

                @Naveen_D said in Animation, 3D development:

                can anyone help me how to create and .obj object

                You don't do that yourself but either buy ready-made models or pay a digital artist to create one specifically for you. Google "buy 3d models".

                how to load it and display in Qml?

                See Mesh QML Type,

                Mesh {
                    id: mesh
                    source: "cars/BMW/i8.obj"
                }
                
                Naveen_DN Offline
                Naveen_DN Offline
                Naveen_D
                wrote on last edited by
                #8
                This post is deleted!
                ? 1 Reply Last reply
                0
                • Naveen_DN Naveen_D

                  This post is deleted!

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #9

                  @Naveen_D said in Animation, 3D development:

                  is there any open source from where i can take 3D models

                  Maybe use google search?

                  1 Reply Last reply
                  0
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    I used from this place
                    https://www.turbosquid.com/Search/3D-Models/free/obj

                    Maybe this one :)
                    https://www.turbosquid.com/3d-models/3d-mercedes-benz-sls-amg-model/644946

                    Naveen_DN 1 Reply Last reply
                    0
                    • ? A Former User

                      Hi!

                      @Naveen_D said in Animation, 3D development:

                      can anyone help me how to create and .obj object

                      You don't do that yourself but either buy ready-made models or pay a digital artist to create one specifically for you. Google "buy 3d models".

                      how to load it and display in Qml?

                      See Mesh QML Type,

                      Mesh {
                          id: mesh
                          source: "cars/BMW/i8.obj"
                      }
                      
                      Naveen_DN Offline
                      Naveen_DN Offline
                      Naveen_D
                      wrote on last edited by
                      #11

                      @Wieland i tried with the following code:

                      import Qt3D.Core 2.0
                      import Qt3D.Render 2.0
                      import Qt3D.Extras 2.0
                      
                      
                      Mesh {
                          id: mesh
                          source: "qrc:/seat_leon.obj"
                      }
                      
                      

                      but didn't get the output. is there anything else i need to do for getting the output ?

                      1 Reply Last reply
                      0
                      • mrjjM mrjj

                        I used from this place
                        https://www.turbosquid.com/Search/3D-Models/free/obj

                        Maybe this one :)
                        https://www.turbosquid.com/3d-models/3d-mercedes-benz-sls-amg-model/644946

                        Naveen_DN Offline
                        Naveen_DN Offline
                        Naveen_D
                        wrote on last edited by
                        #12

                        @mrjj ya i got that thank you

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #13

                          Here's an almost minimal example in QML:

                          GearEntity.qml

                          import Qt3D.Core 2.0
                          import Qt3D.Render 2.0
                          import Qt3D.Input 2.0
                          import Qt3D.Extras 2.0
                          
                          Entity {
                              id: gearEntity
                          
                              Mesh {
                                  id: gearMesh
                                  source: "qrc:///assets/gear.obj"
                              }
                          
                              Transform {
                                  id: gearTransform
                                  scale3D: Qt.vector3d(45, 45, 45)
                                  rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
                              }
                          
                              PhongMaterial {
                                  id: gearMaterial
                              }
                          
                              Entity {
                                  id: torusEntity
                                  components: [ gearMesh, gearTransform, gearMaterial ]
                              }
                          
                          }
                          

                          RootEntity.qml

                          import Qt3D.Core 2.0
                          import Qt3D.Render 2.0
                          import Qt3D.Input 2.0
                          import Qt3D.Extras 2.0
                          
                          Entity {
                              id: rootEntity
                          
                              Camera {
                                  id: camera
                                  projectionType: CameraLens.PerspectiveProjection
                                  fieldOfView: 45
                                  nearPlane : 0.1
                                  farPlane : 1000.0
                                  position: Qt.vector3d( 0.0, 0.0, 40.0 )
                                  upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
                                  viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
                              }
                          
                              FirstPersonCameraController { camera: camera }
                          
                              components: [
                                  RenderSettings {
                                      activeFrameGraph: ForwardRenderer {
                                          camera: camera
                                          clearColor: "transparent"
                                      }
                                  },
                                  InputSettings {}
                              ]
                          
                              GearEntity {}
                          }
                          

                          main.qml

                          import QtQuick 2.7
                          import QtQuick.Window 2.3
                          import QtQuick.Controls 2.0
                          import QtQuick.Layouts 1.3
                          import QtQuick.Scene3D 2.0
                          import Qt3D.Core 2.0
                          import Qt3D.Render 2.0
                          import Qt3D.Extras 2.0
                          
                          ApplicationWindow {
                              visible: true
                              visibility: Window.Maximized
                          
                              Rectangle {
                                  anchors.fill: parent
                                  gradient: Gradient {
                                      GradientStop { position: 0.0; color: "blue" }
                                      GradientStop { position: 1.0; color: "grey" }
                                  }
                              }
                          
                              Scene3D {
                                  id: scene3d
                                  anchors.fill: parent
                                  focus: true
                                  aspects: ["input", "logic"]
                                  cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
                                  RootEntity {}
                              }
                          
                              Button {
                                  text: "Exit"
                                  onClicked: Qt.quit()
                              }
                          }
                          
                          Naveen_DN S 2 Replies Last reply
                          3
                          • ? A Former User

                            Here's an almost minimal example in QML:

                            GearEntity.qml

                            import Qt3D.Core 2.0
                            import Qt3D.Render 2.0
                            import Qt3D.Input 2.0
                            import Qt3D.Extras 2.0
                            
                            Entity {
                                id: gearEntity
                            
                                Mesh {
                                    id: gearMesh
                                    source: "qrc:///assets/gear.obj"
                                }
                            
                                Transform {
                                    id: gearTransform
                                    scale3D: Qt.vector3d(45, 45, 45)
                                    rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
                                }
                            
                                PhongMaterial {
                                    id: gearMaterial
                                }
                            
                                Entity {
                                    id: torusEntity
                                    components: [ gearMesh, gearTransform, gearMaterial ]
                                }
                            
                            }
                            

                            RootEntity.qml

                            import Qt3D.Core 2.0
                            import Qt3D.Render 2.0
                            import Qt3D.Input 2.0
                            import Qt3D.Extras 2.0
                            
                            Entity {
                                id: rootEntity
                            
                                Camera {
                                    id: camera
                                    projectionType: CameraLens.PerspectiveProjection
                                    fieldOfView: 45
                                    nearPlane : 0.1
                                    farPlane : 1000.0
                                    position: Qt.vector3d( 0.0, 0.0, 40.0 )
                                    upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
                                    viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
                                }
                            
                                FirstPersonCameraController { camera: camera }
                            
                                components: [
                                    RenderSettings {
                                        activeFrameGraph: ForwardRenderer {
                                            camera: camera
                                            clearColor: "transparent"
                                        }
                                    },
                                    InputSettings {}
                                ]
                            
                                GearEntity {}
                            }
                            

                            main.qml

                            import QtQuick 2.7
                            import QtQuick.Window 2.3
                            import QtQuick.Controls 2.0
                            import QtQuick.Layouts 1.3
                            import QtQuick.Scene3D 2.0
                            import Qt3D.Core 2.0
                            import Qt3D.Render 2.0
                            import Qt3D.Extras 2.0
                            
                            ApplicationWindow {
                                visible: true
                                visibility: Window.Maximized
                            
                                Rectangle {
                                    anchors.fill: parent
                                    gradient: Gradient {
                                        GradientStop { position: 0.0; color: "blue" }
                                        GradientStop { position: 1.0; color: "grey" }
                                    }
                                }
                            
                                Scene3D {
                                    id: scene3d
                                    anchors.fill: parent
                                    focus: true
                                    aspects: ["input", "logic"]
                                    cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
                                    RootEntity {}
                                }
                            
                                Button {
                                    text: "Exit"
                                    onClicked: Qt.quit()
                                }
                            }
                            
                            Naveen_DN Offline
                            Naveen_DN Offline
                            Naveen_D
                            wrote on last edited by
                            #14

                            @Wieland thank you... i got the output.
                            I have one doubt, in the output when i try to rotate the object it is not rotating in the same place, instead the camera is rotating(i guess), is there any way to fix the camera and rotate the object in 360 deg ?
                            Thank you

                            1 Reply Last reply
                            0
                            • ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #15

                              That's just how FirstPersonCameraController works. You could either implement your own camera controller or - instead of moving the camera - dynamically change gearTransform.

                              Naveen_DN 3 Replies Last reply
                              3
                              • ? A Former User

                                That's just how FirstPersonCameraController works. You could either implement your own camera controller or - instead of moving the camera - dynamically change gearTransform.

                                Naveen_DN Offline
                                Naveen_DN Offline
                                Naveen_D
                                wrote on last edited by
                                #16
                                This post is deleted!
                                1 Reply Last reply
                                0
                                • ? A Former User

                                  That's just how FirstPersonCameraController works. You could either implement your own camera controller or - instead of moving the camera - dynamically change gearTransform.

                                  Naveen_DN Offline
                                  Naveen_DN Offline
                                  Naveen_D
                                  wrote on last edited by
                                  #17

                                  @Wieland

                                  You could either implement your own camera controller

                                  How i can develop my own camera controller is there any example for this ?

                                  1 Reply Last reply
                                  0
                                  • ? A Former User

                                    That's just how FirstPersonCameraController works. You could either implement your own camera controller or - instead of moving the camera - dynamically change gearTransform.

                                    Naveen_DN Offline
                                    Naveen_DN Offline
                                    Naveen_D
                                    wrote on last edited by
                                    #18

                                    @Wieland
                                    I have made few changes in the code shared by you, what i have done is, Using blender software i have sliced the car obj for few diff parts like door, wheel, window, bonet etc and i have rearranged the whole car by adding the car parts in the code.
                                    Now when i try to add some animation for each of the part, for example i want the door to open and close as usual as it does normally, but what is happening,the door part is taking car body as the center and it is rotating inwards in the given angle. how can i change this to make it work properly.
                                    here is the code,

                                    import Qt3D.Core 2.0
                                    import Qt3D.Render 2.0
                                    import Qt3D.Input 2.0
                                    import Qt3D.Extras 2.0
                                    import QtQuick 2.5
                                    
                                    Entity {
                                        id: carFrontLeftDoorEntity
                                    
                                        Mesh {
                                            id: carFrontLeftDoorMesh
                                            source: "qrc:/Meshes/Car_FrontLeftDoor.obj"
                                        }
                                    
                                        Transform {
                                            id: carFrontLeftDoorMeshTransform
                                            scale3D: Qt.vector3d(1.5,1.5,1.5)
                                            rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 1), 30)
                                            rotationY: 0
                                    
                                            SequentialAnimation {
                                                loops: Animation.Infinite
                                                running: true
                                                NumberAnimation {
                                                    target: carFrontLeftDoorMeshTransform
                                                    property: "rotationY"
                                                    from: 0; to: 15
                                                    duration: 2000
                                                    easing.type: Easing.InOutQuad
                                                }
                                            }
                                        }
                                    
                                        PhongMaterial {
                                            id: carFrontLeftDoorMeshMaterial
                                            ambient: Qt.rgba( 0.0,0.0,0.0, 0.6 )
                                            diffuse: Qt.rgba( 0.3, 0.0, 128, 0.2 )
                                        }
                                    
                                        Entity {
                                            id: carFrontLeftDoorMeshtorusEntity
                                            components: [ carFrontLeftDoorMesh, carFrontLeftDoorMeshTransform, carFrontLeftDoorMeshMaterial ]
                                        }
                                    }
                                    

                                    this i have added in the gearentity.qml as separate part.

                                    Entity {
                                        id: gearEntity
                                    
                                        CarRawBody{}
                                    
                                        CarFrontGlass{}
                                    
                                        CarBonet{}
                                    
                                        CarDikki{}
                                    
                                        CarFrontLeftWheel{}
                                    
                                        CarRearLeftWheel{}
                                    
                                        CarFrontLeftDoor{}
                                    
                                        CarRearLeftDoor{}
                                    
                                        CarFrontLeftWindow{}
                                    
                                        CarRearLeftWindow{}
                                    }
                                    
                                    1 Reply Last reply
                                    0
                                    • Naveen_DN Offline
                                      Naveen_DN Offline
                                      Naveen_D
                                      wrote on last edited by
                                      #19

                                      hi, any updates on the above query ?
                                      Thank you

                                      1 Reply Last reply
                                      0
                                      • ? Offline
                                        ? Offline
                                        A Former User
                                        wrote on last edited by
                                        #20

                                        Hi! Sorry, that it already just too complex / incomplete for me to test and help with. Can you boil it down to a simpler question or a minimal runnable example that I - or anyone else who reads this - can use to reproduce the issue?

                                        Naveen_DN 2 Replies Last reply
                                        0
                                        • ? A Former User

                                          Hi! Sorry, that it already just too complex / incomplete for me to test and help with. Can you boil it down to a simpler question or a minimal runnable example that I - or anyone else who reads this - can use to reproduce the issue?

                                          Naveen_DN Offline
                                          Naveen_DN Offline
                                          Naveen_D
                                          wrote on last edited by
                                          #21

                                          @Wieland ya sure.. i will reproduce it and post the example code..
                                          Can you please guide in the following issue also
                                          Thank you.
                                          https://forum.qt.io/topic/84633/camera-rotation-around-a-mesh

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved