扩展 - THREE.MeshBasicMaterial [英] Extending - THREE.MeshBasicMaterial

查看:34
本文介绍了扩展 - THREE.MeshBasicMaterial的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望制作 THREE.MeshBasicMaterial 的副本,并基于它创建我自己的修改材质.我需要稍微编辑着色器,并添加一些制服(但我可以处理).

I am looking to make a copy of THREE.MeshBasicMaterial, and create my own modified material based on it. I will need to edit the shader a little, and add some uniforms ( but I can deal with that ) .

首先,我想让材质工作就像 MeshBasicMaterial 一样,然后从那里拿东西.

For a start I would like to have the material work just like MeshBasicMaterial and take things from there.

这是我糟糕的尝试(我开始的地方),它不起作用:https://gist.github.com/karimbeyrouti/80c00a6b3731f52fe173

This is my poor attempt (where I started), which is not working: https://gist.github.com/karimbeyrouti/80c00a6b3731f52fe173

在threejs中如何基于MeshBasicMaterial创建新材质?

How do you create a new material based on MeshBasicMaterial in threejs ?

推荐答案

这张幻灯片可能会有所帮助
https://speakerdeck.com/yomotsu/low-level-apis-using-three-dot-js?slide=22

this slide might be helpful
https://speakerdeck.com/yomotsu/low-level-apis-using-three-dot-js?slide=22

将 ShaderMaterial 与内置的 Shader-Chunks 一起使用.
https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderLib.js

Use ShaderMaterial with build-in Shader-Chunks.
https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderLib.js

然后你可以制作自己的扩展MeshBasicMaterial.

then you can make own extended MeshBasicMaterial.

这篇关于扩展 - THREE.MeshBasicMaterial的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆