Closed chaht01 closed 6 years ago
Okay, I finally got what makes problem.
In the part of Init
function, I initially assign uPointCellWidth
as object.
No matter what I coded after that line as blotterMaterial.needUpdate = true
, I observed that changes in render
function cannot be applied even with needsUpdate = true
.
So I changed blotterMaterial.uniforms.uPointCellWidth = { type: "1f", value: 0.01 }; // (R, G, B)
as blotterMaterial.uniforms.uPointCellWidth.value = 0.01;
and it finally works well.
But I think it seems weird and needs to be updated whenever modify uniforms' property as object itself.
Any idea?
Hi @chaht01 yeah that makes complete sense. The initial object for a uniform tells the material how to prepare its values when passing them to the fragment shader function. Unless youre writing your own materials (which would include writing their fragment shaders), you should really never set the uniform object itself like that, as the materials Blotter comes with are prebuilt examples whose shader functions depend on the uniforms being of the type
they are initially defined as ('1f'
in this case).
Setting uniform value
s as you did in your second comment is the way to use Blotter.
Hi, I'm new to both threejs and Blotter! After I read document about it and I intend to change some uniforms of FliesMaterial but it doesn't look like working
The overall structure is composed with init, animate, and render function as below.
Based on documentation, I understood
needsUpdate
can be called acrossblotter
,material
and so on. I tried callneedsUpdate
astrue
with myblotter
instance but alsoblotterMaterial
but it didn't work.What mistake that I made? Thanks.