当前位置:网站首页>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 .
边栏推荐
- 509. Fibonacci Number. Sol
- Metaverse Ape上线倒计时,推荐活动火爆进行
- Business learning of mall commodity module
- K210 learning notes (IV) k210 runs multiple models at the same time
- 从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
- Leetcode simple question ring and rod
- Nacos 的安装与服务的注册
- FBO and RBO disappeared in webgpu
- Serializability of concurrent scheduling
- Performance testing of software testing
猜你喜欢
如何快速体验OneOS
Overview of database recovery
Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程
笔记本电脑蓝牙怎么用来连接耳机
Sentinel production environment practice (I)
科技云报道:算力网络,还需跨越几道坎?
What if win11 is missing a DLL file? Win11 system cannot find DLL file repair method
How can Bluetooth in notebook computer be used to connect headphones
Metaverse Ape获Negentropy Capital种子轮融资350万美元
Talking about MySQL index
随机推荐
Two stage locking protocol for concurrency control
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
Ad637 notes d'utilisation
元宇宙中的三大“派系”
What changes has Web3 brought to the Internet?
Database recovery strategy
Code bug correction, char is converted to int high-order symbol extension, resulting in changes in positivity and negativity and values. Int num = (int) (unsigned int) a, which will occur in older com
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
Shell script, awk uses if, for process control
笔记本电脑蓝牙怎么用来连接耳机
实战:fabric 用户证书吊销操作流程
database mirroring
Blocking of concurrency control
Damn, window in ie open()
What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
How to quickly experience oneos
Technology cloud report: how many hurdles does the computing power network need to cross?
Stored procedures and stored functions
Common interview questions of redis factory
Analysis of the problem that the cookie value in PHP contains a plus sign (+) and becomes a space