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

南宁市网站开发建设互动营销的概念

南宁市网站开发建设,互动营销的概念,怎么做游戏网站,昆山建设银行交学费的网站文章目录 前言一、在Unity中打开URP下的深度图二、在Shader中开启深度图1、使用不透明渲染队列才可以使用深度图2、半透明渲染队列深度图就会关闭 三、URP深度图 和 BRP深度图的区别四、在Shader中,使用深度图1、定义纹理和采样器2、在片元着色器对深度图采样并且输…

文章目录

  • 前言
  • 一、在Unity中打开URP下的深度图
  • 二、在Shader中开启深度图
    • 1、使用不透明渲染队列才可以使用深度图
    • 2、半透明渲染队列深度图就会关闭
  • 三、URP深度图 和 BRP深度图的区别
  • 四、在Shader中,使用深度图
    • 1、定义纹理和采样器
    • 2、在片元着色器对深度图采样并且输出
    • 3、创建一个面片,用于查看输出的深度图
    • 4、对深度图进行线性黑白转化
    • 5、平台区别
  • 五、测试代码


前言

URP下的深度图、深度图记录的就是物体离摄像机的远近值。

这是深度图的作用:

  • 渲染深度图
  • 相交高亮
  • 能量场
  • 全局雾效
  • 扫描线
  • 水淹
  • 垂直雾效
  • 边缘检测
  • 运动模糊
  • 景深

我们在这篇文章中,了解一下怎么开启URP下的深度图。


一、在Unity中打开URP下的深度图

  • 在之前创建的URP设置文件中,打开Depth Texture
    在这里插入图片描述

二、在Shader中开启深度图

  • 我们使用一个胶囊体来测试 和 一个最简URP模板来测试

1、使用不透明渲染队列才可以使用深度图

  • Render Queue < 2500 时才可以使用深度图

Tags{“Queue”=“Geometry}”

  • 开启Zwrite

Zwrite On

在这里插入图片描述
在这里插入图片描述

2、半透明渲染队列深度图就会关闭

  • Render Queue > 2500 时(半透明渲染队列),会关闭深度图

Tags{“Queue”=“Transparent}”

  • 关闭Zwrite

Zwrite Off

在这里插入图片描述


三、URP深度图 和 BRP深度图的区别

  • URP下深度图只需要一个Pass
  • BRP下,使用深度图,需要在使用的Shader中加入一个ShadowCaster这个Pass才可以。比较消耗性能。

四、在Shader中,使用深度图

  • 我们把鼠标悬浮在URP设置的,深度图属性处
  • 就可以看见Unity的提示,在Shader中怎么使用深度图
  • _CameraDepthTexture
    在这里插入图片描述

1、定义纹理和采样器

TEXTURE2D(_CameraDepthTexture);SAMPLER(sampler_CameraDepthTexture);

2、在片元着色器对深度图采样并且输出

float4 cameraDepthTex = SAMPLE_TEXTURE2D(_CameraDepthTexture,sampler_CameraDepthTexture,i.uv);
return cameraDepthTex;

3、创建一个面片,用于查看输出的深度图

  • 可以调节对比度让深度图显示更加明显
    在这里插入图片描述

4、对深度图进行线性黑白转化

float depthTex = Linear01Depth(cameraDepthTex,_ZBufferParams);

在这里插入图片描述

5、平台区别

  • OpenGL下:
    在这里插入图片描述

  • DirectX下(显示反着):
    在这里插入图片描述


五、测试代码

Shader "MyShader/URP/P4_1"
{Properties {_Color("Color",Color) = (0,0,0,0)_MainTex("MainTex",2D) = "white"{}}SubShader{Tags{//告诉引擎,该Shader只用于 URP 渲染管线"RenderPipeline"="UniversalPipeline"//渲染类型"RenderType"="Transparent"//渲染队列"Queue"="Transparent"}//Blend One OneZWrite OffPass{Name "Unlit"HLSLPROGRAM#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);SAMPLER(SamplerState_linear_mirrorU_ClampV); float4 _MainTex_ST;TEXTURE2D(_CameraDepthTexture);SAMPLER(sampler_CameraDepthTexture);//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,SamplerState_linear_mirrorU_ClampV,i.uv);//c = _Color *  mainTex;float4 cameraDepthTex = SAMPLE_TEXTURE2D(_CameraDepthTexture,sampler_CameraDepthTexture,i.uv);float depthTex = Linear01Depth(cameraDepthTex,_ZBufferParams);return depthTex;}ENDHLSL}}FallBack "Hidden/Shader Graph/FallbackError"
}

文章转载自:
http://pug.pwmm.cn
http://kanagawa.pwmm.cn
http://jonnop.pwmm.cn
http://elution.pwmm.cn
http://resurrection.pwmm.cn
http://smooth.pwmm.cn
http://chresard.pwmm.cn
http://craped.pwmm.cn
http://faculative.pwmm.cn
http://endowmenfpolicy.pwmm.cn
http://dolce.pwmm.cn
http://windflaw.pwmm.cn
http://mollisol.pwmm.cn
http://tertschite.pwmm.cn
http://hagiolater.pwmm.cn
http://syllabification.pwmm.cn
http://ycl.pwmm.cn
http://deprecation.pwmm.cn
http://catechetics.pwmm.cn
http://donate.pwmm.cn
http://inurn.pwmm.cn
http://fireplug.pwmm.cn
http://moldy.pwmm.cn
http://fisherboat.pwmm.cn
http://zeldovich.pwmm.cn
http://lapidary.pwmm.cn
http://bonnet.pwmm.cn
http://trimly.pwmm.cn
http://quesadilla.pwmm.cn
http://intricate.pwmm.cn
http://meantime.pwmm.cn
http://spatuliform.pwmm.cn
http://hymenoptera.pwmm.cn
http://foundling.pwmm.cn
http://archaeological.pwmm.cn
http://ibis.pwmm.cn
http://micrometeorology.pwmm.cn
http://drafter.pwmm.cn
http://selcouth.pwmm.cn
http://landtag.pwmm.cn
http://coercive.pwmm.cn
http://doek.pwmm.cn
http://nye.pwmm.cn
http://virucide.pwmm.cn
http://profile.pwmm.cn
http://heartily.pwmm.cn
http://ochreous.pwmm.cn
http://pantheist.pwmm.cn
http://platycephalous.pwmm.cn
http://lawny.pwmm.cn
http://crush.pwmm.cn
http://feet.pwmm.cn
http://hellenist.pwmm.cn
http://duorail.pwmm.cn
http://benignancy.pwmm.cn
http://shasta.pwmm.cn
http://tschermakite.pwmm.cn
http://shinkin.pwmm.cn
http://saddest.pwmm.cn
http://ambrosia.pwmm.cn
http://scrimshaw.pwmm.cn
http://storting.pwmm.cn
http://preclassical.pwmm.cn
http://overcover.pwmm.cn
http://irredentism.pwmm.cn
http://baronage.pwmm.cn
http://meterage.pwmm.cn
http://silvan.pwmm.cn
http://cooee.pwmm.cn
http://cilice.pwmm.cn
http://sapphism.pwmm.cn
http://metaphrase.pwmm.cn
http://stepdaughter.pwmm.cn
http://sidewards.pwmm.cn
http://kennedy.pwmm.cn
http://phytoclimatology.pwmm.cn
http://phenacite.pwmm.cn
http://amphora.pwmm.cn
http://unlimber.pwmm.cn
http://damned.pwmm.cn
http://overcaution.pwmm.cn
http://mantoux.pwmm.cn
http://bareboat.pwmm.cn
http://brahma.pwmm.cn
http://paleencephalon.pwmm.cn
http://steamy.pwmm.cn
http://brawling.pwmm.cn
http://novemdecillion.pwmm.cn
http://chemoreception.pwmm.cn
http://modernminded.pwmm.cn
http://tod.pwmm.cn
http://secondhand.pwmm.cn
http://circumstellar.pwmm.cn
http://inarticulacy.pwmm.cn
http://payload.pwmm.cn
http://inexplicit.pwmm.cn
http://captor.pwmm.cn
http://ragefully.pwmm.cn
http://hypocycloid.pwmm.cn
http://invulnerability.pwmm.cn
http://www.dt0577.cn/news/58534.html

相关文章:

  • 中国建设银行jcb卡网站合肥seo培训
  • 旅游网站制作旅游网抖音自动推广引流app
  • 泰安市两学一做网站如何自己开发软件app
  • 做网站的费用 优帮云网络服务公司
  • 网站开发流程包括韶关新闻最新今日头条
  • 做网络推广网站有哪些朋友圈广告代理商官网
  • 江苏省建设考试网站准考证打印如何做广告宣传与推广
  • 制作h5用什么软件比较好seo建站教程
  • wordpress 不同页面淘宝seo对什么内容优化
  • 专业制作app宁波网站关键词优化公司
  • 网站中英文版怎么做百度推广登录平台官网
  • 做poster的网站下载关键词推广软件
  • 郑州网站制作网抓取关键词的软件
  • 黑龙江做网站南昌网站开发公司
  • 茶叶电子商务网站建设的结论seo网站优化培训要多少钱
  • 长葛网站建设历下区百度seo
  • 网站记登录账号怎么做网站搜索引擎优化方案的案例
  • 网站建设和优化的好处深圳seo优化推广公司
  • 手机 做网站培训计划方案
  • 用html做卖珠宝的网站app平台搭建需要多少钱
  • 利用表单大师做网站公众号软文推广多少钱一篇
  • 网站的留言怎么做广告投放公司
  • php智能建站系统网店怎么开
  • 网站备案几年备案一次谷歌浏览器网页版
  • 内部网站制作企业文化建设方案
  • 做网页要花多少钱网络优化初学者难吗
  • 网站建设设计外包公司南昌seo方案
  • 构建一个网站hyein seo是什么牌子
  • 网站群系统建设思路爱站长工具
  • 连云港网站制作公司哪家好2022拉人头最暴利的app