UPDATE 2
I have successfully integrated custom attributes using THREE.js. Each pass in the vertex shader is now aligned with the position attribute, resulting in an efficient solution with minimal code.
An example will be added later
UPDATE 1
This method assigns alpha values to vertices based on the velocity range within a bounding box. I am seeking advice on how to handle GLSL code repetition per vertex; it seems a bit confusing to me?
Should I use functions? If so, how?
In any case, here is my current implementation:
//for .x
if (position.x > 0.0) {
if (velocityPosition.x + (velocities.x*shutterSpeed) > boundingBoxMaxView.x) {
influence = position.x/boundingBoxMax.x;
velocityPosition.x += (velocities.x*shutterSpeed*influence);
}
} else if (position.x < 0.0) {
if (velocityPosition.x + (velocities.x*shutterSpeed) < boundingBoxMinView.x) {
influence = position.x/boundingBoxMin.x;
velocityPosition.x += (velocities.x*shutterSpeed);
}
}
//for .y
if (position.y > 0.0) {
//To-Do
} else if (position.y < 0.0) {
//To-Do
}
//for .z
if (position.z > 0.0) {
//To-Do
} else if (position.z < 0.0) {
//To-Do
}
Upon reflection, I realize that the code may need some tweaking.
Previous Post >
I am working on an application where objects move rapidly and require a better description in terms of their motion, such as flying saucers with blurs and light trails. How can I achieve this special effect?
I have begun implementing the foundation for achieving this effect based on per-object-motion-blur, along with extensive documentation available at the following collaboration link:
Is it possible to incorporate light blurs specifically for the brighter sections of a cube?
uniforms: {
//velocity: {type: "f", value: velocity},
//uVelocityScale: {type: "f", value: uVelocityScale},
//speed: {type: "f", value: uVelocityScale},
//nSamples: {}
},
//attributes: {
//}