TechniqueFilter {
property alias viewportRect : viewport.rect
property alias cameraViewportTopRight : cameraSelectorTopRight.camera
property alias cameraViewportBottomLeft : cameraSelectorBottomLeft.camera
tags: [Tag { name: "style"; value: "forward"}]
Viewport {
id: viewport
rect : Qt.rect(0.0, 0.0, 1.0, 1.0) // Defined from Top Left
Viewport {
id : top_right_viewport
rect : Qt.rect(0.5, 0, 0.5, 0.5)
CameraSelector {
id : cameraSelectorTopRight
RenderPassFilter { renderPassName : "zFill" }
RenderPassFilter { renderPassName : "lighting" }
}
} // top_right_viewport
Viewport {
id : bottom_left_viewport
rect : Qt.rect(0.0, 0.5, 0.5, 0.5)
CameraSelector {
id : cameraSelectorBottomLeft
RenderPassFilter { renderPassName : "zFill" }
RenderPassFilter { renderPassName : "lighting" }
}
} // bottom_left_viewport
} // viewport
}
2013
Overview
OpenGL & Qt3D
- OpenGL in Qt
- Qt3D History
- Qt3D 2.0
- Aspects
- The SceneGraph : Node - Entity - Component
- The FrameGraph
- In Depth : The RendererAspect
- Qt3D 2.0 API
- Current state of the project
James 'not Sean Harmer' Turner and Paul Lemire
Qt3D 2.0
OpenGL in Qt
Qt3D History
Goals
Extend and Strangle
- We offered to take over maintainership
- Lars agreed
- Qt3D 2.0 - essentially a rewrite
- Must satisfy some use cases supported by 1.0
- Especially, a QML interface
- Easy creation of interactive 3D scenes
- Extensible with arbitrary rendering technique or vertex data by users
- Reduce repeated work delivering 3D to our clients
- Make efficient use of multi-core CPUs and modern GPUs for above
• KDAB improving QtGui OpenGL classes
• Wrapper around low-level C API
•Windows ANGLE vs dynamic OpenGL
- Produced by the Brisbane office
- Various odd restrictions and assumptions
- Multithreading, multi-pass rendering
- Unsuitable for serious use
- Userbase encountered so far is students, academics who don’t know 3D at all
Non-Goals
Feature Set
- Scene defined by C++, QML or imported from file
- Support for non-rendering aspects in scenes
- Frame-graph defined by QML or C++
- Threaded, multi-pass rendering with arbitrary shaders and vertex attributes
- Integration with QtQuick for UIs
- Hierarchical bounding volume culling
- Provide a huge library of shaders
- Reimplement every visualisation in VTK
- But will survey popular ones and provide fast GPU based implementations as plugins
Aspects
The FrameGraph
The SceneGraph
Node - Entity - Component
A node tree defining the Rendering Pipeline
Qt3D
Qt3D Core
Definition
Qt3D
Renderer
Aspect
SceneGraph Elements
Resources Management Helpers
Example
QAspectManager
The Render Loop
while (true)
{
waitForNextTick();
foreach (Aspect *aspect, aspects)
jobManager->enqueueJobs(aspect->jobs());
changeArbiter->syncChanges();
}
Example
Custom User Defined Aspect
Node {
Mesh {
id : cubeMesh
source : ":/assets/cube.obj"
}
Material {
id : cubeMaterial
...
}
Entity {
id : cube
property Transform transform: Transform {
Translate { dx : 0; dy : -10; dz : 25 }
Scale {scale : 0.3}
}
components : [transform, cubeMesh, cubeMaterial ]
}
} // Node
Fluid Simulation Aspect
Use cases
- Switch between deferred shading / forward rendering
- Use best rendering technique available on the running platform
You can choose the aspects you want to use.
In Depth : The Renderer Aspect
Quick3D 1.0 vs Quick3D 2.0
The Qt3D API
Qt3DCore
Render Queues
Scene Builder
Quick3D
C++
Quick3D
C++
Transform
CameraLens
List of RenderView instances to required to render a frame
- Builds backend nodes for each frontent node of the SceneGraph
- Node -> RenderNode
- Material -> RenderMaterial
- Mesh -> RenderMesh
- Effect -> RenderEffect
- Each backend class registers itself as an observer for changes on the frontend node with the ChangeArbiter
- Retrieves the FrameGraph tree
- LookAtTransform
- TranslateTransform
- ScaleTransform
- RotateTransform
- MatrixTransform
- LookAt
- Translate
- Scale
- Rotate
- MatrixTransform
The Renderer lives in its own thread
Specifies :
- AspectRatio
- ProjectionType
- Near and Far planes
- FOV
RenderViews
1) submitRenderViews
(waitCondition)
Viewport {
width: 1000
height: 800
camera: Camera { eye: Qt.vector3d(21,7,19)}
Item3D {
transform: LookAt { subject: focalPenguin}
position: Qt.vector3d(0, 1.7, -6)
Item3D {
id: monkey
scale: 2
mesh: Mesh { source: "meshes/monkey.3ds"; options: "ForceSmooth"}
effect: Effect { material: gold}
transform: Rotation3D {angle: 90; axis: Qt.vector3d(1,0,0);}
} // monkey
} // Item3D
Penguin {id: focalPenguin; position: Qt.vector3d(-0.5,0,2)}
Material {
id: gold
ambientColor: "#EEDD00"
specularColor: "#FFFFFF"
shininess: 200
}
}
Contains a list of RenderCommand
Each RenderCommand contains the data needed to perform rendering :
- MeshHandle
- MaterialHandle
- TechniqueHandle
- ShaderHandle
- UniformValues
Entity {
Entity {
components : [Transform {
LookAt {
position : Qt.vector3d(0, 0, 0)
upVector : Qt.vector3d(0, 1, 0)
viewVector : penguin.position
}
}]
Entity {
id : monkey
property Mesh mesh : Mesh { source : "meshes/monkey.3ds" }
property Transform transform : Transform {
Scale { scale : 2 }
Rotate { angle : 90; axis : Qt.vector3d(1, 0, 0) }
}
components : [mesh, transform, gold]
}
}
Penguin {
id : focalPenguin
property vector3d position : Qt.vector3d(-0.5, 0, 2)
}
Material {
id : gold
// Not finalized API yet
uniforms : [
Uniform {name : "ambientColor"; vec4 : [238, 221, 0, 0]},
Uniform {name : "specularColor"; vec3 : [255, 255, 255]},
Uniform {name : "shininess"; float : 200}]
effect : Effect {
techniques : Technique {
renderPasses : RenderPass {
shaderProgram : ShaderProgram {
vertexSourceFile: ""
fragmentSourceFile: ""
}
}
}
}
}
}
Qt3DRenderer
World Transformations
Mesh Loader
1 instance
1 instance per mesh
FrameGraphItems
Components
Nodes
Jobs are not executed in the Renderer thread
Quick3D
All FrameGraphItems are subclasses of Node
C++
Quick3D
C++
Jobs
Resources Managers
Quick3D
C++
- ShaderProgram
- RenderPass
- Effect
- Technique
- Scene (Entity)
- CameraSelectorNode
- TechniqueFilterNode
- RenderPassFilterNode
- ViewportNode
- RenderTargetSelectorNode
- CameraSelector
- TechniqueFilter
- RenderPassFilter
- Viewport
- RenderTargetSelector
- Mesh
- Material
- Shape
- FrameGraph
RenderView Jobs
Bounding Volumes
- QHandle & QResourcesManager
- Objects are referenced by handles instead of pointers
- Allocation scheme is handled by the Resources Manager (contiguous arrays, lists ..)
- Memory can be rearranged without affecting the application
1 instance per leaf node of the FrameGraph tree
1 instance
typedef QHandle<RenderNode, 16> HRenderNode;
class RenderNodesManager : public QArrayResourcesManager<RenderNode, QUuid, 16>
{
....
};
m_renderNodeManager(new RenderNodesManager());
....
QUuid id = frontendNode->uuid();
RenderNode *node = m_renderNodesManager->getOrCreateResource(id);
HRenderNode nodeHandle = m_renderNodesManager->lookupHandle(id);
RenderNode *node2 = m_renderNodesManager->data(nodeHandle);
// node == node2
The FrameGraph is specified by assigning a tree of FrameGraphItems to a FrameGraph Component's activeFrameGraph property.
Where are we at ?
Brain storming
Trials of design concepts
Initial implementation
- Assimp Scene Loader
- OpenGL Version Helpers
- Renderer moved to its own Qt submodule
- QChangeArbiter notifications to update the Backend
- Separation of the Qt3D - Quick3D API
- Removal of QtQml dependencies from Qt3D Core
- QtQuick3D submodule
- Specifying Materials / Effects / Techniques
Initial commit on the Qt3D wip/newapi branch
- Qt Contributor Summit
- Finalize the APIs
- Develop set of common default Entities, Components and FrameGraphs
- Implementation of FrameGraphItems
- Rendering using the FrameGraph
- Resources Managers (Handles)
- Lots of fixes (warnings, namespaces, logging ...)
- Overhaul of the main rendering classes
- Documentation on the Qt3D wiki