distance field(占坑

signed distance field

https://kosmonautblog.wordpress.com/2017/05/09/signed-distance-field-rendering-journey-pt-2/

 

mesh distance field

https://docs.unrealengine.com/en-us/Engine/Rendering/LightingAndShadows/MeshDistanceFields

 

 

http://advances.realtimerendering.com/s2015/DynamicOcclusionWithSignedDistanceFields.pdf

https://www.quora.com/Computer-Graphics-How-does-the-distance-field-ambient-occlusion-work-in-the-Unreal-Engine

静态物体阴影ao 3dtexture

=================================

前段时间一直在忙 填下吧

讲下理解

generate distance field

这个 voxel是3dtexture的

存的是 worldspace一个 voxel到边缘 voxel的距离

边缘 voxel就是mesh顶点所在的 voxel

 

一个场景存一张大的3d texture包含模型和模型旁边的空间 每个 voxel都有个distance

  voxel

这步的算法可以用八叉树遍历 先标0 递归那块和二维UI那里算法是一个道理

改成遍历空间中相邻26个voxel

 

然后根据这个distance field 做遮挡

用ray marching 就是那个一圈一圈的spheretracing

 

判断明暗那个点到光源有一条连线L  此空间中的voxel有一个distance 为半径做圆到与L的下个交点再用此点的distance做圆

一直交下去 到distance为0  shadow 

能走到光源 此点照亮

---------------------------

 

下面我就一个问题了

为什么崩坏三的sdf是一圈一圈的

ue4的是这样连续的

 

https://www.shadertoy.com/view/4s2cWV

fragColor = vec4( fract(sd / max(iResolution.x, iResolution.y) * 20.) );

那一圈圈绝对是20乘出来的 但是为什么呢

====================

等下次有时间再分析

==========================================

崩坏3一圈一圈的是他们压缩存储了depth 和sdf无关 

转载于:https://www.cnblogs.com/minggoddess/p/9082933.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值