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博文目录 一.引言 ...
随机推荐
- @ControllerAdvice + @ExceptionHandler 使用
一.简介 @ControllerAdvice,是spring3.2提供的新注解,意思是控制器增强. 下面是它的解释. 大致意思是, 1.表示标有这个注解的类是一个Controller.它有一个默认行为 ...
- 015.Zabbix的日志监控配置
一 日志监控概述 Zabbix可用于集中监控和分析日志,支持有日志轮询的日志监控分析.当日志中出现相关警告信息(如警告.报错等),可以发送通知给用户.日志监控功能,必须满足以下两个条件: Zabbix ...
- k8s 集群中的etcd故障解决
一次在k8s集群中创建实例发现etcd集群状态出现连接失败状况,导致创建实例失败.于是排查了一下原因. 问题来源 下面是etcd集群健康状态: [root@docker01 ~]# cd /opt/k ...
- Spring框架学习——Spring的体系结构详解
1.Spring简介 Spring是一个轻量级Java开发框架,最早有Rod Johnson创建,目的是为了解决企业级应用开发的业务逻辑层和其他各层的耦合问题.它是一个分层的JavaSE/JavaEE ...
- Cause: java.sql.SQLException: Could not retrieve transation read-only status server
背景 最近在部署一套完整的项目,部署过程中遇到很多的问题,在来总结一些如标题的这个错误! 环境说明: 使用分布式数据库,使用的是mysql! ### Cause: java.sql.SQLExcept ...
- 使用Vmware安装linux且配置终端可以连接虚拟机总结
首先是下载一个linux镜像,我下载的是:ubuntu-16.04.2-desktop-amd64.iso 1.使用vmware安装linux,都使用默认的配置就行了,最多改一下主机名什么的,密码最好 ...
- HDU.4035.Maze(期望DP)
题目链接 (直接)设\(F(i)\)为在\(i\)点走出迷宫的期望步数.答案就是\(F(1)\). 令\(p_i=1-k_i-e_i\),表示\(i\)点沿着边走的概率:\(d_i=dgr[i]\), ...
- BZOJ2671 : Calc
设$d=\gcd(a,b),a=xd,b=yd$,则$a+b|ab$等价于$x+y|xyd$. 因为$x,y$互质,所以$x+y|d$. 假设$x<y$,那么对于固定的$x,y$,有$\lflo ...
- Xtreme9.0 - Block Art 线段树
Block Art 题目连接: https://www.hackerrank.com/contests/ieeextreme-challenges/challenges/block-art Descr ...
- Windows 10原版ISO下载地址(持续更新)
Windows 10本质上,它们与 Win7.XP 时代的 SP1.SP2.SP3 这样的大型更新版是一样的,只不过微软很蛋疼地为它们起上一个难记地要死的名字,仅此而已.如果你把“一周年更新”看作 S ...