سؤال

I'm trying to track down where exactly the fragment and vertex shaders are being set after creating a Three.js material, with little luck. Using the ParticleSystemMaterial, I have

material = new THREE.ParticleSystemMaterial();
console.log(material);

Looking at the developer console in Firefox, I can see fragmentShader and vertexShader both set with default values:

Object Properties from Browser Console

However, I'm curious where these values are coming from. Tracing back from the source code from ParticleSystemMaterial.js and Material.js, I don't see anything explicitly stating where these shaders are set. I'm assuming they're being pulled at some point from ShaderLib.js, but nothing in either source codes seems to indicate this being done at all.

Does anyone have any idea about this?

هل كانت مفيدة؟

المحلول

The shader for ParticleSystemMaterial is THREE.ShaderLib[ 'particle_basic' ], and it can be found in the source files ShaderLib.js and ShaderChunk.js.

The material-to-shader assignments can be found in the method WebGLRenderer.initMaterial() in WebGLRenderer.js.

three.js. r.67

Note: PaticleSystem is being renamed to PointCloud, and PaticleSystemMaterial is being renamed to PointCloudMaterial in r.68dev.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top