当前位置:网站首页>Qtquick3d real time reflection
Qtquick3d real time reflection
2022-07-05 22:18:00 【aggs1990】
QtQuick3D Realtime Reflections
QtQuick3D Real time reflection
Wednesday February 09, 2022 by Hatem ElKharashy | Comments
2022 year 2 month 9 Wednesday, Sunday Hatem ElKharashy | Comment on
Reflections enhance the realism of a rendered 3D scene and without it we can not have objects like mirrors or puddles of water that reflect the surrounding environment. Raster rendering pipelines like QtQuick3D can approximately calculate reflections using different methods to get good results, as opposed to Ray Tracing where reflections can be calculated accurately by following the light rays and checking where they bounce from. In this blog post, we are going to discuss two different techniques to do reflections in QtQuick3D.
Reflection enhances rendering 3D The realism of the scene , Without it , We cannot have objects like mirrors or puddles that reflect our surroundings . image QtQuick3D Such a raster rendering pipeline can use different methods to approximate the reflection to obtain good results , Not ray tracing , In ray tracing , You can accurately calculate reflections by tracking rays and checking where they bounce . In this post , We will discuss in QtQuick3D Two different techniques for reflection in .
Reflection Probes
Reflection probe
Reflection Probe is a new QtQuick3D component introduced as a tech preview in Qt 6.3. This component uses environment mapping technique to calculate reflections. The probe is positioned somewhere in the scene where it captures the surrounding environment and saves it in a cube map. The objects can use this cube map to show reflections.
The reflection probe is Qt 6.3 As a new technology preview introduced in QtQuick3D Components . This component uses environment mapping technology to calculate reflection . The detector is located somewhere in the scene , There it captures the surrounding environment and saves it in a cube map . Objects can use this cube map to show reflections .
The image shows a use case for that. The probe will capture the environment and the mirrors use the captured cube map to show the reflection of the car and other objects in the scene.
The figure shows a use case for this . The detector will capture the environment , The mirror uses the captured cube map to show the reflection of the car and other objects in the scene .
There are couple of things to focus on here. First, the probe captures the environment from its current position so the placement of the probe in the world affects what is going to appear in the cube map.
Here are a few things to pay attention to . First , The detector captures the environment from its current location , Therefore, the position of the detector in the world will affect the content to be displayed in the cube map .
Second, for an object to show reflections it must have receivesReflections property set to true, which is a new property introduced for the Model component in Qt 6.3, and it must lie inside the probe. The probe has a property boxSize which defines the size of probe box. Any object that lies inside the probe's box can show reflections using this probe cube map. Moreover, if an object lies inside two probes at the same time, it will use the nearest probe cube map.
secondly , For objects to show reflections , It must receivesReflections Property is set to true, This is a Qt 6.3 New attributes introduced for model components in , And it must be inside the detector . The detector has an attribute boxSize, It defines the size of the detector box . Any object in the detector box can use this detector cube map to display reflections . Besides , If an object is in two detectors at the same time , It will use the nearest detector cube map .
The Reflection Probe has three properties to control how the cube map is rendered. These properties let the user favor quality over performance and vice versa.
The reflection detector has three attributes to control how the cube map is rendered . These attributes make users prefer quality to performance , vice versa .
Quality: Let the user choose the texture quality of the cube map.
quality : Let the user choose the texture quality of the cube map .
Refresh Mode: Has two options, either first frame or every frame. First frame will make the probe capture the environment only once and It is suited for static environments. Every frame will make the probe capture the environment every frame. It makes reflections more realistic but it might affect the frame rate depending on the hardware.
Refresh mode : There are two options , First frame or every frame . The first frame will make the detector capture the environment only once , It is suitable for static environment . Each frame will let the detector capture the environment of each frame . It makes reflections more realistic , But it may affect the frame rate , It depends on the hardware .
Time Slicing: Let the user select how each face of the cube map is going to be rendered. For example, Individual Faces option will make the probe render a single face each frame while None option will make the probe render all the faces in a single frame
Time slice : Let the user choose how to render each face of the cube map . for example ,“ Single face ” Option will make the probe render a face in each frame , and “ nothing ” Option will make the probe render all faces in a single frame
One more thing that is worth mentioning, when the probe captures the environment in a cube map it considers everything to be infinitely far away. This works well for something like the skybox but not for nearby objects specially in an indoor area. Here is an image of the same scene showing this issue.
There is another thing worth mentioning , When the detector captures the environment in the cube map , It believes that everything is infinite . This applies to skybox Things like that , But it doesn't apply to nearby objects , Especially in indoor areas . The following is a picture of the same scene , Shows the problem .
The reflections seem off. The car's reflection on the mirror is large and not represented in the correct size. To solve this issue, Reflection Probe has a property parallaxCorrection which corrects this issue by taking some variables into account including the boxSize. The first image in the blog is what you get when parallaxCorrection is enabled.
The reflection seems to disappear . The reflection of the car on the rearview mirror is very big , Incorrect size . To solve this problem ,Reflection Probe There is an attribute parallaxCorrection, It considers some variables ( Include boxSize) To correct this problem . The first picture in the blog is obtained after enabling parallax correction .
Screen Space Reflections
Screen space reflection
Another way to calculate reflections is called Screen Space Reflections or simply SSR. It is a post processing effect technique that works on the rendered frame in screen space. A ray is emitted from the camera to each fragment and the ray can be traced and find which objects are hit. It is something like ray tracing but done in screen space. This technique is more computationally expensive than environment mapping but it has more accurate results. However, since it works in screen space it has some drawbacks. Objects that are outside the frame or behind the camera do not appear in the reflections which is undesired effect.
Another way to calculate reflection is called screen space reflection or simple SSR. This is a post-processing effect technology , Suitable for rendered frames in screen space . A ray of light is emitted from the camera to each fragment , The light can be traced and the hit object can be found . It's a bit like ray tracing , But in screen space . This technology is computationally more expensive than environment mapping , But the result is more accurate . However , Because it works in screen space , It also has some disadvantages . Objects outside the frame or behind the camera do not appear in the reflection , This is an unwanted effect .
This technique is not part of the QtQuick3D rendering pipeline but it can be implemented for a particular model using a custom material and a fragment shader. It is discussed in more detail in this example.
This technology is not QtQuick3D Render part of the pipeline , But you can use custom materials and fragment shaders to implement for specific models . This example will discuss this in more detail .
边栏推荐
- Sentinel production environment practice (I)
- Analyse des risques liés aux liaisons de microservices
- Metaverse Ape上线倒计时,推荐活动火爆进行
- MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
- MySQL服务莫名宕机的解决方案
- 2022-07-05: given an array, you want to query the maximum value in any range at any time. If it is only established according to the initial array and has not been modified in the future, the RMQ meth
- How can Bluetooth in notebook computer be used to connect headphones
- A substring with a length of three and different characters in the leetcode simple question
- Performance monitoring of database tuning solutions
- Meituan dynamic thread pool practice ideas, open source
猜你喜欢
How can Bluetooth in notebook computer be used to connect headphones
Practice: fabric user certificate revocation operation process
元宇宙中的三大“派系”
Recovery technology with checkpoints
How to quickly experience oneos
K210 learning notes (IV) k210 runs multiple models at the same time
2022软件测试工程师涨薪攻略,3年如何达到30K
Overview of concurrency control
Leetcode simple question check whether all characters appear the same number of times
Livelocks and deadlocks of concurrency control
随机推荐
Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
Lightweight dynamic monitorable thread pool based on configuration center - dynamictp
When the industrial Internet era is truly mature, we will look at the emergence of a series of new industrial giants
Two stage locking protocol for concurrency control
Metaverse Ape获Negentropy Capital种子轮融资350万美元
FBO and RBO disappeared in webgpu
微服务链路风险分析
实战:fabric 用户证书吊销操作流程
科技云报道荣膺全球云计算大会“云鼎奖”2013-2022十周年特别贡献奖
Promql demo service
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
IIC bus realizes client device
[Yugong series] go teaching course in July 2022 004 go code Notes
Create a virtual machine on VMware (system not installed)
Depth first DFS and breadth first BFS -- traversing adjacency tables
Understand the basic concept of datastore in Android kotlin and why SharedPreferences should be stopped in Android
MySQL actual combat 45 lecture learning (I)
科技云报道:算力网络,还需跨越几道坎?
Win11 runs CMD to prompt the solution of "the requested operation needs to be promoted"
boundary IoU 的计算方式