Colors in procedural noise texture?

Hi all,

Is there a way to make this green and black instead of green and white: https://www.babylonjs-playground.com/#K9GLE6#5

I couldn’t find a way to change the color of the noise, only the brightness of it.

Thanks.

hi
use this
https://www.babylonjs-playground.com/#K9GLE6#6

It is not available by default but we could add it easily. Currently the noise is mainly used in the particles.

May I ask about the use case ?

1 Like

I am thinking of using this as the texture for cloaked space ships in my current project. I am curious about how this would be used with particles (I am still new to BabylonJS). Could you point me to an example?

Sure: Babylon.js Documentation

Forgive me, I have a lot to learn.

So in the example linked to on that page, the texture is defining the trajectory of the particles, yes? That is really cool but not something I would typically associate with a “texture”. I imagine it was just convenient to piggyback on the noise functions already made inside the noise texture?

Thanks for the link, btw. Very helpful.

Hi guys! I THINK I understand what is desired, here. At some rate, “speckle” a texture from transparent… into opaque. Right? Or something that simulates that.

So, let’s call the normal NOT-APPLIED ship texture… sourceTexture. It is a ship-like texture.

And let’s create and name an empty APPLIED-to-ship BJS dynamicTexture… targetTexture. It is invisible, by default.

Note: Keep in mind that the pixels in a context2d imageBuffer (a dynamic texture)… are Color4 dataType, so each pixel has an alpha setting. color4(0,0,0,1) is black, but color4(0,0,0,0) is transparent/see-thru.

When the ship de-cloaks, we could copy little 2px by 2px pieces-of sourceTexture… into/onto targetTexture… until completed.

Coooooool. Can it be done? hmm. :slight_smile:

There is also the possibility of applying the sourceTexture to the ship, but set all alpha values in the image… to 0. Then speckle it into opacity… via setting 2px by 2px chunks… to alpha=1, at some rate, until complete. This might be a browser security violation, though.

I hope I am on-topic. :smiley: I have done SOME imageBuffer work… creating “speckle-fonts” for BJS GUI textBlock fonts. link. (see paintIt function). Notice the frame rate. It is painful. :slight_smile: It makes my CPU fan speed-up.