当前位置:网站首页>New 3D particle function in QT 6.3
New 3D particle function in QT 6.3
2022-07-05 22:18:00 【aggs1990】
New 3D particles features in Qt 6.3
Qt 6.3 New in 3D Particle function
Tuesday February 08, 2022 by Kaj Grönholm | Comments
2022 year 2 month 8 On Tuesday, Kaj Grönholm | Comment on
Yes, I know, Qt 6.3 isn't out yet. But as the first beta was just released, it is a good time to start speaking about the new features. In this blog post, I will list my three favourite new features available in Qt Quick 3D particles module.
Yes , That's true. ,Qt 6.3 Not yet released . But because the first beta has just been released , Now is a good time to start talking about new features . In this post , I will list Qt Quick 3D Three of my favorite new features in the particle module .
Custom Shapes
Custom shapes
Shapes in Quick 3D particles module define areas where the particles are emitted from or where the particles are attracted to. Most common way to define the shape is using ParticleShape3D and selecting the shape type (Cube, Sphere, Cylinder). Alternatively, if you want to emit particles from an existing 3D model, there is ParticleModelShape3D just for that. These options are often enough, but they don't cover all the needs, so with Qt 6.3 we added a new ParticleCustomShape3D element. This element allows defining exact particle positions of the shape in a simple CBOR format:
“Quick 3D The particle ” The shape in the module defines the area to which particles are emitted or attracted . The most common way to define shapes is to use ParticleShape3D And select the shape type ( Cube 、 sphere 、 Cylinder ). perhaps , If you want to start from the existing 3D The model emits particles , have access to ParticleModelShape3D. These options are usually sufficient , But they can't meet all the needs , So in Qt 6.3 in , We added a new particleCustomsShape3D Elements . This element allows for simple CBOR The format defines the precise particle position of the shape :
[
"QQ3D_SHAPE", // string
version, // integer
[
posX, // float
posY, // float
posZ, // float
posX, // float
...
]
]
Here is an example application using custom shapes:
Here is a sample application using custom shapes :
To create these shape files, we provide a simple command-line tool called shapegen, which takes in an image and depth, and creates defined amount of positions within those. Here is the help of shapegen tool:
To create these shape files , We have provided one called shapegen Simple command line tools , It receives images and depth , And create a location in which to define the quantity . Here are shapegen Tools help :
C:\qt6_3-install\bin
λ shapegen.exe --help
Usage: shapegen.exe [options]
Tool to generate Qt Quick 3D Particles Custom Shapes
Options:
-?, -h, --help Displays help on commandline options.
--help-all Displays help including Qt specific
options.
-i, --image <file> Input image for the data.
-o, --output <file> Output CBOR file for the shape data.
-d, --depth <number> Depth (z scale) for the data.
-s, --scale <number> Scale used for the image data. Default
1.0
-a, --amount <number> Amount of position data to generate.
-p, --sorting-position <qvector3d> Position to use for sorting. Format "x,
y, z"
-l, --list-cbor Lists CBOR file content.
This tool is still rather simple, but so is the CBOR format so you can also look at the private shape helper class and generate your own custom shapes in any imaginable ways.
This tool is still very simple , however CBOR The format is also very simple , So you can also view private shape helper class , And generate your own custom shapes in any imaginable way .
Lights Support
Light support
To emit 2D texture particles in the Quick 3D scene, you use the SpriteParticle3D elements. With the Qt 6.3, we have added lights support for these sprite particles by defining which lights the particle should be affected by:
To be in Quick 3D Launch in the scene 2D Texture particles , Please use SpriteArticle3D Elements . stay Qt 6.3 in , By defining which lights should affect particles , Added light support for these sprite particles :
SpotLight {
id: lightSpot
...
}
PointLight {
id: lightPoint
...
}
SpriteParticle3D {
id: spriteParticle
sprite: Texture {
source: "images/sphere.png"
}
lights: [lightSpot, lightPoint]
...
}
All the Quick3D light types are supported. With particles, the applied light amount is per-particle and not per-pixel resolution like with the Quick 3D models. This decision was made because particles are usually rather small and to have excellent performance by having the lighting calculated in the vertex shader side.
Support all Quick3D The type of light . For particles , The amount of light applied is per particle , Not like it Quick 3D Model resolution per pixel . The reason for this decision , Because particles are usually very small , And get excellent performance by calculating illumination on the vertex shader side .
Here is an example application demonstrating particles with different lights:
Here is a sample application , Show me particles with different lights :
You can take this lighting support into use to make particles blend better with the rest of the 3D scene. And as said, the lights implementation is rather performant so you can use them also on embedded hardware.
You can use this light to support , Make particles better interact with 3D The rest of the scene is mixed . As mentioned earlier ,lights The performance achieved is quite good , So you can also use them on embedded hardware .
Dynamic Bursts
Dynamic explosion
To emit particles in bursts, Quick 3D supports several burst() methods and declarative EmitBurst3D elements. The latter is evaluated (so burst particles generated) at the time the particle system starts. This is optimal for performance as it means burst particles don't need to be generated while the system is running, but it doesn't suit cases where the emitter moves, rotates etc. because bursts will be created with the initial emitter stage. For this reason we have added a new DynamicBurst3D element in Qt 6.3. It is used similarly to EmitBurst3D:
To emit particles in a burst ,Quick 3D Support several kinds of burst() Methods and declarativeness EmitBurst3D Elements . When the particle system starts , Evaluate the latter ( So as to generate burst particles ). This is the best for performance , Because this means that there is no need to generate explosive particles when the system is running , But it is not suitable for the transmitter to move 、 Rotation, etc , Because the burst will be created in the initial stage of the launcher . therefore , We are Qt 6.3 Added a new DynamicBurst3D Elements . Its usage and EmitBurst3D similar :
ParticleEmitter3D {
...
emitBursts: [
DynamicBurst3D {
time: 1000
amount: 100
},
DynamicBurst3D {
time: 2000
amount: 200
}
]
}
DynamicBurst3D elements are evaluated at the system runtime, meaning that the above example emits 100 particles at 1s and 200 particles at 2s, with the emitter properties during those exact times. DynamicBurst3D combined with TrailEmitter3D also allows triggering the bursts when the followed particle starts or ends.
DynamicBurst3D Elements are evaluated when the system is running , This means that the above example is in 1s It's time to launch 100 A particle , stay 2s It's time to launch 200 A particle , Have emitter properties in these precise times .DynamicBurst3D And TrailEmitter3D The combination of also allows bursts to be triggered at the beginning or end of subsequent particles .
Here is an example application demonstrating dynamic bursts with the trail emitter:
Here is a sample application , Demonstrates the use of dynamic pulses with track emitters :
All the examples shown in the blog are available with the Qt 6.3 and there are also plenty of other new things and fixes in Qt 6.3. So please download the latest 6.3 release and try for yourself.
All the examples shown in the blog can be found in Qt6.3 Use in ,Qt6.3 There are many other new features and fixes in . therefore , Please download the latest 6.3 edition , Try it yourself .
边栏推荐
- 119. Pascal‘s Triangle II. Sol
- Cobaltstrike builds an intranet tunnel
- Shelved in TortoiseSVN- Shelve in TortoiseSVN?
- Server optimization of performance tuning methodology
- AD637 usage notes
- Analyse des risques liés aux liaisons de microservices
- What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
- 数博会精彩回顾 | 彰显科研实力,中创算力荣获数字化影响力企业奖
- How to add new fields to mongodb with code (all)
- 实战:fabric 用户证书吊销操作流程
猜你喜欢
Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture
The real situation of programmers
Overview of concurrency control
【愚公系列】2022年7月 Go教学课程 004-Go代码注释
Learning of mall permission module
AD637使用笔记
Talking about MySQL index
实战:fabric 用户证书吊销操作流程
Installation of VMware Workstation
Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程
随机推荐
Type of fault
What about data leakage? " Watson k'7 moves to eliminate security threats
Damn, window in ie open()
Lightweight dynamic monitorable thread pool based on configuration center - dynamictp
Character conversion PTA
实战:fabric 用户证书吊销操作流程
Shelved in TortoiseSVN- Shelve in TortoiseSVN?
如何创建线程
Sub total of Pico development
50. Pow(x, n). O(logN) Sol
Talking about MySQL index
每日刷题记录 (十四)
Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture
How to quickly experience oneos
Basic grammar of interview (Part 1)
Concurrency control of performance tuning methodology
Overview of database recovery
Create a virtual machine on VMware (system not installed)
微服务链路风险分析
700. Search in a Binary Search Tree. Sol