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

杭州定制网站制作找网红推广一般怎么合作

杭州定制网站制作,找网红推广一般怎么合作,网站色彩搭配方案,注册公司代理记帐序之前#xff0c;生成了地形图#xff1a;(42条消息) 从灰度图到地形图_averagePerson的博客-CSDN博客那末#xff0c;地形的法线贴图怎么获取#xff1f;大概分为两个部分吧#xff0c;先拿到法线数据#xff0c;再画到纹理中去。关于法线计算Unity - Scripting API: M…序之前生成了地形图(42条消息) 从灰度图到地形图_averagePerson的博客-CSDN博客那末地形的法线贴图怎么获取大概分为两个部分吧先拿到法线数据再画到纹理中去。关于法线计算Unity - Scripting API: Mesh.RecalculateNormals (unity3d.com)这个链接讲的是法线的计算它是什么空间下的无所谓了……这里也不对地形搞什么几何变换而且它是方向模型空间世界空间是一个结果。获取Unity - Scripting API: Mesh.normals (unity3d.com)直接一个等于号然后这个法线是对顶点不是对三角形面片。就这两点没了。存到纹理中构造Unity - Scripting API: Texture2D (unity3d.com)这个变量好像在unity shader里也经常出现嘞要把法线数据存到Texture2D里首先得构造一下对象啊构造函数是什么Unity - Scripting API: Texture2D.Texture2D (unity3d.com)RGBA32构造RenderTexture的时候也有你。怎么赋值赋值Unity - Scripting API: Texture2D.SetPixels (unity3d.com)直接传数组数组要展平【mesh.normals其实就是一维的那就可以直接用了】最后需要Apply从左到右从下到上【地形顶点正好也是这个顺序的】官方示例代码using UnityEngine; using System.Collections;public class ExampleClass : MonoBehaviour {void Start(){Renderer rend GetComponentRenderer();// duplicate the original texture and assign to the materialTexture2D texture Instantiate(rend.material.mainTexture) as Texture2D;rend.material.mainTexture texture;// colors used to tint the first 3 mip levelsColor[] colors new Color[3];colors[0] Color.red;colors[1] Color.green;colors[2] Color.blue;int mipCount Mathf.Min(3, texture.mipmapCount);// tint each mip levelfor (int mip 0; mip mipCount; mip){Color[] cols texture.GetPixels(mip);for (int i 0; i cols.Length; i){cols[i] Color.Lerp(cols[i], colors[mip], 0.33f);}texture.SetPixels(cols, mip);}// actually apply all SetPixels, dont recalculate mip levelstexture.Apply(false);} }试一试根据文档调api就行了。代码计算法线的using System.Collections; using System.Collections.Generic; using UnityEngine;public class Terrian : MonoBehaviour {public int N 10;public Texture2D texture2dHeightMap;[Range(1,100)]public float heightRatio 30.0f;//一个系数控制地形总体的高度的public Texture2D normalTex;MeshRenderer meshRenderer;MeshFilter meshFilter;// 用来存放顶点数据ListVector3 verts;Listint indices;Vector3[] normals;private void Awake(){}private void Start(){verts new ListVector3();indices new Listint();meshRenderer GetComponentMeshRenderer();meshFilter GetComponentMeshFilter();//normalTex new Texture2D(texture2dHeightMap.width, texture2dHeightMap.height, TextureFormat.RGB24,-1,false);normalTex new Texture2D(N,N, TextureFormat.RGB24, -1, false);//2.5D的地形顶点的法线法线贴图规模不是灰度图规模}private void Update(){Generate();normals new Vector3[N * N];normals meshFilter.mesh.normals;for(int i 0; i 10; i){print(normals[i]);}Color[] colors new Color[N * N];for(int i 0; i N * N; i){colors[i] new Color(normals[i].x, normals[i].y, normals[i].z);}normalTex.SetPixels(colors);normalTex.Apply(false);}public void Generate(){ClearMeshData();// 把数据填写好AddMeshData();// 把数据传递给Mesh生成真正的网格Mesh mesh new Mesh();mesh.vertices verts.ToArray();mesh.triangles indices.ToArray();mesh.RecalculateNormals();mesh.RecalculateBounds();meshFilter.mesh mesh;}void ClearMeshData(){verts.Clear();indices.Clear();}void AddMeshData(){//01填充顶点数据for (int z 0; z N; z)//按先x后z的顶点排列顺序所以先循环的是z{for(int x 0; x N; x){int u Mathf.FloorToInt(1.0f * x / N * texture2dHeightMap.width);int v Mathf.FloorToInt(1.0f * z / N * texture2dHeightMap.height);float grayValue texture2dHeightMap.GetPixel(u,v).grayscale;float height grayValue*heightRatio;Vector3 temp new Vector3(x, height, z);verts.Add(temp);}}//02填充索引数据for(int z 0; z N - 1; z){for(int x 0; x N - 1; x){int index_lb z * N x;//index of the left bottom vertex. lb left bottomint index_lt (z 1) * N x;int index_rt (z 1) * N x 1;int index_rb z * N x 1;indices.Add(index_lb);indices.Add(index_lt);indices.Add(index_rt);indices.Add(index_rt);indices.Add(index_rb);indices.Add(index_lb);}}}}显示法线贴图的。这个是在摄像机上的——屏幕后处理嘛using System.Collections; using System.Collections.Generic; using UnityEngine;public class ShowTexture2D : MonoBehaviour {public Terrian terrian;// Start is called before the first frame updatevoid Start(){}// Update is called once per framevoid Update(){}private void OnRenderImage(RenderTexture source, RenderTexture destination){Graphics.Blit(terrian.normalTex, destination);}}结果看着……走势差不多吧。而且绿色的表示向上符合的。对不对在这种情况下没法看出来。只能接着往下做然后拔出萝卜带出泥巴。纯平面是纯绿色高度系数越大颜色越深
http://www.w-s-a.com/news/173663/

相关文章:

  • 万户网络做网站如何采集器wordpress
  • 襄阳网站建设企业查看 wordpress 插件
  • 网站地址申请京东联盟怎么做网站
  • 三亚市城乡建设局网站网站口碑营销
  • 图书租借网站 开发企业网站搜索优化外
  • 新乡个人网站建设哪家好免费的图片做视频在线观看网站
  • 洛阳工程建设信息网站山西响应式网页建设哪里好
  • 企业网站建设市场的另一面wordpress分类插件
  • 网站建设名头公司展厅装修
  • 小型购物网站开发费用郑州企业网站模板建站
  • 个体商户建自己的网站做销售建设积分兑换官方网站
  • 网站建设与维护培训网页制作专业用语
  • 建站特别慢wordpress网页制作与设计项目策划书
  • 视频制作素材免费网站头像制作在线生成器
  • 网站建设是不是可以免费建站广州做网站 信科网络
  • 闸北区网站设计叫别人做网站后怎么更改密码
  • 为什么想做网站运营建设工程教育网站
  • 站长基地百度推广整体优化网站
  • 门窗 东莞网站建设wordpress外链论坛
  • 安徽省建设部网站官网还能用的wap网站
  • 企业网站设计开发网站关键词优化seo
  • 郑州高档网站建设台州网站建设推广
  • 广东省建设信息港网站WordPress手机缩略图设置
  • 优秀网站主题平顶山专业做网站公司
  • wordpress返回顶部插件wordpress站群seo
  • 企业网站建设报价表百度竞价托管哪家好
  • 织梦网站首页打开慢淄博网站推广那家好
  • 苏州高端网站建设kgwl互动网站建设的主页
  • 宿州网站建设哪家公司好个人网站制作方法
  • 网站正能量晚上在线观看视频站长之家关键词挖掘工具