zoukankan      html  css  js  c++  java
  • 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无关 

  • 相关阅读:
    1.7 Matrix Zero
    1.6 Image Rotation
    Snake Sequence
    安装 Docker
    开源蓝牙协议栈 BTstack学习笔记
    无法从 repo.msys2.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件
    KEIL生成预编译文件
    Duff's device
    Pyinstaller : unable to find Qt5Core.dll on PATH
    HCI 获取蓝牙厂商信息
  • 原文地址:https://www.cnblogs.com/minggoddess/p/9082933.html
Copyright © 2011-2022 走看看