当前位置:网站首页>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 .
边栏推荐
- What changes has Web3 brought to the Internet?
- Business learning of mall order module
- IIC bus realizes client device
- 50. Pow(x, n). O(logN) Sol
- Installation of VMware Workstation
- Win11运行cmd提示“请求的操作需要提升”的解决方法
- Reptile practice
- How to view Apache log4j 2 remote code execution vulnerability?
- Pl/sql basic case
- Analysis of the problem that the cookie value in PHP contains a plus sign (+) and becomes a space
猜你喜欢

What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial

50. Pow(x, n). O(logN) Sol

Depth first DFS and breadth first BFS -- traversing adjacency tables

Two stage locking protocol for concurrency control

如何快速体验OneOS

The real situation of programmers

Calculation method of boundary IOU

Livelocks and deadlocks of concurrency control

Storage optimization of performance tuning methodology

Postman核心功能解析-参数化和测试报告
随机推荐
Leetcode simple question: find the nearest point with the same X or Y coordinate
700. Search in a Binary Search Tree. Sol
What about data leakage? " Watson k'7 moves to eliminate security threats
MySQL服务莫名宕机的解决方案
Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
Oracle advanced query
Blocking of concurrency control
如何開發引入小程序插件
Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
What if win11 is missing a DLL file? Win11 system cannot find DLL file repair method
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
The new content of the text component can be added through the tag_ Config set foreground and background colors
Common interview questions of redis factory
database mirroring
极狐公司官方澄清声明
Shelved in TortoiseSVN- Shelve in TortoiseSVN?
Go语言学习教程(十五)
"Chris Richardson microservices series" uses API gateway to build microservices
Lightweight dynamic monitorable thread pool based on configuration center - dynamictp