惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
博客园_首页
WordPress大学
WordPress大学
博客园 - 聂微东
P
Privacy International News Feed
Forbes - Security
Forbes - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Last Week in AI
Last Week in AI
C
CERT Recently Published Vulnerability Notes
月光博客
月光博客
NISL@THU
NISL@THU
美团技术团队
T
Tailwind CSS Blog
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Hacker News
The Hacker News
B
Blog
P
Palo Alto Networks Blog
L
Lohrmann on Cybersecurity
有赞技术团队
有赞技术团队
The Register - Security
The Register - Security
S
Securelist
A
Arctic Wolf
MyScale Blog
MyScale Blog
H
Help Net Security
N
Netflix TechBlog - Medium
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
Threatpost
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Security Latest
Security Latest
T
Tor Project blog
V
Vulnerabilities – Threatpost
V
V2EX
AI
AI
Hugging Face - Blog
Hugging Face - Blog
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
Simon Willison's Weblog
Simon Willison's Weblog
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Heimdal Security Blog
Google Online Security Blog
Google Online Security Blog
Know Your Adversary
Know Your Adversary

博客园 - 稻草人的麦田

[导入]显卡对于mipmap选择的研究 [导入]仔细研究了lithtech中的根据类名创建对象 [导入]光照优缺点 [导入]蜗牛的笔试题目 [导入]一个开发休闲游戏的程序组人与分配方案 [导入]运动模糊的制作 [导入]格里高里的数学题 [导入]水彩化 [导入]伪 HDR/Blow [导入]描边,只是换了个过滤器而已 [导入]锐化模糊 [导入]卷积积分(转) [导入]马赛克 [导入]hlsl的浮雕效果 [导入]游戏出了一个demo [导入]图形文件的格式(转载) [导入] 一些色彩方面的知识 [导入]流浪歌手 [导入][转载]游戏引擎列表
[导入]再贴个圆形马赛克
稻草人的麦田 · 2007-10-17 · via 博客园 - 稻草人的麦田

感觉做这些很没技术含量的东西往blog上贴很丢人。可是还想贴,算是记录吧。再丢下人好了。

圆形马赛克:

代码如下:

float4 PS_Textured( vertexOutput IN): COLOR
{
float2 curTex = tex2D( TextureSampler, IN.texCoordDiffuse );
  float4 diffuseTexture;
 
if(IN.texCoordDiffuse.x < IN.texCoordDiffuse.y)
 diffuseTexture =  float4(1.0,0.0,0.0,1.0);
else
   diffuseTexture = tex2D( TextureSampler, IN.texCoordDiffuse );
  
   float2 mosAicSize = float2(18,18);
   float2 realXY = float2(IN.texCoordDiffuse.x * 512 ,IN.texCoordDiffuse.y * 256 );
   float2 xyMos = float2( int(realXY.x/mosAicSize.x) * mosAicSize.x,
           int(realXY.y/mosAicSize.y) * mosAicSize.y)
            + 0.5 * mosAicSize;
    float len = length( realXY-xyMos);
           
   if(len<0.5*mosAicSize.x)
   {
   float2 cxy = float2(xyMos.x/512,xyMos.y/256);
   diffuseTexture = tex2D(TextureSampler,cxy);
   }
  return IN.diffAmbColor*diffuseTexture +IN.specCol;
}

其实换了个物体,环境光和镜面光都没有用上。但还是写上去了。马赛克直径是18,还有我假设了贴图宽度是512,高度是256。因为不知道怎么在nvdia fx composer里面穿入贴图的宽度和高度。丢下人好了。

文章来源:http://songxiaoyu8.blog.163.com/blog/static/208181282007917102848305