当前位置:网站首页>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 .
边栏推荐
- Ad637 notes d'utilisation
- Go语言学习教程(十五)
- Livelocks and deadlocks of concurrency control
- Talking about MySQL index
- Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
- Pinctrl subsystem and GPIO subsystem
- Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
- PyGame practical project: write Snake games with 300 lines of code
- ICMP introduction
- A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
猜你喜欢
Leetcode simple question: the minimum cost of buying candy at a discount
Granularity of blocking of concurrency control
Concurrency control of performance tuning methodology
Common interview questions of redis factory
Blocking protocol for concurrency control
如何快速体验OneOS
boundary IoU 的计算方式
极狐公司官方澄清声明
Overview of concurrency control
Installation of VMware Workstation
随机推荐
Ad637 notes d'utilisation
Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
1.3 years of work experience, double non naked resignation agency face-to-face experience [already employed]
Sub total of Pico development
Concurrency control of performance tuning methodology
What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
Some tutorials install the database on ubantu so as not to occupy computer memory?
Official clarification statement of Jihu company
Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
笔记本电脑蓝牙怎么用来连接耳机
Sentinel production environment practice (I)
Overview of database recovery
如何開發引入小程序插件
Business learning of mall commodity module
Leetcode simple question check whether all characters appear the same number of times
如何向mongoDB中添加新的字段附代码(全)
Business learning of mall order module
Oracle hint understanding
Leetcode simple question: the minimum cost of buying candy at a discount
Storage optimization of performance tuning methodology