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的更多相关文章

  1. 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 ...

  2. NV 200, 300, 400, 500, 600, 700, 800

    NV GF6系列架构分析(GPU gem2 读书笔记) http://www.cnblogs.com/wangdaniu/archive/2006/02/20/334089.html 总线带宽:PCI ...

  3. ROS学习记录(二)————使用smartcar进行仿真(用.xacro文件来运行rviz)

    我发现一个学习ROS系统的好网站: 创客智造http://www.ncnynl.com/ 这里面关于ROS的各个方面都有很详细的介绍. 这周,不,上周我对整个ROS是绝望的,我用一个一个下午的时间在敲 ...

  4. 引擎设计跟踪(九.14.3) deferred shading 准备

    目前做的一些准备工作 1.depth prepass for forward shading. 做depth prepass的原因是为了完善渲染流程, 虽然架构上支持多个pass, 但实际上从来没有测 ...

  5. Robot Operating System (ROS)学习笔记2---使用smartcar进行仿真

    搭建环境:XMWare  Ubuntu14.04  ROS(indigo) 转载自古月居  转载连接:http://www.guyuehome.com/248 一.模型完善 文件夹urdf下,创建ga ...

  6. rviz1

    msckf_vio ####查看topic列表:wj@wj-Inspiron-5437:~$ rostopic list/benchmark_publisher/path/cam0/image_raw ...

  7. rviz2

    VINS-Mono ####Panels: 面板: - Class: rviz/Displays 显示1 Help Height: Name: Displays Property Tree Widge ...

  8. ros下单目相机校正

    1. 安装对应的驱动与程序包. 图像对应包   http://wiki.ros.org/camera_calibration          在gitbub下载image_pipeline :    ...

  9. PyQt+moviepy音视频剪辑实战2:一个剪裁视频文件精华内容留存工具的实现

    专栏:Python基础教程目录 专栏:使用PyQt开发图形界面Python应用 PyQt+moviepy音视频剪辑实战 专栏:PyQt入门学习 老猿Python博文目录 老猿学5G博文目录 一.引言 ...

随机推荐

  1. java实现最小堆

    1.堆:通常通过二叉堆,实为二叉树的一种,分为最小堆和最大堆,具有以下性质: 任意节点小于它的所有后裔,最小元在堆的根上. 堆总是一棵完全树 将根节点最大的堆叫做最大堆或大根堆,根节点最小的堆叫做最小 ...

  2. C语言一些基础知识

    #include<bits/stdc++.h> #include<bits/stdc++.h>包含C++的所有头文件,看见别人用这个函数,然后就能直接用vector,set,s ...

  3. zoj 3460 二分+二分图匹配

    不错的思想 /* 大致题意: 用n个导弹发射塔攻击m个目标.每个发射架在某个时刻只能为 一颗导弹服务,发射一颗导弹需要准备t1的时间,一颗导弹从发 射到击中目标的时间与目标到发射架的距离有关.每颗导弹 ...

  4. Western Subregional of NEERC, Minsk, Wednesday, November 4, 2015 Problem A. A + B

    Problem A. A + B 题目连接: http://opentrains.snarknews.info/~ejudge/team.cgi?SID=c75360ed7f2c7022&al ...

  5. hdu 5773 The All-purpose Zero 线段树 dp

    The All-purpose Zero 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5773 Description ?? gets an seq ...

  6. Revit API创建详图视图

    start //创建详图视图 Transaction ts = new Transaction(doc, "http://greatverve.cnblogs.com"); ts. ...

  7. 内存映射函数remap_pfn_range学习——代码分析(3)

    li {list-style-type:decimal;}ol.wiz-list-level2 > li {list-style-type:lower-latin;}ol.wiz-list-le ...

  8. How To Create A Local Repository For SUSE Linux

    原文地址:http://candon123.blog.51cto.com/704299/1009294/ As you know,you can use the yum command to inst ...

  9. 禁止浏览器backspace键(退格键)时跳转页面(extjs,javascript)

    Ext实现方式: //方法一  var key = new Ext.KeyMap(document,{   key: 8,   fn: function(obj,e){    var type = e ...

  10. 安全:CSRF

    原文地址:http://baike.baidu.com/view/1609487.htm?fr=aladdin. 攻击通过在授权用户访问的页面中包含链接或者脚本的方式工作.例如:一个网站用户Bob可能 ...