Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't change opacity anymore when upgrading from Three.js r52 to r55
    primarykey
    data
    text
    <p>Basically I'm upgrading my app, from r52 to r55. This app use animations (Tweens) for updating lines, but also a ParticleSystem. Everything worked just fine in r52, scaling, moving and changing opacity.</p> <p>I used these WebGLRenderer constructor settings:</p> <pre><code> clearColor: 0x1f1f1f clearAlpha: 1 antialias: true sortObjects: false </code></pre> <p>And a simple shader I took from the examples:</p> <pre><code>&lt;script type="x-shader/x-vertex" id="vertexshader"&gt; attribute float size; attribute vec3 customColor; attribute float customOpacity; varying vec3 vColor; varying float vOpacity; void main() { vColor = customColor; vOpacity = customOpacity; vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); gl_PointSize = size * ( 300.0 / length( mvPosition.xyz ) ); gl_Position = projectionMatrix * mvPosition; } &lt;/script&gt; &lt;script type="x-shader/x-fragment" id="fragmentshader"&gt; uniform vec3 color; uniform sampler2D texture; varying vec3 vColor; varying float vOpacity; void main() { gl_FragColor = vec4( color * vColor, vOpacity ); gl_FragColor = gl_FragColor * texture2D( texture, gl_PointCoord ); } &lt;/script&gt; </code></pre> <p>I initialized the particle ShaderMaterial using:</p> <pre><code> blending : THREE.AdditiveBlending depthTest : false transparent : false </code></pre> <p>and the ParticleSystem by manually setting:</p> <pre><code> system.sortParticles = true system.matrixAutoUpdate = true system.visible = true system.dynamic = true </code></pre> <p>So here how it renders in Three.js r52:</p> <p><img src="https://i.stack.imgur.com/Qqn9t.png" alt="before"></p> <p>Now I've read the Migration wiki page, and concluded I only had to change a few names, nothing in the WebGLRenderer constructor, materials or shaders attributes.</p> <p>I've upgraded to r55 and now visuals are broken:</p> <p><img src="https://i.stack.imgur.com/8lnsu.png" alt="after"></p> <p>Lines and particles are now all bright (opacity not taken in account).</p> <p>Moreover for particles now the alpha mask is broken (if you watch carefully the color is different, and there is a "square cut" when overlapping with other particles, something I had in r52 and fixed by simply tuning the WebGLRender settings)</p> <p>What could have changed? I tried to change settings in the WebGL constructor, alphas, background colors.. but it didn't help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload