Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Something not quite right with my Perlin noise...

Author
Message
Zealous
19
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Colorado Springs
Posted: 8th Dec 2005 03:45
I could use your help if you have any experience with Perlin noise. Ive read a few papers and think I got the basics, but my first attempt just doesnt look right.

Please check out my code and let me know how bad I screwed up. The texture just looks very flat, no real bright or dark areas. I weighted the different resolutions, so im not sure why things turned out so blah.

Thanks in advance for any help!

All you need is zeal
Zealous
19
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Colorado Springs
Posted: 8th Dec 2005 08:16 Edited at: 8th Dec 2005 09:49
Geeez so im trying to get my clouds to animate now and am getting a tad more confused.

So I know perlin noise works with 'pseudo' random numbers (although I didnt use any in my program and I think things almost worked... ehe), so im sure thats one reason why im having trouble. But how would I even 'use' pseudo random numbers in the example program I wrote? Secondly im a little fuzzy on the whole 3d noise concept, which I hear I will be using if I want to do any kind of animation.

Can anyone try and explain how these two concepts are used to create animated noise? Ive read several papers and have yet to grasp the concept. Lets say I wanted to make that texture I generated animate, how would I do it?

*Edit - Heres a picture to illustrate what SHOULD be happening when you animate the cloud noise octaves. This part I understand, I think I could interpolate everything together no problem. The problem is generating those second noise octaves (the second key frames). I just dont see how you create another noise array that looks slightly different form the first (whenever I create my second key frames they are just as random as the first, I guess this is my problem).

So how are those second noise textures generated so they only vary slightly from the originals? Is this where the pseudo random numbers comes in?

All you need is zeal

Attachments

Login to view attachments
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Dec 2005 09:49
I would'nt.

You would need to generate that texture in realtime, which is just not what DBPro is cut out for - really it's a bad idea to try live texturing methods like that.

I'd suggest just using 2 plains and scrolling the textures really slowly - it'd look better than those so-called animated textures, nice and subtle if you know what I mean. I made a nice snippet for massive cloudscapes a while ago, maybe you should try your perlin texture with that and see how it looks (check the code snippets for my cloud demo).


Van-B

Put away, those fiery biscuits!
Zealous
19
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Colorado Springs
Posted: 8th Dec 2005 09:51
No no trust me its possible to do in real time. Check this out...

http://freespace.virgin.net/hugo.elias/models/m_clouds.htm

You can pre render key frames and interpolate between them in realtime (check out that picture I linked).

Again the problem I have is I just cant figure out how to generate the key frames (so they are based on the original, and shift slightly)

All you need is zeal
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Dec 2005 10:35
I know it's possible - but DBPro can't update images quick enough for this sort of thing. Unless it's a demo showing just clouds, I'd forget the idea, a game engine would choke on it.


Van-B

Put away, those fiery biscuits!
Zealous
19
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Colorado Springs
Posted: 8th Dec 2005 11:20
I know youve seen kevils real time terrian light mapping, images can be made form memblocks plenty fast enough.

And the math is just interpolating between key frames. And on top of that youre only interpolating at certain time steps, so the load can be balanced out.

Anyway, I THINK I got my clouds to animate, although it looks kinda crappy. Ive come to the conclusion that these two keyframes have nothing to do with each other (they are completely random). The trick is interpolating the different octaves at different speeds, THAT seems to be how you get the pretty animation?

Am I close or way off?

All you need is zeal
Zealous
19
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Colorado Springs
Posted: 8th Dec 2005 12:01
Wow... I actually got it to work. The animation looks really cool with only two keyframes of pre generated noise (4 octaves each). Every damn paper I read said you should interpolate faster for higher tier octaves, but im doing all octaves at the same timestep and think it looks fine, go figure.

However to get the clouds to morph at any speed will be very slow, no doubt. Right now framerate is ok but you need to either have the clouds animate very choppy, or very slowly.

The prime cause of slowdown is from having to interpolate between two memblocks so many damn times (I need to interpolate between 2 256x256 images FOUR times just to get one new image). Could a DLL perhaps help in a case like this? Something that simply takes two chunks of memory and interpolates each value based on a timestep?

Dang I wish I knew how to write DLLs

All you need is zeal
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Dec 2005 12:07
I tried perlin noise in DB once. Here's about as far as I got.


Deadly Night Assassins

Attachments

Login to view attachments
Zealous
19
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Colorado Springs
Posted: 8th Dec 2005 12:28
Well here she is, the latest version. The animation is all done at once, so the frame hit feels bad. However everything in that function could be spread out over time, it would just mean slower animation.

Im trying to mimic this guys paper here

http://freespace.virgin.net/hugo.elias/models/m_clouds.htm

I think I may be doing too much in my animation function. He talks as if all you have to do is animate some 32x32 octaves. Perhaps im doing something wrong? Can you think of anyway to speed things up?

Wouldnt a DLL that interpolated between two memblocks help a ton?

All you need is zeal
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Dec 2005 13:30
That's what I've been trying to say - DBPro's native image handling is a bit too slow.

Perhaps there's a shader somewhere that could do something, like using an object with different perlin images (like precalculated) then fade between them. I've no idea how to make .DLL's or shaders so I'm not much help with this - that's why I tend to just use massive cloudscapes with 2 layers slowly moving in different directions.

Put away, those fiery biscuits!
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 8th Dec 2005 13:31
No doubt it looks great, but I think the only application for it is a cloud program. In a game, there are compromises that you can make that look good and save on the FPS.

Maybe that's not what you're doing. But if it is, I'd seriously consider something less CPU intensive. The CPU is better used for other things.

Good luck!

Tapewormz
21
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 8th Dec 2005 17:13
Just use layers and textured planes with varying levels of transparency. You can get a really wicked fog or cloud effect.

Zealous
19
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Colorado Springs
Posted: 9th Dec 2005 00:25 Edited at: 9th Dec 2005 00:26
I asked this question before, but couldnt you just pass Images to a shader?

All a shader would have to do is is interpolated between 2 images and produce an output image. A shader could do that in no time im sure, the trouble is how do you pass just a IMAGE to a shader (and how do you do it in DBpro).

If we could just figure that out we COULD do this in realtime. Again its not complicated, merging two images is all were talking about.

Did anyone take a look at that paper I posted? Its also possible im not following the directions exactly and thats why its running a tad slower than it should.

All you need is zeal
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th Dec 2005 00:30
Dont know if it helps - but I'm retexturing a plain in realtime to make a flame effect - take a look at my latest challenge entry in the db challenges thread...

Zealous
19
Years of Service
User Offline
Joined: 13th Sep 2004
Location: Colorado Springs
Posted: 9th Dec 2005 01:38
Nice fire! However I think the reason it works so fast compared to mine is due to the fact that im blending different octaves of noise. If I just used one or two I could likely get realtime speeds, but then the clouds would look like crap.

It seems like you could write a pixel shader that does my whole 'update cloud' routine in no time flat. I think I better take this project to the ultimate shader thread and request some assistance...

All you need is zeal

Login to post a reply

Server time is: 2024-05-07 04:53:28
Your offset time is: 2024-05-07 04:53:28