我想将纹理图像文件包含在我的collada文件中.现在我有很多文件:.dae本身和.png纹理文件.
但是我只想要一个文件:.dae,但包含了纹理.
我可以以某种方式将.png图像存储在.dae文件中吗?可能吗?先感谢您!
我的场景中有很多圈子(白色圆圈和不同颜色的圆圈).我想只模糊白圈.(在我的情况下,白色表示(1,1,1).)
我的问题是:我应该如何使用片段着色器选择并模糊白色片段?
我想在GLSL中做这样的事情:
if (my_current_fragment's_color == white)
{blur current fragment;}
else
{do not blur current fragment}
Run Code Online (Sandbox Code Playgroud)
(我有一个有效的模糊效果,但它不适当地模糊了整个场景,因为我根据片段的颜色无法在我的代码中做出决定.)
我该怎么做?GLSL语言中上述代码的完全匹配是什么?如何确定片段的颜色是否为白色?你们有什么想法吗?
如果您需要,这是我的代码:
vertexShader: [
//"#define KERNEL_SIZE 25.0",
"uniform vec2 uImageIncrement;",
"varying vec2 vUv;",
"void main() {",
"vUv = uv - ( ( KERNEL_SIZE - 1.0 ) / 2.0 ) * uImageIncrement;",
"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
"}"
].join("\n"),
fragmentShader: [
//"#define KERNEL_SIZE 25",
"uniform float cKernel[ KERNEL_SIZE ];",
"uniform sampler2D tDiffuse;",
"uniform vec2 uImageIncrement;",
"varying vec2 vUv;",
"void …Run Code Online (Sandbox Code Playgroud) 我在three.js中有一个简单的网格(实现到three.js-master\examples\webgl_loader_collada_keyframe.html):
function init() {
...
...
var sphereGeometry = new THREE.SphereGeometry( 50, 32, 16 );
var sphereMaterial = new THREE.MeshLambertMaterial( {color: 0x8888ff} );
var sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);
sphere.position.set(10, 10, 10);
scene.add(sphere);
Run Code Online (Sandbox Code Playgroud)
我想在函数 animate() 中更改此网格的位置;
我已经尝试了几件事,但下面的例子都没有工作:
1.:
sphere.position.set = new THREE.Vector3(20, 20, 20);
Run Code Online (Sandbox Code Playgroud)
2.:
sphere.position.set(20, 20, 20);
Run Code Online (Sandbox Code Playgroud)
3.:
sphere.position.x += 1;
Run Code Online (Sandbox Code Playgroud)
4.:
sphere.translateX(50);
Run Code Online (Sandbox Code Playgroud)
结果每次都是黑屏。
奇怪的是,我可以在同一代码区域中更改相机和灯光的位置:
pointLight.position.set(10, 20, 03);
camera.position.set(12, 44, 13);
camera.lookAt(new THREE.Vector3(33, 45, 54));
Run Code Online (Sandbox Code Playgroud)
然而,网格的 position.set 失败了。是否可以在函数 animate() 中更改网格的位置?
我试过了:
"sphere.position.x = 20;"
Run Code Online (Sandbox Code Playgroud)
结果是一个黑色的窗口。
您可以在下面看到详细的控制台日志:
日志对“sphere.position.x = 20;”上方行的注释: …
是否可以将我的3D模型导出或转换为GLSL ES 2.0?对于像Blender/3DS MAX/Maya这样创建GLSL ES 2.0代码的编辑程序,是否有任何转换器或任何导出工具/插件?
我想在上面提到的任何编辑器中方便地创建我的模型,然后我想将它们导出/转换为GLSL ES 2.0.
我已经有一个显示着色器的模板WebGL代码.我想用转换器或导出工具自动创建的GLSL ES代码替换片段着色器和顶点着色器部件.
我想做这样的事情(但对于GLSL ES 2.0): Blender到GLSL