凹进去的博客


  • 首页

  • 归档

  • 标签

UnityShader学习记录(二)

发表于 2024-09-08

UnityShader(二)

tiling是在该轴上重复的次数,如下图:

image-20240905203424773 image-20240905203511789

在纹理选项中可以选择换行模式,可以自己试试。

image-20240905203541563

repeat和clamp分别效果如下,3D模式最好用repeat

image-20240905203724175 image-20240905203823853

如何将图贴到想要的材质上去?

image-20240905204953425

在reset shader的时候要怎么不让纹理丢失?

image-20240905211722930 image-20240905211758617

打开材质球的debug模式,若将_Tex命名为MainTex是unity内置的基本贴图的变量写法。这样在不同shader中变换的时候贴图不会丢失。在后面的编程中作为规范来使用。

image-20240905212742351 image-20240905213512614

将纹理颜色与指定颜色混合

将颜色属性的值和贴图uv的值相乘,就可以得到下图类似于“中毒的效果”,但由于颜色值在0-1之间,所以无法做到“闪白”的效果。

闪白和火焰都会增大亮度,所以可以通过加法来实现。

image-20240905214311702

使用裁剪片断实现溶解效果

UnityShader学习记录(一)

发表于 2024-09-05

Unityshader概览

在not supported(暂时)中可以找到自己写的shader
材质

shader

作业7 顶点属性可视化
图表1

1.模型的本地坐标

步骤1:获取模型坐标,不用把模型空间转换到裁剪空间的坐标。

在v2f中定义VertexPos作为模型坐标,v2f中定义的变量一定要有语义,TEXCOORD也不只能用于纹理,所以这里借TEXCOORD0来定义。

                float3 VertexPos:TEXCOORD0;

步骤2:把三维的模型坐标做成四维从片段着色器输出。

            return float4(i.VertexPos.xyz,1.0)

as7-1

Shader "aj7/Framework"  // 定义shader名字
{
Properties
{
_Color("Color",Color)=(1,1,1,1)
_Value("Intensity",float)=1
}
SubShader //一个shader中有多个subshader,系统会一个个往下遍历找,不支持的会跳过
{
pass //一个pass就是一次渲染,每个shader都要有一个pass块
{
CGPROGRAM

#pragma vertex vert //编译指令,连接顶点和片段着色器
#pragma fragment frag
#include "UnityCG.cginc"

float4 _Color; //声明必须和属性名一样,不然对应不上
float _Value;

struct appdata //约定叫appdata结构体
{
float4 vertex:POSITION;
float4 color:COLOR0; //direct3D中用0
};

struct v2f
{
float4 pos:SV_POSITION;
float3 VertexPos:TEXCOORD0;
};

v2f vert(appdata v)//顶点着色器
{
v2f o=(v2f)0; //定义需要初始化,不然容易报错 ;注意是定义部分加括号
o.pos=UnityObjectToClipPos(v.vertex); //顶点着色器中必做这步,把模型空间转换到裁剪空间
o.VertexPos=v.vertex.xyz;
return o;
}
float4 frag(v2f i):SV_Target //sv_t是输入到屏幕的颜色
{
float4 tmp=float4(1,1,1,1);
tmp=float4(i.VertexPos,1.0);
return tmp;
}
ENDCG
}
}
//CustomEditor ""//自定义修改器
//Fallback ""//备胎,适用于subshader都不支持的情况
}

2.模型的UV信息

Properties

[HDR]_Color(“颜色”,color)=(1,1,0,1)

[PowerSlider(3)]_Float(“浮点数”,range(0,10))=0 让0-3的部分占比更大更好滑动

[IntRange]只能滑动成整数,只是用于滑动条

[Toggle]开关,只有0和1

​ _Vector(“四维向量”,vector)=(1,-0.2,0,1)

​ _2DTex(“二D纹理”,2D)=”black”{}

[NoScaleOffset]不可调整纹理和偏移

[HideInInspector]隐藏

雅思作文示例

发表于 2024-06-21

作文题1 图表

图表1
关键词:占比 上升趋势 更多的
The line graph above shows the habits of people buying and drinking coffee and tea in five cities in Australia.
According to the chart,people in Melbourne have the most interest in coffe and tea,with about 63% of them have gone to a cafe in the past four weeks.There’s only a samll margin between Hobart and Melbone,as almost 63% of peple in Hobart went to a cafe. There’s only a small margin between Hobart and Melbone,as almost 63% of people have the habit.
In the five cities of Australia,people prefer instant coffee rather than fresh coffee.People who bought instant coffee in the past four weeks make up over half of people went to a cafe on Hobart,but only 35 percentage of them bought fresh coffee.The least of them are people in Brishane,where only a proportion of 50% people went to a cafe.

作文题2 议论

图表2

关键词:拥有 大量的(单/复数) 非常好的
思考:
In recent years, there have been more and more people in some countries who prefer purchasing a home on their own rather than renting one.

There may be many reasons accounting for this phenomenon. Firstly, in many countries, the ownership of a house is related to whether the kids of the household can go to school and receive a fabulous education. Secondly, owning a home means that people have no concerns about being asked to move out of the house by the renter at any time, which offers a strong sense of safety and stability for people, Aside from these factors, people who buy a house can decorate their rooms and choose a renovation arbitrarily regardless of how strange they are. I used to rent a house with strangers when I was an intern, it bothered me so much that I had to tolerate the noise they made and share the private space with them. That is the reason why I also prefer to have a house on my own.
From my humble perspective, it will have more advantages if people would rather purchase their new house. Instead of renting a house for several periods(不许加of time 重复), owning a house will cost a large amount of fortune in many countries, which not only cultivates a tendency for young people to save their money and regulate their unreasonable desires but also has a positive effect on governments’ revenue of selling areas to the enterprises who sell the houses.
To summarize, I think people’s rising need for owning a house can indirectly improve the prosperity of the country.

得分:6.5

The chart and the form below illustrate the causes attributing to land degradation in the dimension of worldwide field and regions including North America,Europe and Oceania.
The pie chart clearly shows three main reasons for land degradation.Among all of them,over-grazing occupies the biggest proportion of 35%.Following is deforestation,which accounts for 30% of land-degration. Over-cultivation is also an important cause, only 2% lower than deforestation at 28%.Aside from the three main causes,there also remains 7% of other reasons making up for the land degradation.
The form below concretely shows the statistics of the causes responsible for the land degradation by region.Eroupe,which has the highest total land degraded percentage,is mostly influenceded by deforestation at 9.8%. Even the lowest proportion ——over-grazing is up to 5.5%.Oceania’s land degraded situation is the best among the three continents at 13% only. In contrast to Europe,over-grazing is the leading reason with the highest proportion of 11.3% in Oceania.The lowest of that is over-cultication at 0%.In North America,the lands are least degraded comparing to Europe and Oceania,with the highest figure of over-cultivation at 3.3%.
In conclusion,over-grazing is the most common cause of land-degration all over the world.

修改稿:
The pie chart and table below illustrate the causes contributing to land degradation worldwide and in specific regions, including North America, Europe, and Oceania.

The pie chart clearly shows three main reasons for land degradation. Among all of them, over-grazing occupies the largest proportion at 35%. Following this is deforestation, which accounts for 30% of land degradation. Over-cultivation is also a significant cause, only 2% lower than deforestation at 28%. Besides these three main causes, there remains 7% attributed to other reasons.

The table concretely shows the statistics of the causes responsible for land degradation by region. Europe, which has the highest total land degraded percentage, is mostly affected by deforestation at 9.8%. Even the lowest proportion, over-grazing, is up to 5.5%. Oceania’s land degradation situation is better among the three regions at 13%. In contrast to Europe, over-grazing is the leading cause with the highest proportion of 11.3% in Oceania. The lowest is over-cultivation at 0%. In North America, the lands are least degraded compared to Europe and Oceania, with the highest figure being over-cultivation at 3.3%.

In conclusion, over-grazing is the most common cause of land degradation worldwide.

范文
The pie chart and table illustrate the primary causes of agricultural land degradation globally and in three regions: North America, Europe, and Oceania.

The pie chart reveals that over-grazing is the leading cause of worldwide land degradation, accounting for 35% of the total. Deforestation follows closely at 30%, while over-cultivation contributes 28%. Other causes make up the remaining 7%.

The table provides a regional breakdown of land degradation causes during the 1990s. Europe experienced the highest total land degradation at 23%, with deforestation being the primary contributor at 9.8%. Over-cultivation and over-grazing also significantly affected Europe, with percentages of 7.7% and 5.5%, respectively.

In Oceania, 13% of the land was degraded, with over-grazing being the predominant cause at 11.3%. Deforestation contributed 1.7%, while over-cultivation had no impact.

North America had the lowest total land degradation at 5%. Over-cultivation was the major cause at 3.3%, followed by over-grazing at 1.5% and deforestation at 0.2%.

In summary, over-grazing is the most prevalent cause of land degradation globally, with each region having specific primary causes contributing to their land degradation levels.

This version is more concise and polished, ensuring better clarity and readability. It also makes use of varied sentence structures and vocabulary to enhance the overall quality of the response.

草稿纸

发表于 2024-06-02

今日这一篇便当作日记,随意而写。
头好痛。好晕,我真的好困。
白色宋体中文在黑色屏幕上蜿蜒着爬至行尾,上一秒还清楚的字迹下一秒就出现重影,很难想象我才22岁,现在才10点。
我的意识无法清醒。
我知道我今晚要修改毕设,加上一张图,还要再写致谢,甚至这一切做完了我还可以做ppt。
但我实在没有力气。
我到底怎么了。
我试图将这一切归罪到它上,可它已经陪伴我一个多月之久,照理说不应再继续打搅我的生活。
我的指尖在键盘上不断跳跃着,稍微有了点意识。
刹那间困意又随着浑浊的空气带入鼻腔。
那就写些东西吧。

你可以通过想要与此事结果 但我真的好困

微信规则怪谈

尊敬的用户,Wechat是一款提供线上聊天服务的应用,您可以使用微信自由的添加、删除您的好友,并在运营商允许的网络环境下进行联络。

微信使用者规则

1.微信有日间和夜间模式两种可选,您可以随意使用日间模式,但切记不可在夜间开启夜间模式。
一旦在夜间开启夜间模式,立刻联系,不要添加任何新的用户。
2.您可以通过语音通话功能和您的好友进行联络
3.微信底部有且只有一个通讯录选项,且若您选择夜间模式则,注意不要相信任何颜色相反的图标中的提示。
4.若您不慎点击到了相反的,反复告诉自己不要相信任何人的话,不论对方是否就在你的身边。
5.您可以通过视频通话功能和您的好友进行联络,时刻注意对方是否为镜面人像。
6.您可以适当进行休息,时刻注意您的群聊和联系人个数,好友个数减少为正常现象,此为系统正常删档操作,不要多想,不要多想。一旦被它们发现您已经意识到它们的存在,将会有不可预料的事情发生

微信开发者规则

如何用hexo发布博客

发表于 2024-05-27

本篇简单记录发布博客的过程。
在建立好自己的网站仓库后,使用hexo网站进行部署。

部署

github教程:使用Hexo从0到1搭建个人博客详细教程(超详细,超简单)-腾讯云开发者社区-腾讯云 (tencent.com)

gitee教程:Hexo+Github搭建免费博客|基础教程(一):全网最细致全面的教程 - 少数派 (sspai.com)

其中github中涉及ssh的部分需要注意不够写的详细,如果第一次设置需要:

cd ~/.ssh #检查本机是否已经存在 SSH 密钥
ssh-keygen -t rsa -C ”邮件地址“ # 不用引号

然后连续3次回车,最终会生成一个文件在“用户”目录下,打开“用户”目录(C:\用户\用户名.ssh)并找到id_rsa.p ub文件,用“记事本”打开并复制里面的内容,在 Github 主页的右上角进入 Setting -> 左侧菜单栏“SSH and GPG keys” -> New SSH Key -> 填写你获得的 SSH Key。

发文

Hexo博客教程(二)| 如何写作新文章并发布-腾讯云开发者社区-腾讯云 (tencent.com)

创建新的博客:

hexo new <title>
配置项 意义
title 网页文章标题
date 文章创建如期
comments 文章评论功能是否启动
tags 文章标签
categories 文章分类
keywords 文章关键字

接下来输入以下命令即可发布:

hexo clean
hexo g
hexo d

若要预览,则:

hexo s

下载主题

来吧,我最爱的环节,说不定哪天有事没事就又要换一个主题了!

hexo有很多主题,这里用简洁的Paper

random-yang/paper: 一个类纸风的主题paper 🎉 (github.com)

在 theme/paper 目录下的 _config.yml 文件中进行配置社交账号

social:
Github: https://github.com/yours
Codepen: https://codepen.io/yours
Dribbble: https://dribbble.com/yours
twitter: https://twitter.com/yours
知乎: https://www.zhihu.com/people/yours
掘金: https://juejin.im/user/yours
Mail: mailto:xxx@yourmail.xxxx
Rss: your-rss-link-url
# ...
# and more, you can add other link by the same way

更新主题

找到hexo目录,gitclone,这里以next为例

git clone --branch v5.1.2 https://github.com/iissnan/hexo-theme-next themes/next

如果clone太慢或网络不好,可以使用镜像站如https://githubfast.com/

git clone --branch v5.1.2 https://githubfast.com//iissnan/hexo-theme-next themes/next  

上传图片

在使用hexo上传图片时,一直遇到问题显示不出来,不缩放时使用markdown语法可以正常展示,但一旦使用html标签来控制缩放就不对了。
原因是使用了post_asset_folder插件,这个插件会在创建新的日志时新建文件夹,然后你的图片就只能放在它的文件夹里,就算删掉了文件夹,把图片路径改了,并且在yaml文件里设置了root\,也还是不能直接让所有图片路径基于根路径生成。

解决这个问题光删掉这个插件还不够,还要删掉hexo-asset-image。

hexo-asset-image
作用:这个插件帮助处理文章内的图片路径,尤其是当你使用 post_asset_folder 时。如果你之前使用过并且启用了这个插件,即使关闭了 post_asset_folder,插件仍然可能影响路径生成。
解决方案:确认你是否安装并启用了该插件。如果你不再使用 post_asset_folder,可以尝试卸载或禁用它。

删掉之后使用绝对路径就好!
在sources文件夹中添加了0908文件夹并放了image-20240905203424773.png,直接按下面这个写:
i

不要用相对路径:
i

(第一种可以在网页上正常显示,但在vscode里索引不到!原因是在yaml里设置了图片路径根据github根目录生成,但这和vscode里的根目录不是同一个)

Hello World

发表于 2024-05-27

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

$ hexo new "My New Post"

More info: Writing

Run server

$ hexo server

More info: Server

Generate static files

$ hexo generate

More info: Generating

Deploy to remote sites

$ hexo deploy

More info: Deployment

6 日志
2 标签
© 2024 aojinqu
由 Hexo 强力驱动
主题 - NexT.Pisces