当前位置:网站首页>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 .
边栏推荐
- Shell script, awk uses if, for process control
- Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
- ESP32 hosted
- 数据泄露怎么办?'华生·K'7招消灭安全威胁
- Leetcode simple question check whether all characters appear the same number of times
- Cobaltstrike builds an intranet tunnel
- Sub total of Pico development
- Common interview questions of JVM manufacturers
- 元宇宙中的三大“派系”
- 科技云报道荣膺全球云计算大会“云鼎奖”2013-2022十周年特别贡献奖
猜你喜欢
Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程
Oracle hint understanding
The statistics of leetcode simple question is the public string that has appeared once
MySQL服务莫名宕机的解决方案
The American Championship is about to start. Are you ready?
Practice: fabric user certificate revocation operation process
Leetcode simple question check whether all characters appear the same number of times
Server optimization of performance tuning methodology
Matlab draws a cute fat doll
【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用
随机推荐
每日刷题记录 (十四)
Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture
Regular expressions and re Libraries
Installation of VMware Workstation
A trip to Suzhou during the Dragon Boat Festival holiday
Sparse array [matrix]
Some tutorials install the database on ubantu so as not to occupy computer memory?
50. Pow(x, n). O(logN) Sol
Oracle views the data size of a table
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
Daily question brushing record (XIV)
Character conversion PTA
Promql demo service
Technology cloud report won the special contribution award for the 10th anniversary of 2013-2022 of the "cloud Ding Award" of the global cloud computing conference
90后测试员:“入职阿里,这一次,我决定不在跳槽了”
The new content of the text component can be added through the tag_ Config set foreground and background colors
如何开发引入小程序插件
ICMP introduction
What changes has Web3 brought to the Internet?
Leetcode simple question: check whether each row and column contain all integers