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 / Ridged noise function help needed...

Author
Message
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 3rd Jan 2015 23:17
Hello all, long time no post!! (You can tell I'm not using my xbox any more! lol)

I have a problem that perhaps you, the good people of the internet can help with.

I'm trying (yet again) to create a random procedural environment, and am having some issues in creating as realistic water features as I can. (Rivers in particular.)

I'm currently using THIS perlin noise plugin to create my heightmaps. I've tried picking a color in the heightmap, and setting the alpha fading to 0 for a set distance above and below this color, which creates the following kind of rings..


With the terrain scale I'm planning on using, this may work, but I think it looks quite poor. What I'd like however, is more of a ridged noise function, which will create a noise cloud like the following...


Can anyone offer any help on either using the perlin noise plugin to create ridged noise, or help creating a ridged noise function.

http://www.gamedev.net/topic/646350-perlin-noise-for-rivers/ has the following post detailing how to create this kind of function, but I confess that I don't understand it too well.
Quote: "Ridged noise is built almost exactly the same as standard fBm noise, the only difference being that you take (1.0 - abs(val)) for each octave value before summing the octaves together. This creates "ridges" where the value of an octave crosses the 0 line."

This hints that I should be able to use the existing Perlin Noise plugin to create this kind of effect, but my maths is poor and I can't figure it out myself.

Can anyone offer assistance??

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Jan 2015 00:37
Something like this of any use to you? It uses a precompiled shader file to spare you the very long wait while DBPro compiles the effect.

In this particular demo you probably need to change the seed value - just press up or down keys to get a new image instantaneously.



Powered by Free Banners

Attachments

Login to view attachments
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Jan 2015 01:30 Edited at: 4th Jan 2015 01:36
That's pretty cool! It works a hell of a lot quicker than the perlin noise plugin I'm currently using. (It takes 8 seconds to convert 512x512 memblock data into a usable image.)

OK, I have a few questions then.
Have you got the same thing that does perlin noise too?
How can I change the texture color? (Greyscale is what I need.)
**EDIT** Can we invert the colors of the texture?
Is there a way to pass the resulting texture direct to an image without having to use a screen quad? (I need to paste the ridged noise image onto a perlin noise image, then use that combined image in Blitz Terrain. I.E could we use image kits render targets somehow and avoid having to use any additional cameras/objects etc?)

Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Jan 2015 02:47 Edited at: 4th Jan 2015 03:06
Righto, I've managed to simplify your demo to the attached.

I've taken out the bits where you can change the octave and set tiled or not. (As for my purposes, the octaves are sufficient as I've set them.)
I've also changed the planes to a spinning cube because old school! lol

With my version, i've set up a camera mask on the screen quad so you don't need to hide/unhide objects to update the image, and it runs at about 550 fps on my crappy machine! (Your version runs at about 167 fps.)
A simple Sync Camera call will update the noise, so we can ignore the question about ditching the screen quad.

The other questions still stand, as I can't access the compiled shader to fiddle with it myself.

Attachments

Login to view attachments
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Jan 2015 13:51
Quote: "The other questions still stand, as I can't access the compiled shader to fiddle with it myself"


Sorry, that was an oversight. I attach the shader itself here.

The shader is the same as one I posted last summer - except for one line in each pixel shader (see fx code):

http://forum.thegamecreators.com/?m=forum_view&t=211905&b=1

If you inspect the shader code you should be able to see how to change the colour to greyscale.



Powered by Free Banners

Attachments

Login to view attachments
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 8th Jan 2015 23:14
Cheers for that!

I've messed about with the shader code, but now I have another issue.
I can't run the example code, it just hangs for ever, so I think I need to compile it like the ridged noise example.

Do you know how I can compile the fx file in FX Studio?? Do I have to do it on the command line?

Also, have you got the text only version of the ridged noise shader, as I'd like to make some changes to that shader too.



Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 9th Jan 2015 03:28
Sorry for the doublepost,

I've found out I needed fxc.exe (which is NOT FX Composer) of which I had installed! (Lucky me!)
I just can't figure out the command line syntax for it. (I got a 'main': entrypoint not found when I used the following command:
)

Any ideas?

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Jan 2015 02:44 Edited at: 10th Jan 2015 02:46
You need to use the legacy mode switch.

Just put something like the following into a standard .bat file and execute it:



Quote: "Also, have you got the text only version of the ridged noise shader"


I've already posted it - see my post immediately before yours.

Edit It's the compilation step that takes a long time for that particular shader - about two minutes on my laptop.



Powered by Free Banners
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 10th Jan 2015 13:43 Edited at: 10th Jan 2015 13:43
My bad!

I'll give it a try later than.

Many thanks for your help!!

Login to post a reply

Server time is: 2025-05-15 23:06:20
Your offset time is: 2025-05-15 23:06:20