Perlin Noise examples ( + GPU particles and misc)

I did a workshop at Resonate on using Perlin noise for various things. All the examples are available here:


Hello @hahakid,

this is really amazing work! Very educational to see what can be done with various form of noise in creating (or deconstructing) geometry and color. Playing with the examples as we speak…

Thanks for sharing!

these are gorgeous thanks for putting this up!

You’re most welcome!

Any questions just pop them on here and I’ll do my best.

Noise is quite an interesting, sometimes underrated, topic so I find these code examples very insightful and useful. Tried all the examples and they worked perfectly on OF 0.8.4. using Windows Code::Blocks (after generating the appropiate project files with the ProjectGenerator). Excellent work, thanks for sharing! :smile:

they are fantastic, thanks for sharing

Fantastic Works!

Thanks for those, i have been playing with the examples and they are super. Im hopping that someday i was able to go to one of those workshops…

I have a question not directly related to peril noise but related to your code… Can you explain a little how did you do to pass the depthmap of the kinect to the shader to put the position of the primitives, i down really understand how do you convert from the kinect coords to screen coords.

thanks for sharing the workshop !!!


So the whole technique for that is based on:

  • Make a texture that has a potential spawn position for each particle
  • Every frame, fill in this texture with new locations, even though the particle may not respawn that frame.

The ParticleSystemSpawnTexture example has the most basic example of this, won’t link as the embed gets a bit messy here, but around line 47 I’ve got this video playing, if it has a new frame I check for pixels with non-zero values (a mask) and map that to a 3d coordinate in a made up way, then add it to a list of potential spawn positions.

Then on line 109, I fill in the spawn texture with positions from this list of positions. This is then picked up in the InstancedSpawntexture/GL2/Update.frag shader as u_spawnPosTexture.

So for the Kinect it’s never passing the depth map to the shader, but rather the KinectManager has a bounding box it checks against, then offers up the valid point cloud to do something with.

So if we look at the KinectParticles example, around line 92 there you can see it do the same as in the previous example, but as a source we’ve grabbed a point cloud from the KinectManager with the points we are interested in, then that is what is passed along to the shader.

Hope that helps!

Thanks, that helps a lot !!!

I think that im beginning to understand, so you never pass the depth map texture, you fill a buffer with the positions of the point that are inside the “active area” defined on KinectManager, use that buffer to fill a texture that its passed to the shader.

How can you know that the texture spawnPosTexture its big enough to cover all the points that come from spawnPosBuffer?

Thanks again for your time !!!


So the spawnPosTexture has one entry for each of the particles, it’s initialised to be the same size as our particle data texture.

So in the KinectParticles example, starting on line 97 there you can see that I just loop through each pixel of the spawnPosTexture (or for each particle if you see it like that), pick a random point from the valid positions and save it in there.

So that’s a bit wasteful as you are doing it each frame and most of the time the particles won’t use it, only when they respawn, but you then get the speed back by the rest running on the GPU.

I see now that in ParticleSystemSpawnTexture if pickRandom = false then you could potentially get a crash if spawnPositions.size() is smaller than texture w * h, old stuff from the sketching stage, removing it.

Does that answer you question?


Yeeep, i understand

Thanks for your patient :slight_smile: your answers help me a lot!!

thanks for providing these amazing codes! one question, some of your projects need ofxAutoReloadedShader. but ofxAutoReloadedShader does not compile with VS2012.


Oh yes, ofxAutoReloadedShader got updated to support the OF master branch, this branch should work:


I am trying to run the solution files provided for the particleCloudGPU example. I am using Visual Studio 2015 and the latest version of OF. But I am getting several errors regarding the POCO library. Such as,
‘Poco’ has no member named ‘File’
It seems like there are a few member functions which are not available. Strangely enough I was able to run the code on CodeBlocks. I simply made my own project and added the header and source files.

Another problem is with the KinectPartcles example. It runs neither on Codeblocks or VS 2015. VS 2015 gives me the following error when I compile the solution.

Could anyone please give any idea on how to run the KinectParticles example? Thank you.

Hi, the project files are all for OF 0.8.4, you can use the project generator that came with your OF download to generate new project files that are compatible.


Thank you for the reply. But I am still getting the same error even after generating a new project and then replacing the header and source file. I have also added the necessary addons. All the errors are regarding the Poco class. Such as,

Severity Code Description Project File Line Suppression State
Error C2039 ‘RegularExpressionException’: is not a member of ‘Poco’ Grass C:\drivers\of_v0.9.0_vs_release\addons\ofxSerial\libs\ofxSerial\src\SerialDeviceUtils.cpp 51

Severity Code Description Project File Line Suppression State
Error C2039 ‘File’: is not a member of ‘Poco’ Grass C:\drivers\of_v0.9.0_vs_release\addons\ofxAutoReloadedShader\src\ofxAutoReloadedShader.cpp 175

Any suggestion will be much appreciated.
Thanks again for answering and regards.


ofxSerial I’m not sure about, that’s not being included with the original project.

ofxAutoReloadedShader, check that you are running the latest version, not the 0.8.4 version as stated in the setup instructions for 0.8.4, as that has a fix for compiling in 0.9:

You can just replace ofxAutoReloadedShader with an ofShader, you’ll need to change the include path to something like this though where you see it, it’ll be “Shaders/Common/etcetc” and should be:

#pragma include "../../Common/ShaderHelpers.glslinc"


This looks amazing!
However I’m having some issues?
When ever I’m building for debug, I always get the same issue for build;
ofxButton.cpp:96:10: Unknown type name ‘ofBitmapFont’
Example here

Any help!?


Hmm, are you using 0.8.4? Seems odd ofxGui doesn’t build either way.

The project files should update fine to 0.9.x. You might need to take ofxAutoReloadedShader out as described a few posts above.