https://github.com/ConfettiFX/The-Forge/blob/master/CommonRaytracing_3/ThirdParty/DXR/doc/D3D12%20Raytracing%20Functional%20Spec.docx

dxr的spec 好难找

D3D12 Raytracing Functional Spec

https://github.com/NVIDIAGameWorks/Falcor/releases

https://github.com/Microsoft/DirectX-Graphics-Samples/blob/master/Samples/Desktop/D3D12Raytracing/readme.md

https://github.com/Microsoft/DirectX-Graphics-Samples/blob/master/Libraries/D3D12RaytracingFallback/readme.md

http://forums.directxtech.com/index.php?topic=5860.0

初始化拿到device 对rtx开一些特殊设置

fallback是个模拟rtx的库 api和硬件的rtx不太一样要专门写

初始化各种资源 初始化rtx专有资源

pso

as

加速结构 top bottom

top是对bottom的一个transform 数据本身在bottom

可以有一组bottome 每个里面又可以有很多geometry

语法参见        bottomLevelBuildDesc.NumDescs = static_cast<UINT>(geometryDescs.size());

它公用dx12的cmd自己再这个cmd上面建一个rtx的cmd

有五种shader可以写

hit 里面的光照是 光线打到的物体上的光照 比如反射 了abc 是abc物体的光照 而不是反射平面本身的材质光照

从传统光栅化shader到这种hit的光照shader的转换

vs部分的pos normal uv之类的 从hit的结果能拿到

只port ps光照部分即可 返回光照结果

几天没见pix长进了

https://blogs.msdn.microsoft.com/pix/gpu-captures/

看上去不错

https://blogs.msdn.microsoft.com/pix/2018/07/24/pix-1807-19-shader-table-viewer/

dx12和dxr都可以debug 需要把dxr的dll copy到pix.exe的位置

gpu hang的debug

https://blogs.msdn.microsoft.com/pix/tdr-debugging/

https://docs.microsoft.com/zh-cn/windows/desktop/direct3d12/using-d3d12-debug-layer-gpu-based-validation

https://blogs.msdn.microsoft.com/pix/programmatic-capture/

很强大

https://blogs.msdn.microsoft.com/pix/remoting/

远程连接

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

dx12 rootsignature  ---SRV CBV UAV 初始到各个slot

m_device->CreateConstantBufferView(&cbvDesc, m_cbvHeap->GetCPUDescriptorHandleForHeapStart()); 用这句连

CB--View --descriptorHeap

init 的时候把这些连上

render的时候 用这种方式更新 m_commandList->SetGraphicsRootDescriptorTable(0, m_cbvHeap->GetGPUDescriptorHandleForHeapStart()); 用heap更新slot

update更新了cb本身

dxr里面有shadertable 是upload buffer--committed resource

一条layout是一个shader rootsig mat等等

auto DispatchRays = [&](auto* commandList, auto* stateObject, auto* dispatchDesc)
{
dispatchDesc->HitGroupTable.StartAddress = m_hitGroupShaderTable->GetGPUVirtualAddress();
dispatchDesc->HitGroupTable.SizeInBytes = m_hitGroupShaderTable->GetDesc().Width;
dispatchDesc->HitGroupTable.StrideInBytes = m_hitGroupShaderTableStrideInBytes;
dispatchDesc->MissShaderTable.StartAddress = m_missShaderTable->GetGPUVirtualAddress();
dispatchDesc->MissShaderTable.SizeInBytes = m_missShaderTable->GetDesc().Width;
dispatchDesc->MissShaderTable.StrideInBytes = m_missShaderTableStrideInBytes;
dispatchDesc->RayGenerationShaderRecord.StartAddress = m_rayGenShaderTable->GetGPUVirtualAddress();
dispatchDesc->RayGenerationShaderRecord.SizeInBytes = m_rayGenShaderTable->GetDesc().Width;
dispatchDesc->Width = m_width;
dispatchDesc->Height = m_height;
commandList->DispatchRays(stateObject, dispatchDesc);
};

DispatchRays 可以把三种shader的起始地址连上

cbv之类的更新同dx12

namespace RootSignatureSlots = LocalRootSignature::AABB::Slot;
CD3DX12_ROOT_PARAMETER rootParameters[RootSignatureSlots::Count];
rootParameters[RootSignatureSlots::MaterialConstant].InitAsConstants(SizeOfInUint32(PrimitiveConstantBuffer), 1);
rootParameters[RootSignatureSlots::GeometryIndex].InitAsConstants(SizeOfInUint32(PrimitiveInstanceConstantBuffer), 2);

ThrowIfFailed(D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, &error), error ? static_cast<wchar_t*>(error->GetBufferPointer()) : nullptr);
ThrowIfFailed(device->CreateRootSignature(1, blob->GetBufferPointer(), blob->GetBufferSize(), IID_PPV_ARGS(&(*rootSig))));

建立的时候 每条shaderrecord里面matID是不一样的 在hitshader里面

uint materialID = MaterialID;
uint triangleID = PrimitiveIndex();

RayTraceMeshInfo info = g_meshInfo[materialID];

const uint3 ii = Load3x16BitIndices(info.m_indexOffsetBytes + PrimitiveIndex() * 3 * 2);
const float2 uv0 = GetUVAttribute(info.m_uvAttributeOffsetBytes + ii.x * info.m_attributeStrideBytes);
const float2 uv1 = GetUVAttribute(info.m_uvAttributeOffsetBytes + ii.y * info.m_attributeStrideBytes);
const float2 uv2 = GetUVAttribute(info.m_uvAttributeOffsetBytes + ii.z * info.m_attributeStrideBytes);

就可以用这种方式matID拿到具体数据

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

hit之后的顶点信息有两种方式可以获取 gloable /local sig

gloable的方式 需要传matID每次用这个ID从大的buffer(vb包含所有mesh)作为偏移拿到具体 pos uv normal tangent信息

另一种local的方式 每个hit shader传 自己的vb数据(initialze的时候每块mesh来处理 生成不同的 shader和vb)作为cb传入 用hit时的primitiveIndex拿到相应数据

这样hit的mat也都是每块mesh不一样的了

==========

这是些intric val

Values \ shaders

Ray dispatch system values:

uint2 DispatchRaysIndex()

uint2 DispatchRaysDimensions()

Ray system values:

float3 WorldRayOrigin()

float3 WorldRayDirection()

float RayTMin()

float RayTCurrent()

uint RayFlags()

Primitive/object space system values:

uint InstanceIndex()

uint InstanceID()

uint PrimitiveIndex()

float3 ObjectRayOrigin()

float3 ObjectRayDirection()

float3x4 ObjectToWorld()

float3x4 WorldToObject()

Hit specific system values:

uint HitKind()

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

draw() rastization

dispatch() compute

dispatchRays() raytracing

invoke

DXR的更多相关文章

  1. 让IIS7.0.0.0支持 .iso .7z .torrent .apk等文件下载的设置方法

    IIS默认支持哪些MIME类型呢,我们可以这样查看:打开IIS管理器(计算机--管理--服务和应用程序--Internet信息服务(IIS)管理器:或者Win+R,输入inetmgr,Enter),在 ...

  2. IIS配置MP3/MP4/OGG/flv等资源文件访问

    配置过程参考:http://www.cnblogs.com/EasonJim/p/4752399.html 以下包含了mp4的mime类型: 323 text/h323 acx application ...

  3. 【积累篇:他山之石,把玉攻】Mime 类型列表

    按照内容类型排列的 Mime 类型列表 类型/子类型 扩展名 application/envoy evy application/fractals fif application/futurespla ...

  4. Socket实现仿QQ聊天(可部署于广域网)附源码(4)-加入数据库系统搭建完成

    1.前言 这是本系列的第四篇文章,上一篇我们讲到实现了客户端对客户端的抖屏与收发各种类型文件,本篇文章我们加入SQLServer数据库实现登录与好友的添加等功能,并对界面做了美化处理.向往常一样我会把 ...

  5. Android应用中实现系统“分享”接口

    在android下各种文件管理器中,我们选择一个文件,点击分享可以看到弹出一些app供我们选择,这个是android系统分享功能,我们做的app也可以出现在这个列表中. 第一步:在Manifest.x ...

  6. ios UIWebView 在开发中加载文件

    UIWebView 在实际应用中加载文件的时候,有两种情况, 1. 实行在线预览 , 2. 下载到本地,再查看 如果是第一种情况: NSURL *url = [NSURL URLWithString: ...

  7. gnuplot: 一种更为简洁的曲线,柱状图绘图软件

    gnuplot: 一种更为简洁的曲线,柱状图绘图软件 gnuplot: 一种更为简洁的曲线,柱状图绘图软件 Zhong Xiewei Wed Jun 25 gnuplot简单介绍 关于gnuplot的 ...

  8. Moon.Orm性能报告

    以下为有网友公司的评估测试及使用规范 大家可以下载word看看 http://pan.baidu.com/s/1hquvRuc 一.和ADO.NET进行的压力测试 说明:2000并发用户,此图为一网友 ...

  9. Lind.DDD.Utils.HttpHelper里静态对象引出的Http超时问题

    回到目录 Lind.DDD.Utils.HttpHelper组件主要实现了对HTTP的各种操作,如Get,Post,Put和Delete,它属于最纯粹的操作,大叔把它封装的目的主要为了实现与API安全 ...

随机推荐

  1. phpcms v9表单向导添加验证码

    要做留言板的功能,故用添加表单,想要在提交留言前加一个验证码的功能.网上的教程比较混乱,于是亲自实验了下,步骤如下: 首先是调用表单的页面加入验证码.表单js调用模版默认的是 \phpcms\temp ...

  2. angularJS的MVC的用法

    1.前端MVC: M:Model,数据库 V:HTML页面 C:Control控制器 比较很有名的前端MVC框架:ExtJs 2.angularJS的MVC框架搭建 index.html代码如下: & ...

  3. 微软企业库5.0 学习之路——第五步、介绍EntLib.Validation模块信息、验证器的实现层级及内置的各种验证器的使用方法——下篇

    一.独立验证器 我上篇中我将AndCompositeValidator和OrCompositeValidator归为独立验证器,这2个验证器主要是为了第一类验证服务,可以进行多种验证组合在一起进行复杂 ...

  4. nodejs pm2使用

    参考地址:http://www.jianshu.com/p/43525232b03b 参考地址:http://blog.csdn.net/leo_perfect/article/details/536 ...

  5. hdu 1874 畅通工程(spfa 邻接矩阵 邻接表)

    题目链接 畅通工程,可以用dijkstra算法实现. 听说spfa很好用,来水一发 邻接矩阵实现: #include <stdio.h> #include <algorithm> ...

  6. python+django+vue搭建前后端分离项目

    以前一直是做基于PHP或JAVA的前后端分离开发,最近跟着python风搭建了一个基于django的前后端分享项目 准备工作:IDE,[JetBrains PyCharm2018][webpack 3 ...

  7. HDU 1097.A hard puzzle-快速幂/取模

    快速幂: 代码: ll pow_mod(ll a,ll b){      ll ans=;      while(b){          ==){              ans=ans*a%mo ...

  8. Luogu P3258 松鼠的新家(树链剖分+线段树/树状数组)

    题面 题解 这种题目一看就是重链剖分裸题,还是区间修改,单点查询,查询之前在遍历时要记一个\(delta\),因为这一次的起点就是上一次的终点,不需要放糖,所以可以用\(BIT\)来写,但我写完\(m ...

  9. Python开发基础-Day5-字符编码、文件处理和函数基础(草稿)

    字符编码 为什么要有字符编码? 字符编码是为了让计算机能识别我们人写的字符,因为计算机只认识高低电平,也就是二进制数"0","1". 一个文件用什么编码方式存储 ...

  10. 【rope】bzoj1269 [AHOI2006]文本编辑器editor

    维护一个字符串,支持以下操作:   主要就是 成段插入.成段删除.成段翻转.前两个操作很好通过rope实现.第三个操作也不难,维护两个rope,一个正向,一个反向,翻转时swap一下就行了.   ro ...