cull/clip distance example
http://www.gamedev.net/topic/578866-d3d10-how-to-increase-maxcount-of-sv_clipdistance/
The D3D#_CLIP_OR_CULL_DISTANCE_* values are #defines in the d3d11.h header file. For distance count the value is 8 and for element count the value is 2. This means you can have any number of clip or cull values provide that their sum is 8 or less and that they must be fit into 2 vec4 registers.
In D3D10+ you have to code the math yourself in the shader to put the vertex through the plane equation and then store the resulting distance value in one of the registers. Values greater than or equal to zero should not be clipped/culled. The values you provide will be interpolated so that each pixel is clipped appropriately.
Here is an example, using just cull distance.
cbuffer ClipPlanes
{
float4 planes[6];
};
struct VS_OUT
{
float4 pos : SV_Position;
float4 clips[2] : SV_CullDistance;
};
VS_OUT vsmain( float4 pos : SV_Position )
{
VS_OUT vsout = (VS_OUT)0;
vsout.pos = pos;
for( uint i = 0; i < planes.Length; ++i )
{
((float[8])vsout.clips)[i] = dot( planes[i].xyz, pos.xyz ) - planes[i].w;
}
return vsout;
}
下面D3D文档中对ClipDistance和CullDistance的描述。gpu将会在体元装配阶段进行这些clip和cull操作。

cull/clip distance example的更多相关文章
- A trip through the Graphics Pipeline 2011_10_Geometry Shaders
Welcome back. Last time, we dove into bottom end of the pixel pipeline. This time, we’ll switch ...
- NV 200, 300, 400, 500, 600, 700, 800
NV GF6系列架构分析(GPU gem2 读书笔记) http://www.cnblogs.com/wangdaniu/archive/2006/02/20/334089.html 总线带宽:PCI ...
- ROS学习记录(二)————使用smartcar进行仿真(用.xacro文件来运行rviz)
我发现一个学习ROS系统的好网站: 创客智造http://www.ncnynl.com/ 这里面关于ROS的各个方面都有很详细的介绍. 这周,不,上周我对整个ROS是绝望的,我用一个一个下午的时间在敲 ...
- 引擎设计跟踪(九.14.3) deferred shading 准备
目前做的一些准备工作 1.depth prepass for forward shading. 做depth prepass的原因是为了完善渲染流程, 虽然架构上支持多个pass, 但实际上从来没有测 ...
- Robot Operating System (ROS)学习笔记2---使用smartcar进行仿真
搭建环境:XMWare Ubuntu14.04 ROS(indigo) 转载自古月居 转载连接:http://www.guyuehome.com/248 一.模型完善 文件夹urdf下,创建ga ...
- rviz1
msckf_vio ####查看topic列表:wj@wj-Inspiron-5437:~$ rostopic list/benchmark_publisher/path/cam0/image_raw ...
- rviz2
VINS-Mono ####Panels: 面板: - Class: rviz/Displays 显示1 Help Height: Name: Displays Property Tree Widge ...
- ros下单目相机校正
1. 安装对应的驱动与程序包. 图像对应包 http://wiki.ros.org/camera_calibration 在gitbub下载image_pipeline : ...
- PyQt+moviepy音视频剪辑实战2:一个剪裁视频文件精华内容留存工具的实现
专栏:Python基础教程目录 专栏:使用PyQt开发图形界面Python应用 PyQt+moviepy音视频剪辑实战 专栏:PyQt入门学习 老猿Python博文目录 老猿学5G博文目录 一.引言 ...
随机推荐
- 循序渐进学.Net Core Web Api开发系列【2】:利用Swagger调试WebApi
系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:https://github.com/seabluescn/Blog_WebApi 一.概述 既然前后端 ...
- Orleans核心功能
一.Grain持久性 二.定时器和提醒 三.依赖注入 四.观察者 五.无状态工作者Grains 六.流 一.Grain持久化 1,Grain持久化目标 ①允许不同类型的存储提供者使用不同类型的存储提供 ...
- c# HttpWebRequest 和HttpWebResponse 登录网站或论坛(校内网登陆)
这是登录校内网的代码呵呵自己注册一个试试吧我的账号和密码就不给了 不过可以加我为好友 冯洪春 貌似校内上就我一个 Form1.cs代码: using System;using System ...
- django权限管理
当我们为应用创建一个Models, 在同步到数据库里,django默认给了三个权限 ,就是 add, change, delete权限. 首先,我们创建一个perm_test的project, 然后再 ...
- 求有向图的强连通分量个数 之 Kosaraju算法
代码: #include<cstdio> #include<cstring> #include<iostream> using namespace std; ][] ...
- Java_Certificates does not conform to algorithm constraints
java.security.cert.CertificateException: Certificates does not conform to algorithm constraints SSL证 ...
- IMG镜像写盘工具physdiskwrite,用于MikroTik RouterOS的安装(Windows)
常用img的备份: 1.linux下使用dd,Windows下使用WinImage 2.或者还有很多,比如再生龙等等. img还原: 1.Win32DiskImager 2.physdiskwrite ...
- Unity3D对安卓盒子的支持
一般的安卓盒子主要按键包含 1.方向键:上下左右 2.确认 3.返回 4.音量(Unity无法获取),须要在安卓层将事件发上来,KeyCode = 24,25 基本的函数是 if (Input.Get ...
- Programming 2D Games 读书笔记(第四章)
示例一:Game Engine Part 1 更加完善游戏的基本流程 Graphics添加了以下几个方法,beginScene和endScene提高绘图,showBackbuffer去掉了clea ...
- oracle linux dtrace
http://docs.oracle.com/cd/E37670_01/E38608/html/pref.html