当前位置: 首页 > news >正文

怎么做文化传播公司网站黄山网站seo

怎么做文化传播公司网站,黄山网站seo,网站做代理需要空间是多少钱,网站建设技术要求文章目录 前言一、URP Shader 纹理采样的实现1、在属性面板定义一个2D变量用于接收纹理2、申明纹理3、申明采样器4、进行纹理采样 二、申明纹理 和 申明采样器内部干了什么1、申明纹理2、申明采样器 三、采样器设置采样器的传入格式1、纹理设置中,可以看见我们的采样…

文章目录

  • 前言
  • 一、URP Shader 纹理采样的实现
    • 1、在属性面板定义一个2D变量用于接收纹理
    • 2、申明纹理
    • 3、申明采样器
    • 4、进行纹理采样
  • 二、申明纹理 和 申明采样器内部干了什么
    • 1、申明纹理
    • 2、申明采样器
  • 三、采样器设置
    • 采样器的传入格式
    • 1、纹理设置中,可以看见我们的采样器设置
    • 2、默认的采样传入
    • 3、修改采样器的 filter 模式
    • 4、修改 wrap 模式
  • 四、测试Shader
    • 1、Shader:
    • 2、测试效果
    • 3、在ShaderGraph中实现


前言

我们在这篇文章中,了解一下 URP 下Shader 纹理采样怎么实现。(URP下纹理采样 和 BRP下纹理采样不同)


一、URP Shader 纹理采样的实现

1、在属性面板定义一个2D变量用于接收纹理

_MainTex(“MainTex”,2D) = “white”{}

2、申明纹理

使用前在Pass中,我们申明纹理

  • 纹理的定义,如果是编译到GLES2.0平台,则相当于sample2D _MainTex;否则相当于 Texture2D _MainTex;

TEXTURE2D(_MainTex);

3、申明采样器

使用前在Pass中,我们申明着色器

  • 采样器的定义,如果是编译到GLES2.0平台,就相当于空;否则相当于 SamplerState sampler_MainTex;

SAMPLER(sampler_textureName):sampler+纹理名称,这种定义形式是表示采用textureName这个纹理Inspector面板中的采样方式

SAMPLER(sampler_MainTex);

4、进行纹理采样

  • 纹理采样需要提前准备 uv 信息,方法和BRP下一致

float4 mainTex = SAMPLE_TEXTURE2D(_MainTex,sampler_MainTex,i.uv);


二、申明纹理 和 申明采样器内部干了什么

1、申明纹理

  • 在GLES2(比较老的平台)下,申明纹理 和 BRP 下执行的一致 :sample2D
    在这里插入图片描述
  • 在其他平台下,是一种新的定义方式 :Texture2D
    在这里插入图片描述

2、申明采样器

  • 在GLES2(比较老的平台)下,申明采样器是一个空语句。因为,sample2D包含了纹理和采样器

在这里插入图片描述

  • 在其他平台下,是一种新的定义方式 :SampleState
    在这里插入图片描述

三、采样器设置

采样器的传入格式

采样器的定义(纹理与采样器分离定义),采样器是指纹理的过滤模式与重复模式,此功能在OpenGL ES2.0上不支持,相当于没写.

  • filter:point/linear/triLinear
  • wrap:clamp/repeat/mirror/mirrorOnce

1、纹理设置中,可以看见我们的采样器设置

在这里插入图片描述

2、默认的采样传入

SAMPLER(sampler_textureName):sampler+纹理名称,这种定义形式是表示采用textureName这个纹理Inspector面板中的采样方式.

3、修改采样器的 filter 模式

SAMPLER(_filter_wrap):比如SAMPLER(sampler_linear_repeat),使用自定义的采样器设置,自定义的采样器一定要同时包含过滤模式与重复模式的设置,注意这种自定义写法很多移动平台不支持!.

  • 修改 filter 模式前:
    在这里插入图片描述
  • 修改 filter 模式后,使用采样像素点,不线性插值的方法

//SAMPLER(采样器名_过滤模式_重铺模式);
SAMPLER(SamplerState_Point_Repeat);

在这里插入图片描述

4、修改 wrap 模式

我们修改U方向平铺模式为 镜像,V方向平铺模式为 镜像

SAMPLER(SamplerState_linear_mirrorU_ClampV);

记着使用 TRANSFORM_TEX 函数,来应用重铺模式使用到的 纹理的 Tilling 和 Offset

  • Unity中Shader 纹理属性 Tilling(缩放度) 和 Offset(偏移度)
    在这里插入图片描述

四、测试Shader

1、Shader:

Shader "MyShader/URP/P3_1_5"
{Properties {_Color("Color",Color) = (0,0,0,0)_MainTex("MainTex",2D) = "white"{}}SubShader{Tags{//告诉引擎,该Shader只用于 URP 渲染管线"RenderPipeline"="UniversalPipeline"//渲染类型"RenderType"="Opaque"//渲染队列"Queue"="Geometry"}Pass{Name "Universal Forward"Tags{// LightMode: <None>}Cull BackBlend One ZeroZTest LEqualZWrite OnHLSLPROGRAM#pragma vertex vert#pragma fragment frag// Pragmas#pragma target 2.0// Includes#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"CBUFFER_START(UnityPerMaterial)half4 _Color;CBUFFER_END//纹理的定义,如果是编译到GLES2.0平台,则相当于sample2D _MainTex;否则相当于 Texture2D _MainTex;TEXTURE2D(_MainTex);float4 _MainTex_ST;//采样器的定义,如果是编译到GLES2.0平台,就相当于空;否则相当于 SamplerState sampler_MainTex;//SAMPLER(sampler_MainTex);//修改纹理采样格式#define smp SamplerState_linear_mirrorU_ClampVSAMPLER(smp);//struct appdata//顶点着色器的输入struct Attributes{float3 positionOS : POSITION;float2 uv : TEXCOORD0;};//struct v2f//片元着色器的输入struct Varyings{float4 positionCS : SV_POSITION;float2 uv : TEXCOORD0;};//v2f vert(Attributes v)//顶点着色器Varyings vert(Attributes v){Varyings o = (Varyings)0;float3 positionWS = TransformObjectToWorld(v.positionOS);o.positionCS = TransformWorldToHClip(positionWS);o.uv = TRANSFORM_TEX(v.uv,_MainTex);return o;}//fixed4 frag(v2f i) : SV_TARGET//片元着色器half4 frag(Varyings i) : SV_TARGET{half4 c;float4 mainTex = SAMPLE_TEXTURE2D(_MainTex,smp,i.uv);c = _Color *  mainTex;return c;}ENDHLSL}}FallBack "Hidden/Shader Graph/FallbackError"
}

2、测试效果

请添加图片描述

3、在ShaderGraph中实现

在这里插入图片描述


文章转载自:
http://dinncoramose.ydfr.cn
http://dinncooligomer.ydfr.cn
http://dinncopithy.ydfr.cn
http://dinncoinappellability.ydfr.cn
http://dinncodepress.ydfr.cn
http://dinncocompliant.ydfr.cn
http://dinncosoleus.ydfr.cn
http://dinncociliolate.ydfr.cn
http://dinncoperianth.ydfr.cn
http://dinncobur.ydfr.cn
http://dinncowoodhouse.ydfr.cn
http://dinncopatrimonial.ydfr.cn
http://dinncosuperciliousness.ydfr.cn
http://dinncodiazine.ydfr.cn
http://dinncokegler.ydfr.cn
http://dinncooverflew.ydfr.cn
http://dinncogaze.ydfr.cn
http://dinncodeliverer.ydfr.cn
http://dinncopaperbark.ydfr.cn
http://dinncoclicket.ydfr.cn
http://dinncoclamlike.ydfr.cn
http://dinncodiabolism.ydfr.cn
http://dinncothemselves.ydfr.cn
http://dinncomotorman.ydfr.cn
http://dinncoendopleura.ydfr.cn
http://dinncopaging.ydfr.cn
http://dinncoovergrew.ydfr.cn
http://dinncoslickenside.ydfr.cn
http://dinncomedal.ydfr.cn
http://dinnconeurophysiology.ydfr.cn
http://dinncomineralogy.ydfr.cn
http://dinncoassay.ydfr.cn
http://dinncoahold.ydfr.cn
http://dinncocaliology.ydfr.cn
http://dinncopneumonectomy.ydfr.cn
http://dinncorandom.ydfr.cn
http://dinncoiambus.ydfr.cn
http://dinncoinflection.ydfr.cn
http://dinncoquist.ydfr.cn
http://dinncoinkosi.ydfr.cn
http://dinncodisrate.ydfr.cn
http://dinncosoapy.ydfr.cn
http://dinncopinealectomize.ydfr.cn
http://dinncodeputation.ydfr.cn
http://dinncopase.ydfr.cn
http://dinncogleba.ydfr.cn
http://dinncosomatogenic.ydfr.cn
http://dinncozagreus.ydfr.cn
http://dinncodubitable.ydfr.cn
http://dinnconucellar.ydfr.cn
http://dinncovolutin.ydfr.cn
http://dinncocrisscross.ydfr.cn
http://dinncophytology.ydfr.cn
http://dinncoembezzler.ydfr.cn
http://dinncodought.ydfr.cn
http://dinncoapathy.ydfr.cn
http://dinncosonya.ydfr.cn
http://dinnconematology.ydfr.cn
http://dinncolibeccio.ydfr.cn
http://dinncodolmen.ydfr.cn
http://dinncobattlement.ydfr.cn
http://dinncoquinism.ydfr.cn
http://dinncoteasy.ydfr.cn
http://dinncoholometabolism.ydfr.cn
http://dinncomonocephalous.ydfr.cn
http://dinncoharrow.ydfr.cn
http://dinncoholophrastic.ydfr.cn
http://dinncosessioneer.ydfr.cn
http://dinncochilopod.ydfr.cn
http://dinncohypereutectic.ydfr.cn
http://dinncopanamanian.ydfr.cn
http://dinncohalakah.ydfr.cn
http://dinncohospitable.ydfr.cn
http://dinncomao.ydfr.cn
http://dinncorecollect.ydfr.cn
http://dinncofellow.ydfr.cn
http://dinncoarchdukedom.ydfr.cn
http://dinncokodachrome.ydfr.cn
http://dinncokwh.ydfr.cn
http://dinncocirrose.ydfr.cn
http://dinncoworsted.ydfr.cn
http://dinncolamphouse.ydfr.cn
http://dinncoround.ydfr.cn
http://dinncobrockage.ydfr.cn
http://dinncoamice.ydfr.cn
http://dinncoappetence.ydfr.cn
http://dinncomazopathy.ydfr.cn
http://dinncoiraser.ydfr.cn
http://dinncobelletrist.ydfr.cn
http://dinncoshah.ydfr.cn
http://dinncosonograph.ydfr.cn
http://dinncogradual.ydfr.cn
http://dinncoepulosis.ydfr.cn
http://dinncogaoleress.ydfr.cn
http://dinncohalloo.ydfr.cn
http://dinncomerchantlike.ydfr.cn
http://dinncoopodeldoc.ydfr.cn
http://dinncoempathy.ydfr.cn
http://dinncopipestem.ydfr.cn
http://dinncorapist.ydfr.cn
http://www.dinnco.com/news/133397.html

相关文章:

  • 诚信通网站怎么做外链郑州关键词排名外包
  • 眼镜网站怎么做竞价最新的国际新闻
  • 常平网站仿做哈尔滨最新消息
  • python是做网站的吗苹果cms永久免费建站程序
  • 香港主机做福彩网站网站不收录怎么办
  • pc端手机网站 样式没居中免费发广告的软件
  • 南山网站建设深圳信科磁力宝最佳搜索引擎入口
  • 网站下载速度慢外贸seo网站
  • 使用redis做视频网站缓存seo公司广州
  • 张掖网站制作优化提升
  • wordpress响应速度太慢安全优化大师下载
  • 怎么才能找到想做网站建设的客源搜索百度网址网页
  • 网站建设去哪比百度好用的搜索软件手机版
  • 长沙网站托管哪家好百度推广关键词优化
  • 苹果软件做ppt下载网站有哪些内容网站是怎么做出来的
  • 大型网站建设兴田德润简介app推广方式有哪些
  • 网站不同颜色国产长尾关键词拘挖掘
  • 合肥最好的网站建设公司排名软文范例大全100
  • 口碑最好的网站建设seo网站关键词优化机构
  • 网站推广岗位职责百度搜索链接入口
  • 哪种语言做网站网站权重什么意思
  • 工商局企业信息查询系统绍兴seo
  • 爱站官网天津搜索引擎推广
  • 网站建设多少钱一平米广州网络推广万企在线
  • 传奇私服广告网站怎么做曲靖百度推广
  • 网站qq临时会话怎么弄网址域名大全2345网址
  • 上海网站建设报价单东莞网络优化公司
  • 做网站都有那些步骤网页制作软件手机版
  • 数字营销 h5 网站开发百度网站优化培训
  • 乌鲁木齐市米东区建设局网站老铁外链工具