• Welcome to World Machine Community. Please login or sign up.
 
July 23, 2019, 11:25:43 pm

News:

Read the Development Diary for an inside look at World Machine's progress!


Spike removal

Started by Rhalph, January 05, 2008, 06:55:32 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rhalph

January 05, 2008, 06:55:32 am Last Edit: January 05, 2008, 07:04:22 am by Rhalph
Hi,

Someone asked on another forum if it was possible to remove the spikes that can appear on the terrain.
I made a macro for this, after a technique Stephen gave me some time ago :
- Apply a Blur to the terrain
- Substract the result from the original terrain - you get the spikes
- Substract these spikes to the original terrain.

The macro has one parameter, which controls the Blur radius (...which controls the size of the spikes to be removed).

You can download the macro here: http://terrafgen.free.fr/Downloads/Macros/Spike%20Removal.dev
You'll need the registered version of WM (because of the Blur device).

And here is a screenshot of the effect (before/after):

(Note that this is also the screenshot made by Stephen some time ago, so you can thank him :D)

nikita

January 05, 2008, 04:33:16 pm #1 Last Edit: January 05, 2008, 04:35:19 pm by nikita
You can make the macro smaller/faster by replacing the two subtracting combiners (I only noticed I've spelled "subtract" wrong my entire life) with a single combiner in Min mode. :)
It becomes clear if you draw yourself a quick sketch.
(At a point, where the height x of the blurred heightfield is less than the height h of the original heightfield, your macro does this: h-(h-x), which can be reduced to: h-(h-x) = x)

Unfortunately, the macro seems pretty trivial now. Your current method would also cut off "spikes" that are only small hills, thus removing the details on these.
That being said, maybe that method can be improved to select spikes in a more clever way, pushing that select and subtract approach, which is a very effective one for many  purposes :)

edit: maybe only subtracting spikes that exceed a certain height
"Every time you read or write beyond the end of an array, somewhere a fairy dies."
Richard Buckland

Rhalph

January 05, 2008, 05:54:50 pm #2 Last Edit: January 05, 2008, 06:16:46 pm by Rhalph
Good idea...

I updated the macro (but I needed to keep the old way, because I needed the information concerning spikes..
But I'm not sure about the best way of selecting the spikes height. I used a Height Selector, but with no falloff, so...

nikita

I think it works that way. The only problem remaining are very small spikes. But reducing these without erasing the structure of the rest of the terrain would probably make the macro too big and complicated :)
"Every time you read or write beyond the end of an array, somewhere a fairy dies."
Richard Buckland

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S save/post or ALT+P preview