Practical Rendering And Computation With D3D11 书上的解释

"The Sample method allows for hardware texture filtering (minification, magnification,
and mip-map interpolation) to be performed, according to a given sampler state." p340

"When Sample is called on a texture that contains multiple mip-map levels, the mipmap
level is automatically selected based on the screen-space derivatives (also known
as gradients) of the texture coordinates." p341

总结

SampleLevel比Sample运算简单,因为它指定了mipmap-level, 不会执行texture mipmap之间的插值计算。

Texture.Sample, Offset参数的解释

https://www.gamedev.net/forums/topic/496105-directx-10-sampling-surounding-texels-in-pixel-shader-solved/

Hi there... I was wondering what the correct way is to sample surounding texels in a pixel shader?
I assume I should make a sampler state that does point sampling, then use something along these lines to read the surounding texels to implement my own interpolation:

extern Texture2D dataTexture;
SamplerState TextureSampler
{
    Filter = MIN_MAG_MIP_POINT;
    AddressU = Clamp; AddressV = Clamp;
};

float2 texelSize = float2(TexelWidth, TexelHeight);

float t0 = dataTexture.Sample(TextureSampler, input.texCoord + float2(-1, -1) * texelSize);
float t1 = dataTexture.Sample(TextureSampler, input.texCoord + float2(-1, 0) * texelSize);
float t2 = dataTexture.Sample(TextureSampler, input.texCoord + float2( 0, 0) * texelSize);
float t3 = dataTexture.Sample(TextureSampler, input.texCoord + float2( 0, -1) * texelSize);

Anyone know a better way to do this???
The reason why I have to write my own interpolation in the shader is because some of the values should not be interpolated between...
for the textures where I only have one value range, I am using the MIN_MAG_MIP_LINEAR sampler state and then do a single Sample command.

[Edited by - GoodFun on June 2, 2008 9:40:55 AM]

---------------------------------------------------
Yes, the way you're doing it is correct.

It's common to do this sort of thing when you're using a texture to store look-up values.
One thing to keep in mind is that you will probably want to offset your texture fetches by
half a pixel so that you sample in the center of the pixel instead of on the exact border.
That way you can be sure you're fetching the value you expect.

neneboricua

---------------------------------------------------
Actually, this isn't required for DirectX10. In DX10, pixel offsets refer to the centre of the pixel,
not the top-left (which was the case in DX9 and earlier).

OP: Yes, there is an easier way to do it. DX10's texture sampling functions support direct integer
texel offsets. So for example, you can just do this:

dataTexture.Sample(TextureSampler, input.texCoord, int2(-1, 0));

This will sample the texel to the immediate left of the one at input.texCoord.
This means that you don't need to manually generate and apply an offset directly to the texture coordinate,
and can use integer offsets directly.

Sc4Freak

总结

Offset 可以认为是偏移指定的纹理坐标单位。(1.0 / texels_width, 1.0 / texels_height).

转载于:https://www.cnblogs.com/hzzhouqq/p/8866519.html

HLSL Texture Object Sample 的一些笔记相关推荐

  1. ECCV 2018 MemTrack:《Learning Dynamic Memory Networks for Object Tracking》论文笔记

    理解出错之处望不吝指正. 本文模型叫做MemTrack.本文的模型是基于相似学习的,主要有两个创新点:①.设计一个动态记忆网络:②.使用门控剩余模板和初始模板,生成最终的匹配模板.模型的整体架构如下: ...

  2. CVPR 2018 《Towards High Performance Video Object Detection》论文笔记

    本学弱喜欢在本子上记笔记,但字迹又丑. 望看不懂我的字的大佬不要喷我,看得懂的大佬批评指正.

  3. ICCV 2017 《Flow-Guided Feature Aggregation for Video Object Detection》论文笔记

    本学弱喜欢在本子上记笔记,但字迹又丑. 望看不懂我的字的大佬不要喷我,看得懂的大佬批评指正.

  4. ICCV 2017 《Chained Cascade Network for Object Detection》论文笔记

    本学弱喜欢在本子上记笔记,但字迹又丑. 望看不懂我的字的大佬不要喷我,看得懂的大佬批评指正.

  5. java super object,java学习记录笔记--继承,super,Object类

    继承: Java中的继承是单继承的. 1.子类拥有父类的全部属性和方法. 可是属性和方法的修饰符不能使private. 2.能够复用父类的代码. 方法的重写须要满足的条件: a.返回值类型 b.方法名 ...

  6. Android中Intent传递Object和ArrayListObject对象---笔记

    首先看一下Intent的官方的API. 传递一些基本类型数据的方法如下: putExtra(String name, int value) putExtra(String name, String v ...

  7. BlumNet: Graph Component Detection for Object Skeleton Extraction阅读笔记

    BlumNet:用于对象骨架提取的图组件检测 摘要: 本文提出一个简单有效的框架:BlumNet,用于提取自然图像和 binary shapes 中的对象骨架.BlumNet有三方面优势:(1)图分解 ...

  8. 【显著性物体检测】【ECCV2018】Reverse Attention for Salient Object Detection【论文笔记】

    简介:在不怎么增加计算量的前提下,采用从粗到精的思想,由高级特征到低级特征,补全显著性检测的轮廓[最近很多都是基于这个思想].模型的速度与效果都占优.具体关注,是怎么实现特征的多级利用的. ECSSD ...

  9. 浅谈Object Head First Java笔记

    在java中的所有类都是从Object这个类继承出来的 实际上所有的类都是从对象给继承出来的.你可以把自己的类想象成 public class Dog extends Object{ } 如果dog类 ...

最新文章

  1. ReSimNet: drug response similarity prediction using Siamese neural networks
  2. java拦截到登陆界面,JavaWeb 使用Filter实现自动登录
  3. Facebook Auth API文档中没说清楚的事情 (2011-02-28更新)
  4. 爬虫系列之----Requests库
  5. MySQL存储过程总结(二)
  6. 如何用计算机组添加打印机共享的打印机,工作组内打印机如何共享?
  7. 论文浅尝 | 基于模式的时间表达式识别
  8. 呐,一个苹果洞赚10万美元的详细经验都在这里了~
  9. Sublime Text 3 汉化小技巧
  10. AI智能电话销售机器人源码搭建部署系统电话机器人源码
  11. python信息安全工具之端口扫描器
  12. 教你利用腾讯云cdn加速网站静态资源
  13. OSChina 周日乱弹 ——请世界不要对好人太薄情
  14. 黑苹果鼠标不动_四款热门鼠标横评,好物种草,平价好鼠标
  15. Tablayout 选中字体放大 自定义
  16. CouchDB操作手册
  17. 人工智能------>第一天,人工智能简介,机器学习简介,Numpy
  18. 基于多特征的技术融合关系预测及其价值评估
  19. 计算机原理(bilibili课程)
  20. S3C6410中断分类

热门文章

  1. msql查询指定日期
  2. 「3」Java开发环境搭建
  3. Spring IOC(控制反转)详解及示例
  4. 23 DesignPatterns学习笔记:C++语言实现 --- 2.2 Adapter
  5. Qt 二级菜单栏 中文无法输入问题
  6. uva 10161 Ant on a Chessboard 蛇形矩阵 简单数学题
  7. POJ 2455 Secret Milking Machine (二分+无向图最大流)
  8. 锁定计算机好在下游戏吗,巧用win7锁定计算机 防止孩子沉迷游戏
  9. linux中rm删除的文件是否可以恢复,Linux下用rm删除的文件的恢复方法
  10. 常见算子使用_spark快速入门(二)spark粗略流程简述及常见名词解释