We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Random noise background (perlin noise)
Page Index Toggle Pages: 1
Random noise background (perlin noise) (Read 1435 times)
Random noise background (perlin noise)
Oct 22nd, 2008, 7:02pm
 

Hello everybody,
I have studied the example of the perlin noise
http://processing.org/learning/basics/noise3d.html
and I'd like to use it as background.

The problem is that I am not able to draw any other object
i.e. I am not able to use the example as background.

I think the cause is because every pixel is set (see
pixels[x+y*width] = color(bright,bright,bright)Wink.


Can someone suggest me how can I adapt such example
as background?

Moreover can someone suggest me another background with
similar effect?


Tanks in advance

Re: Random noise background (perlin noise)
Reply #1 - Oct 23rd, 2008, 11:53am
 
create a PGraphics as a buffer then have the noise draw to this instead, then draw this image on your mainscreen which can be a background for you to draw other things on top of.
Re: Random noise background (perlin noise)
Reply #2 - Oct 23rd, 2008, 1:07pm
 
Hi,
thank you very much for having replied.

I think I can't use the PGraphics because in my program I
import the OPENGL library. Indeed, in the on line help of
createGraphics() there is written: "It's not possible to use
createGraphics() with OPENGL, because it doesn't allow
offscreen use."


Please help!

Thanks in advance.
Re: Random noise background (perlin noise)
Reply #3 - Oct 24th, 2008, 1:40pm
 
Hello...can anyone help me please?

Thanks in advance
Re: Random noise background (perlin noise)
Reply #4 - Oct 24th, 2008, 2:02pm
 
You could use a PImage instead of a PGraphics.

http://processing.org/reference/PImage.html

That also has a pixels property you can write to. Then you can use it as a background.
Re: Random noise background (perlin noise)
Reply #5 - Oct 24th, 2008, 2:18pm
 
Yes,
but an Image is static! Am I wrong?

I want to have a dynamic background!
That is I want that beyond the objects I want to
display there is a changing background made with some random
microevent giving the impression of fog.

Do you have other suggestions?

Thanks in advance
Re: Random noise background (perlin noise)
Reply #6 - Oct 24th, 2008, 3:01pm
 
I think things are getting far too complicated here...

What you need to do is clear the Z-buffer after drawing the perlin noise, and then you can draw over it.

I believe with the latest versions of processing, this is a simple hint() command.
Re: Random noise background (perlin noise)
Reply #7 - Oct 25th, 2008, 4:46am
 
Hi,
thanks a lot for answearing.

Why do you say that it is complicated?
Nobody has never render objects over a dynamic background?

I tried your solution it is about what I want to do...but it does not work perfectly. Maybe the reason is that the cpu of my laptop is not to much powerful...the fact is that the sphere I render over the perlin noise background does not appear very clear (as it would appear withouth the perlin noise background).

Are there other solutions?

I want to do a very simple thing: a white sphere that appear among a foggy landscape ().

Suggestion needed!

Thanks in advance.
Page Index Toggle Pages: 1