Signed distance fields (SDFs) and Truncated Signed Distance Field(TSDF)

news2024/9/22 9:39:58

1. Signed distance fields (SDFs)

笔记来源:
[1] Signed distance fields (SDFs)
[2] Signed Distance Function (SDF): Implicit curves or surfaces
[3] Ray Marching and Signed Distance Functions
[4] Truncated Signed Distance Function
[5] Wiki/Signed distance function

1.1 What is SDF?

SDF是一种物体表面或形状的隐式表示方法

Signed distance functions, or SDFs for short, when passed the coordinates of a point in space, return the shortest distance between that point and some surface. The sign of the return value indicates whether the point is inside that surface or outside (hence signed distance function).

SDF输入:平面/空间点的位置
SDF输出:该点到最近的物体表面的距离
例1:平面内2D圆的SDF表示

圆心: ( a , b ) 、半径: r = 1   圆的表达式: ( x − a ) 2 + ( y − b ) 2 − 1 = 0   d ( x , y ) = ( x − a ) 2 + ( x − b ) 2 − 1 \text{圆心:}(a,b)、\text{半径:}r=1\\ ~\\ \text{圆的表达式}:(x-a)^2+(y-b)^2-1=0\\ ~\\ d(x,y)=\sqrt{(x-a)^2+(x-b)^2 }-1 圆心:(a,b)半径:r=1 圆的表达式(xa)2+(yb)21=0 d(x,y)=(xa)2+(xb)2 1
平面内各个点到圆的最近距离,若该点在圆外则距离为正( d ( x , y ) > 0 d(x,y)\gt 0 d(x,y)>0),若该点刚好在圆上则距离为0( d ( x , y ) = 0 d(x,y)=0 d(x,y)=0),若该点在圆内则距离为负( d ( x , y ) < 0 d(x,y)\lt 0 d(x,y)<0

例2:点到线段的距离
一点P到线段AB的距离等价于线段QP的长度,其中Q为线段AB上离点P最近的点

于是线段AB的SDF表示:
S A B ( x , y ) = λ A + ( 1 − λ ) B S_{AB}(x,y)=\lambda A+(1-\lambda)B SAB(x,y)=λA+(1λ)B
其中 λ \lambda λ
w ⃗ = P − A 、 v ⃗ = B − A   λ = < w ⃗ , v ⃗ > ∣ ∣ v ⃗ ∣ ∣ 2 \vec{w}=P-A、\vec{v}=B-A\\ ~\\ \lambda=\frac{<\vec{w},\vec{v}>}{||\vec{v}||^2} w =PAv =BA λ=∣∣v 2<w ,v >
如果 0 ≤ λ ≤ 1 0\leq \lambda\leq 1 0λ1,则点在线段AB上,若 λ < 0 \lambda\lt 0 λ<0或者 λ > 1 \lambda\gt1 λ>1,则点在直线AB上但不在线段AB上

类似的,在3D空间中,我们也可以通过单个SDF表示物体表面
下图来自:Inigo Quilez/articles/distance functions



我们也可以通过各个简单物体的SDF进行布尔运算表示任何复杂物体表面




Constructive Solid Geometry(CSG)
Constructive solid geometry, or CSG for short, is a method of creating complex geometric shapes from simple ones via boolean operations. CSG is built on 3 primitive operations: intersection ( ∩ ), union ( ∪ ), and difference ( − )

1.2 Ray Marching

Ray Tracing 和 Ray Marching 的区别
In raytracing, the scene is typically defined in terms of explicit geometry: triangles, spheres, etc. To find the intersection between the view ray and the scene, we do a series of geometric intersection tests: where does this ray intersect with this triangle, if at all? What about this one? What about this sphere?

In raymarching, the entire scene is defined in terms of a signed distance function. To find the intersection between the view ray and the scene, we start at the camera, and move a point along the view ray, bit by bit. At each step, we ask “Is this point inside the scene surface?”, or alternately phrased, “Does the SDF evaluate to a negative number at this point?“. If it does, we’re done! We hit something. If it’s not, we keep going up to some maximum number of steps along the ray.

We could just step along a very small increment of the view ray every time, but we can do much better than this (both in terms of speed and in terms of accuracy) using “sphere tracing”. Instead of taking a tiny step, we take the maximum step we know is safe without going through the surface: we step by the distance to the surface, which the SDF provides us!
In this diagram, p 0 p_0 p0​​ is the camera. The blue line lies along the ray direction cast from the camera through the view plane. The first step taken is quite large: it steps by the shortest distance to the surface. Since the point on the surface closest to p 0 p_0 p0​​ doesn’t lie along the view ray, we keep stepping until we eventually get to the surface, at p 4 p_4 p4

在1.1小节中我们表示完了物体表面,接下来我们考虑如何画出SDF的结果,即渲染

物体表面最终呈现的颜色是由光线反射角度、材质等等决定的
我们需要回答两个问题:
(1)Does the ray hit the surface?
(2)If so,where,at what angle is the surface?
If the ray doesn’t hit the surface, we just colour in the pixel white (or transparent).
If it does, we need to know what angle the surface is at to know how to shade it.
先来看看第一个问题ray是否击中了物体表面?
我们沿着ray向前进,计算ray上一些点离最近物体表面的距离,如果距离为0表明ray与物体相交,若沿着ray前进时计算的距离没有为0的情况,意味着这条ray与物体并没有相交,通常在这种情况下,我们会在前进一定步数后截断,不再对该条ray上的点计算距离

在计算机图形学中大多数 lighting model 使用表面法向量来计算某种材质表面上某个点的颜色,当scene由显式几何定义时,如三角面元,法向量在三角面元的三个顶点指定,其他点的法向量由插值计算得到。当scene由SDF定义时,我们使用梯度来计算法向量

如果ray击中了物体表面,那么我们如何计算表面的法向量?
方案一:可以由深度图计算梯度进而得到每个点的法向量
方案二:直接对SDF计算梯度

有了物体表面法向量,之后就可以计算该物体在具体场景中的颜色了,本篇仅聚焦于SDF,故不再展开

2.Truncated Signed Distance Field(TSDF)

Truncated Signed Distance Function (TSDF) is a simplified way to represent 3D shapes or surfaces, which stores the distance information for points near the surface up to a certain threshold. It is used in applications like 3D reconstruction and surface rendering to create accurate and efficient representations of 3D scenes.

Truncation: In a Truncated Signed Distance Function, we limit or “truncate” the range of distances that we care about. This means that we only consider distances up to a certain threshold, and ignore any distances beyond that. Truncation is useful because it simplifies the representation of the 3D shape and reduces the amount of data we need to store.
This trunction is essential to limit the influence of voxels far from the surface, ensuring more accurate integration close to the surface.

The main purpose of TSDF is to represent and reconstruct 3D surfaces or shapes from different measurements or observations, like depth images from a 3D camera or point clouds from a LiDAR sensor. By combining these measurements using TSDF, we can create a more accurate and complete representation of the 3D surface.

下图来自:截断符号距离 | TSDF, Truncated Signed Distance Function

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2096234.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

个人旅游网(4)——功能详解——收藏功能

文章目录 一、收藏排行榜功能1.1、接口详解1.1.1、findRouteList 二、收藏功能2.1、接口详解2.1.1、find&#xff08;用于判断当前旅游路线是否已被收藏&#xff09;2.1.2、add-favorite&#xff08;用于实现收藏功能&#xff09;2.1.3、remove-favorite&#xff08;用于实现取…

ubuntu20.04搭建kubernetes1.28.13集群配置calico网络插件

写在前面 这里是我在搭建过程中从某站找到的教学视频,搭载的都是最新的,大家可以参考一下 搭建kubernetes集群学习视频: 视频链接。最后面会有我遇见报错信息的所有连接和解决方案,自行查看 不说废话,直接开搭 搭建集群大纲 一、三台虚拟机的初始化 二、三台虚拟机连接…

内存管理篇-19 TLB和Table wake unit

TLB这几节&#xff0c;停下来感觉怪怪的。没有从TLB的引入&#xff0c;工作原理&#xff0c;实际源码应用来深入分析。 TLB 是一种高速缓存&#xff0c;用于存储最近使用的页表项&#xff08;Page Table Entries, PTEs&#xff09;。它的主要目的是加速虚拟地址到物理地址的转换…

卷积公式的几何学理解

1、Required Knowledge 1.1、概率密度函数 用于描述连续型随机变量在不同取值上的概率密度&#xff0c;记作 f ( x ) f(x) f(x)。 如随机变量 X X X的分布为正态分布&#xff0c;则其概率密度函数为&#xff1a; f ( x ) 1 σ 2 π e − ( x − μ ) 2 2 σ 2 f(x)\frac{1}…

容器化你的应用:使用 Docker 入门指南

Docker 是一个流行的平台&#xff0c;它允许开发者将应用程序及其依赖项打包在一起&#xff0c;形成一个轻量级、可移植的容器。这种做法极大地简化了开发、测试和部署流程&#xff0c;因为无论是在本地还是在云端&#xff0c;容器都能确保应用的一致性。本指南将带你从头开始学…

粗心的懒洋洋做Python二级真题(错一大堆,分享错题)

以下内容&#xff0c;皆为原创&#xff0c;制作不易。感谢大家的点赞和关注。 一.数据流图 数据流图&#xff08;Data Flow Diagram&#xff0c;简称DFD&#xff09;是一种图形化表示法&#xff0c;用于展示信息系统中数据的流动和处理过程。 考点&#xff1a;数据流图是系统逻…

【我要成为配环境高手】Visual Studio中Qt安装与配置(无伤速通)

1.下载安装Qt和VSIX插件 2.本地环境变量配置 添加如下&#xff1a; D:\ProgramData\Qt\Qt5.14.2\5.14.2\msvc2017_64\libD:\ProgramData\Qt\Qt5.14.2\5.14.2\msvc2017_64\bin3.VS配置 ⭐项目右键->属性->调试->环境&#xff0c;添加如下&#xff1a;(很重要&#x…

TCP的连接与断开

三次握手 主动发起连接建立的应用进程叫做客户端(client)。被动等待连接建立的应用进程叫做服务器(server)。 第一次握手&#xff1a;Client将同步比特SYN置为1&#xff08;表示这是一个连接请求或连接接受报文&#xff09;&#xff0c;并发送初始报文段序号seq x&#xff0…

kali——nikto的使用

目录 前言 使用方法 查看帮助&#xff08;--help&#xff09; 常规扫描&#xff08;-h&#xff09; 指定端口扫描&#xff08;-h -p&#xff09; 目录猜解&#xff08;-h -C&#xff09; 扫描敏感目录&#xff08;-h&#xff09; 保存扫描信息 前言 linux自带的nikto工…

【Motion Forecasting】SIMPL:简单且高效的自动驾驶运动预测Baseline

SIMPL: A Simple and Efficient Multi-agent Motion Prediction Baseline for Autonomous Driving 这项工作发布于2024年&#xff0c;前一段时间我已经对这篇文章的摘要和结论进行了学习和总结&#xff0c;这一部分详见https://blog.csdn.net/Coffeemaker88/article/details/1…

快速构建一个ui界面程序--pyqt入门

快速构建一个ui界面程序--pyqt入门 0 背景1 环境准备1.1 安装python1.2 安装pyqt 2 UI设计2.1 启动UI设计可视化工具2.2 生成*.ui文件2.3 编译ui生成对应的py 3 使用UI 0 背景 本文档用于记录开发者如何快速构建一个简单UI程序。开发者使用文档中提及的工具并用于商业活动时&a…

【法如faro】三维激光软件Scene2023数据处理(自动配准并转换坐标)流程

Scene2023数据处理(自动配准并转换坐标)的主要流程为:新建项目、导入数据、处理、自动注册、坐标系转换、模型导出立和面模型导出等。 文章目录 一、新建项目二、导入数据三、处理四、自动注册五、坐标系转换六、模型导出七、立面模型导出八、创建项目点云九、导出一、新建项…

将二叉搜索树转化为排序的双向链表

题目描述 将一个 二叉搜索树 就地转化为一个 已排序的双向循环链表 。 对于双向循环列表&#xff0c;你可以将左右孩子指针作为双向循环链表的前驱和后继指针&#xff0c;第一个节点的前驱是最后一个节点&#xff0c;最后一个节点的后继是第一个节点。 特别地&#xff0c;我…

shell了解和问答机制

GUI&#xff08;图形用户界面&#xff09; 定义与特点&#xff1a; GUI全称为Graphical User Interface&#xff0c;即图形用户界面。 它是一种采用图形方式显示的计算机操作用户界面&#xff0c;允许用户使用鼠标等输入设备操纵屏幕上的图标或菜单选项&#xff0c;以选择命令…

海康二次开发学习笔记12-从Group外部输入图像

从Group外部输入图像 用OpenCV从本地读图 当Group内部无图像源模块时,可以通过代码的方式将图片传入Group内部.实现方式有多种,可以使用OpenCV从本地读图,可在程序集搜索引用OpenCvSharp&#xff0c;同时将其复制本地的属性改为False. 1. 界面设计 增加加载图像按钮 2. 处理…

【学习笔记】卫星通信NTN 3GPP标准化进展分析(二)- 3GPP Release16 内容

一、引言&#xff1a; 本文来自3GPP Joern Krause, 3GPP MCC (May 14,2024) Non-Terrestrial Networks (NTN) (3gpp.org) 本文总结了NTN标准化进程以及后续的研究计划&#xff0c;是学习NTN协议的入门。 【学习笔记】卫星通信NTN 3GPP标准化进展分析&#xff08;一&#xff…

学习Kerberos

学习Kerberos Kerberos的 是一种分布式、基于票证的身份验证服务&#xff0c;因为基于分布式&#xff0c;可能这种类型的协议我们平时接触比较少&#xff0c;Web端一般都是通过Cookie、Token、Oauth、Password等各种协议认证&#xff0c;客户端通过Ssh、Password等认证方式&am…

WAF的功能、检测、指纹及绕过

吉祥知识星球http://mp.weixin.qq.com/s?__bizMzkwNjY1Mzc0Nw&mid2247485367&idx1&sn837891059c360ad60db7e9ac980a3321&chksmc0e47eebf793f7fdb8fcd7eed8ce29160cf79ba303b59858ba3a6660c6dac536774afb2a6330&scene21#wechat_redirect 《网安面试指南》…

尝试用java spring boot+VUE3实现前后端分离部署

前言 这几天开学了&#xff0c;公司这边几个和学校对接的项目都挺忙的&#xff0c;然后我又开始有点闲的情况了。问大佬能不能继续看看若依的项目&#xff0c;大佬让我自己去学了。在看若依的项目的时候在想&#xff0c;python的FLASK后端实现和JAVA spring boot的实现差别大不…

Redis与SpringMVC的整合与最佳实践

整合Redis与Spring MVC&#xff08;现在通常是Spring Boot的一部分&#xff09;可以提高应用性能&#xff0c;特别是在处理大量数据缓存和会话状态管理方面。 下面是一些关于如何整合Redis与Spring MVC的最佳实践&#xff1a; 1. 引入依赖 首先&#xff0c;你需要在你的项目中…