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

商城移动端网站开发seo首页关键词优化

商城移动端网站开发,seo首页关键词优化,建筑工程最新规范查询,wordpress后台所有栏目都404文章目录 介绍自定义shaderNodeMaterial骨骼材质特殊处理 介绍 Tri-panner 在babylonjs中有支持 但是three.js目前的基础材质并不支持 需要自己定义shader 或者使用目前还没有什么完善的文档的 NodeMaterial 下面展示两种实现方式 自定义shader /*** description: 替换三角面…

文章目录

        • 介绍
          • 自定义shader
          • NodeMaterial
          • 骨骼材质特殊处理

请添加图片描述

在这里插入图片描述

介绍

Tri-panner 在babylonjs中有支持 但是three.js目前的基础材质并不支持
需要自己定义shader 或者使用目前还没有什么完善的文档的 NodeMaterial

下面展示两种实现方式

自定义shader
/*** @description: 替换三角面贴图  https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/triPlanarMat* @param {SingleMaterialMesh} mesh* @return {*}*/
export const useTriplanarMapping = (mesh: SingleMaterialMesh) => {const material = mesh.material.clone();mesh.material = material;material.map!.wrapS = THREE.RepeatWrapping;material.map!.wrapT = THREE.RepeatWrapping;material.onBeforeCompile = (shader) => {shader.vertexShader = shader.vertexShader.replace("#include <common>",`#include <common>varying vec3 tripPosition;varying vec3 tripNormal;`);shader.vertexShader = shader.vertexShader.replace("#include <fog_vertex>",`#include <fog_vertex>vec4 tripPosition4 = modelMatrix * vec4(position,1.) ;tripPosition = tripPosition4.xyz;tripNormal = normal * normalMatrix;vec3 world_space_normal = vec3(modelMatrix * vec4(normal, 0.0));tripNormal = normal;`);shader.fragmentShader = shader.fragmentShader.replace("#include <common>",`#include <common>varying vec3 tripPosition;varying vec3 tripNormal;vec3 blendNormal(vec3 normal){vec3 blending = abs( normal );blending = normalize(max(blending, 0.00001)); // Force weights to sum to 1.0 float b = (blending.x + blending.y + blending.z);blending /= vec3(b, b, b);return blending;}vec3 triplanarMapping (sampler2D tex, vec3 normal, vec3 position) {vec3 normalBlend = blendNormal(normal);vec3 xColor = texture(tex, position.yz).rgb;vec3 yColor = texture(tex, position.xz).rgb;vec3 zColor = texture(tex, position.xy).rgb;return (xColor * normalBlend.x + yColor * normalBlend.y + zColor * normalBlend.z);}`);shader.fragmentShader = shader.fragmentShader.replace("#include <map_fragment>",`#include <map_fragment>diffuseColor.rgb = vec3(triplanarMapping( map ,tripNormal,tripPosition));`);// shader.fragmentShader = shader.fragmentShader.replace(//     "#include <color_fragment>",//     `//     #include <color_fragment>//     diffuseColor.rgb = vec3(triplanar_mapping( map ,tripNormal,tripPosition,1.0));// `// );};
};
NodeMaterial

这是threejs新系统充满未来 目前还没有一个完善的文档 并且不太稳定 r132的时候支持这个材质 r138就被删除了 一些api也都有变化 可以先参考 https://raw.githack.com/sunag/three.js/dev-nodes-doc/docs/index.html#manual/en/introduction/How-to-use-node-material

import {MeshBasicNodeMaterial,texture,triplanarTexture,
} from "three/examples/jsm/nodes/Nodes.js";
import { nodeFrame } from "three/examples/jsm/renderers/webgl/nodes/WebGLNodes.js";const skyMat = new MeshBasicNodeMaterial();skyMat.colorNode = triplanarTexture(texture(this.helper.loadTexture("/public/textures/coral_stone_wall_diff_1k.jpg",(map) => {map.colorSpace = THREE.SRGBColorSpace;map.wrapS = THREE.RepeatWrapping;map.wrapT = THREE.RepeatWrapping;}))
);
skyMat.side = THREE.DoubleSide;const sky = new THREE.Mesh(new THREE.SphereGeometry(2, 32, 15), skyMat);
scene.add(sky);animation() {nodeFrame.update();
}

要注意每一次render 同时调用 nodeFrame.update(); 否则报错

骨骼材质特殊处理

这个问题需要根据three版本进行区别处理

r160版本 使用的是 position
r155版本使用的是 nodeUniform2 * vec4( 忘了叫什么了, 1.0 )
总之每个版本可能不一样 因为 节点系统正在开发 需要对应版本对应处理

r160版本写法如下

material.onBeforeCompile = (shader) => {material.vertexShader = shader.vertexShader.replace("#include <skinning_vertex>",`#include <skinning_vertex>nodeVarying2 = (modelMatrix * vec4(transformed,1.0)).xyz;`);
};

r155版本写法如下

material.onBeforeCompile = (shader) => {material.vertexShader = shader.vertexShader.replace("#include <skinning_vertex>",`#include <skinning_vertex>nodeVarying2 = ( nodeUniform2 * vec4( transformed, 1.0 ) );`);};
http://www.15wanjia.com/news/43202.html

相关文章:

  • 香港公司怎么做网站正规引流推广公司
  • 郑州网站排名外包商城网站建设
  • 济南网站建设山东酷风买卖链接网站
  • 申请网站免费谷歌搜索引擎seo
  • 哪里学做网站免费做网页的网站
  • 设计门户网站广州网站建设公司
  • 营销型网站建设原则市场调研报告怎么写范文
  • 还有哪些网站可以做淘宝活动吗搜索引擎关键词快速优化
  • ui特效网站seo关键词排名软件流量词
  • 怎么在网站里做网页seo排名怎样
  • 阿里妈妈新建网站怎么做新闻头条最新消息今天
  • 做网站比较专业的公司精准营销方式有哪些
  • 政府网站建设工作室百度广告关键词价格表
  • 营销型网站建设选择题关键词歌词完整版
  • 自己做的网站怎么上传到域名线上销售水果营销方案
  • wordpress 即时八宿县网站seo优化排名
  • 门户网站域名是什么神马seo服务
  • asp网站做搜索网页设计网站
  • 东莞网站建设音乐盒北京seo公司司
  • 广东网站建设服务商百度官网电话
  • 恩平国有建设用地使用权拍卖网站网站设计培训
  • 深圳做网站哪家专业seo岗位培训
  • 做民俗酒店到哪些网站推荐网络推广seo怎么做
  • 茂名优化网站建设seo系统
  • 怎样做网站设计seo从0到1怎么做
  • 网站模板上传教程视频教程百度关键词排名点击
  • 上海知名网站制作公司网络推广服务费
  • seo是指搜索引擎优化网站排名优化价格
  • 招生网站开发的背景百度推广创意范例
  • 一级做a爰片香蕉视频网站怎样在百度上发布自己的信息