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. CentOS图形界面下如何安装Eclipse和使用maven

    不多说,直接上干货! http://www.eclipse.org/downloads/packages/release/Kepler/SR2 下载到/usr/local/下,解压完成之后,我们想用这 ...

  2. <泛> C++3D数学库设计详解 简单光学几何 && 随机向量生成

    // 注:本内容为作者原创,禁止在其他网站复述内容以及用于商业盈利,如需引用,请标明出处:http://www.cnblogs.com/lv_anchoret/  Preface 当初写这个库,是为了 ...

  3. Xamarin iOS教程之编辑界面编写代码

    Xamarin iOS教程之编辑界面编写代码 Xamarin iOS的Interface Builder Interface Builder被称为编辑界面.它是一个虚拟的图形化设计工具,用来为iOS应 ...

  4. nodejs备忘总结(一) -- 基础入门

    什么是NodeJS JS是脚本语言,脚本语言都需要一个解析器才能运行.对于写在HTML页面里的JS,浏览器充当了解析器的角色.而对于需要独立运行的JS,NodeJS就是一个解析器. 每一种解析器都是一 ...

  5. Java中使用多线程、curl及代理IP模拟post提交和get访问

    Java中使用多线程.curl及代理IP模拟post提交和get访问 菜鸟,多线程好玩就写着玩,大神可以路过指教,小弟在这受教,谢谢! 更多分享请关注微信公众号:lvxing1788 ~~~~~~ 分 ...

  6. 简单的抖动运动 主要利用offset left 和 setTimeout

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  7. CentOS内核优化提示:cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: 没有那个文件或目录

    临时解决,重启失效 modprobe br_netfilter 为了开机加载上面这个模块 cat > /etc/rc.sysinit << EOF #!/bin/bash for f ...

  8. TCP编程的迷惑

    server : ip -- 192.168.96.132 client: ip--192.168.96.131 在服务端,accept函数的其中一个入参是listen-socket,会返回一个新的c ...

  9. [Asp.net core]封装Layer ui checkbox 为taghelper

    摘要 在使用checkbox,为其绑定值的时候,有些麻烦,就想着能不能用taghelper将其封装一下.直接上demo. 一个例子 using Microsoft.AspNetCore.Mvc.Ren ...

  10. 使用Axure RP原型设计实践02,自定义部件以及熟悉与部件相关面板

    本篇体验在Axure中自定义部件,并熟悉Widget Interations and Notes面板,Widget Properties and Style面板,Widget Manager面板. 在 ...