Qt3D Renderer Elements: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=Qt3D Scene Structure and Elements=
[[Category:Developing_with_Qt::Qt3D:Qt3D_wip_newapi_Overview ]]<br />[toc align_right=&quot;yes&amp;quot; depth=&quot;3&amp;quot;]


==Renderer elements==
= Qt3D Scene Structure and Elements =
 
== Renderer elements ==


The Renderer aspect defines its own set of elements.
The Renderer aspect defines its own set of elements.


===Nodes===
=== Nodes ===
 
==========
 
* '''Effect'''<br /> Specifies a list of techniques and default values to be used by the renderer to properly assign shaders and uniforms.
 
==========
 
* '''RenderPass'''<br /> Specifies the ShaderProgram o be used for a pass of a technique.<br /> The render pass should have a name.


==========
===== * '''Effect'''<br />Specifies a list of techniques and default values to be used by the renderer to properly assign shaders and uniforms. =====


* '''Technique'''<br /> Contains a list of RenderPass elements.
===== * '''RenderPass'''<br />Specifies the ShaderProgram o be used for a pass of a technique.<br />The render pass should have a name. =====


==========
===== * '''Technique'''<br />Contains a list of RenderPass elements. =====


* '''ShaderProgram'''<br /> Has paths pointing to fragment and vertex shader sources.
===== * '''ShaderProgram'''<br />Has paths pointing to fragment and vertex shader sources. =====


[[Image:35n0osi.png]]
[[Image:http://i58.tinypic.com/35n0osi.png|http://i58.tinypic.com/35n0osi.png]]


====FrameGraphItems====
==== FrameGraphItems ====


Only a single framegraph can be used at any moment for the rendering of the scene.
Only a single framegraph can be used at any moment for the rendering of the scene.


==========
===== * '''Viewport'''<br />Defines the viewport rectangle to be used.'''Note :''' The viewport rectangle is defined from top left unlike OpenGL which defines it from bottom left. =====


* '''Viewport'''<br /> Defines the viewport rectangle to be used.'''Note :''' The viewport rectangle is defined from top left unlike OpenGL which defines it from bottom left.
===== * '''CameraSelector'''<br />Defines the camera entity to be used. =====


==========
===== * '''RenderPassFilter'''<br />Defines the name of the RenderPass to be used. =====


* '''CameraSelector'''<br /> Defines the camera entity to be used.
===== * '''RenderTargetSelector'''<br />To be done - Defines the RenderTarget (Texture/FBO/Screen) =====


==========
===== * '''TechniqueFilter'''<br />Defines the name of the technique to be used. =====


* '''RenderPassFilter'''<br /> Defines the name of the RenderPass to be used.
[[Image:http://i59.tinypic.com/2885yit.png|http://i59.tinypic.com/2885yit.png]]


==========
=== Entity ===


* '''RenderTargetSelector'''<br /> To be done – Defines the RenderTarget (Texture/FBO/Screen)
===== * '''Scene'''<br /> Has a source property that can be set to the path of a 3D scene file to be loaded into the current scenegraph tree. =====


==========
=== Components ===


* '''TechniqueFilter'''<br /> Defines the name of the technique to be used.
===== * '''Mesh'''<br />Specifies the path toward a mesh source file. =====


[[Image:2885yit.png]]
===== * '''Material'''<br />Specifies an Effect and may override uniforms set by the Effect to be used<br />by the Techniques' ShaderPrograms<br />Also specifies the textures. =====


===Entity===
===== * '''Shape'''<br />Can be a shaper of one of the types :<br />'''''' Cube<br />'''''' Sphere<br />'''''' Cylinder<br />'''''' Torus<br />Additional properties allow to further define the shape and its precision. =====


==========
<code><br /> Mesh {<br /> id: ballMesh<br /> objectName: &quot;ballMesh&amp;quot;<br /> source: &quot;:/assets/ball.obj&amp;quot;<br /> }


* '''Scene''' Has a source property that can be set to the path of a 3D scene file to be loaded into the current scenegraph tree.
Material {<br /> id: ballMaterial<br /> objectName: &quot;ballMaterial&amp;quot;<br /> // effect: adsEffect


===Components===
// Custom properties go here<br /> }


==========
Entity {<br /> id: ball<br /> objectName: &quot;ball&amp;quot;


* '''Mesh'''<br /> Specifies the path toward a mesh source file.
property Transform transform: Transform {<br /> Translate{ dx: 0; dy: –10; dz : 25 }<br /> Scale {scale : 0.1}<br /> }<br /> property Mesh mesh: ballMesh<br /> property Material material: ballMaterial<br /> }</code>


==========
==== * '''FrameGraph'''<br />Defines the tree of FrameGraphItems to be used as the rendering pipeline. ====


* '''Material'''<br /> Specifies an Effect and may override uniforms set by the Effect to be used<br /> by the Techniques’ ShaderPrograms<br /> Also specifies the textures.
<code>import Qt3D 2.0<br />import Qt3D.Render 2.0


==========
TechniqueFilter {


* '''Shape'''<br /> Can be a shaper of one of the types :
property alias viewportRect: viewport.rect<br /> property alias cameraViewportTopRight: cameraSelectorTopRight.camera<br /> property alias cameraViewportBottomLeft: cameraSelectorBottomLeft.camera
** Cube
** Sphere
** Cylinder
** Torus<br /> Additional properties allow to further define the shape and its precision.


========
tags: [<br /> Tag { name: &quot;style&amp;quot;; value: &quot;forward&amp;quot;}<br /> ]


* '''FrameGraph'''<br /> Defines the tree of FrameGraphItems to be used as the rendering pipeline.
Viewport {<br /> id: viewport<br /> objectName : &quot;viewport&amp;quot;<br /> rect: Qt.rect(0.0, 0.0, 1.0, 1.0) // From Top Left


===Categories:===
Viewport {<br /> id : top_right_viewport<br /> rect: Qt.rect(0.5, 0, 0.5, 0.5)<br /> CameraSelector {<br /> RenderPassFilter { renderPassName: &quot;zFill&amp;quot; }<br /> RenderPassFilter { renderPassName: &quot;lighting&amp;quot; }<br /> }<br /> }


* [[:Category:Developing with Qt|Developing_with_Qt]]
Viewport {<br /> id : bottom_left_viewport<br /> rect: Qt.rect(0.0, 0.5, 0.5, 0.5)<br /> CameraSelector {<br /> RenderPassFilter { renderPassName: &quot;zFill&amp;quot; }<br /> RenderPassFilter { renderPassName: &quot;lighting&amp;quot; }<br /> }<br /> }<br /> }<br />}
** [[:Category:Developing with Qt::Qt3D:Qt3D wip newapi Overview|Qt3D:Qt3D_wip_newapi_Overview]]

Revision as of 10:34, 24 February 2015


[toc align_right="yes&quot; depth="3&quot;]

Qt3D Scene Structure and Elements

Renderer elements

The Renderer aspect defines its own set of elements.

Nodes

* Effect
Specifies a list of techniques and default values to be used by the renderer to properly assign shaders and uniforms.
* RenderPass
Specifies the ShaderProgram o be used for a pass of a technique.
The render pass should have a name.
* Technique
Contains a list of RenderPass elements.
* ShaderProgram
Has paths pointing to fragment and vertex shader sources.

http://i58.tinypic.com/35n0osi.png

FrameGraphItems

Only a single framegraph can be used at any moment for the rendering of the scene.

* Viewport
Defines the viewport rectangle to be used.Note : The viewport rectangle is defined from top left unlike OpenGL which defines it from bottom left.
* CameraSelector
Defines the camera entity to be used.
* RenderPassFilter
Defines the name of the RenderPass to be used.
* RenderTargetSelector
To be done - Defines the RenderTarget (Texture/FBO/Screen)
* TechniqueFilter
Defines the name of the technique to be used.

http://i59.tinypic.com/2885yit.png

Entity

* Scene
Has a source property that can be set to the path of a 3D scene file to be loaded into the current scenegraph tree.

Components

* Mesh
Specifies the path toward a mesh source file.
* Material
Specifies an Effect and may override uniforms set by the Effect to be used
by the Techniques' ShaderPrograms
Also specifies the textures.
* Shape
Can be a shaper of one of the types :
' Cube
'
Sphere
' Cylinder
'
Torus
Additional properties allow to further define the shape and its precision.
<br /> Mesh {<br /> id: ballMesh<br /> objectName: &quot;ballMesh&amp;quot;<br /> source: &quot;:/assets/ball.obj&amp;quot;<br /> }

Material {<br /> id: ballMaterial<br /> objectName: &quot;ballMaterial&amp;quot;<br /> // effect: adsEffect

// Custom properties go here<br /> }

Entity {<br /> id: ball<br /> objectName: &quot;ball&amp;quot;

property Transform transform: Transform {<br /> Translate{ dx: 0; dy: 10; dz : 25 }<br /> Scale {scale : 0.1}<br /> }<br /> property Mesh mesh: ballMesh<br /> property Material material: ballMaterial<br /> }

* FrameGraph
Defines the tree of FrameGraphItems to be used as the rendering pipeline.

import Qt3D 2.0
import Qt3D.Render 2.0

TechniqueFilter {

property alias viewportRect: viewport.rect
property alias cameraViewportTopRight: cameraSelectorTopRight.camera
property alias cameraViewportBottomLeft: cameraSelectorBottomLeft.camera

tags: [
Tag { name: "style&quot;; value: "forward&quot;}
]

Viewport {
id: viewport
objectName : "viewport&quot;
rect: Qt.rect(0.0, 0.0, 1.0, 1.0) // From Top Left

Viewport {
id : top_right_viewport
rect: Qt.rect(0.5, 0, 0.5, 0.5)
CameraSelector {
RenderPassFilter { renderPassName: "zFill&quot; }
RenderPassFilter { renderPassName: "lighting&quot; }
}
}

Viewport {
id : bottom_left_viewport
rect: Qt.rect(0.0, 0.5, 0.5, 0.5)
CameraSelector {
RenderPassFilter { renderPassName: "zFill&quot; }
RenderPassFilter { renderPassName: "lighting&quot; }
}
}
}
}