簡體   English   中英

Three.js動畫換色控件

[英]Three.js animated color change control

我正在努力為Three.js中的動畫應用正確的色調顏色。 即使我應用了正確的色澤,例如:#008080,實際的顏色也不是綠色,而是藍色或其他顏色。 看起來有一些高光顏色的計算。 如何關閉或控制它?

  const PARTICLE_SIZE = 1;
  const textureAttr = {
    resolution: 64,
    radius: 32,
    color: '#008080'
  };

這里的工作示例:

https://jsfiddle.net/6cq1re9o/

顏色已由片段着色器修改:

// noise RGB values
float r = 1. - 2.0 * noise;
float g = 0.0;
float b = 1. - 1.0 * noise;
vec3 foo = vec3(r*2.0, g, b*1.5);

// calculate a new color using the above noise
gl_FragColor = vec4( foo, 1.0 ) * texture2D( texture, gl_PointCoord );


由於您只需要提供的十六進制顏色,因此請取消注釋並使用以下位:

 // grab the textel gl_FragColor = texture2D( texture, vec2(pos.x, pos.y) ); // or just use the noisy bit without the noise // gl_FragColor = texture2D( texture, gl_PointCoord ); 

這里的 texture2D文檔。 它只是返回紋理上點的顏色。

在這個小提琴中檢查一下。


如果要“控制”它,則需要修改用作噪聲的foo RGB顏色。


這可能只是我的意見,但是此webpack blob高度不可讀。 下次,請嘗試僅針對該問題做出一個最小的示例

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM