• Welcome to World Machine Community. Please login or sign up.
October 14, 2019, 09:15:12 am


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

Post reply

The message has the following error or errors that must be corrected before continuing:
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.
Other options
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

Topic summary

Posted by Ben
 - April 28, 2014, 12:51:46 am
I figured this out today while trying to solve another problem and it was super simple. I've actually done this same thing many times with post process fx in games while experimenting with sharpen and clarity fx (the kind people love to use to fake HDR in pictures). Taking the input height map and subtracting a blurred version of itself highlights convex edges. If you swap the subtraction order and invert the result then it highlights concave edges. Take both results, 50% average blend them together, and finally normalize and that's it. Of course it has the added ability to change the sample distance through the Blur, it can also use directional blur which is potentially useful. I posted to the device library...


Posted by Ben
 - November 30, 2013, 05:21:12 pm
Crap I'm sorry I'm working with the dev channel build so I can't share the macro. I put together an image that will hopefully explain what's going on. The problem with just bluring the convexity output (including masking the edges) is that you get very uneven results when it comes to slope angle.

Edit: I feel like I should mention that I used thermal weathering instead of a blur because it is able to smooth my convex stair edges while preserving the concave corners of the final result. Plus it ended up not being too much more expensive than an equal blur.
Posted by WFab
 - November 30, 2013, 05:14:41 am
i'm not able to load your macro... reports an unknown error. what version of wm are you using?

secondly, my macro does the reverse of what you want. as soon as its complete, i'll post the unlocked version. you want sharp edges and blurred center, then why don't you just input another convexity selector with sharp output as a mask to the blur device? that would solve your prob with the expanders.
Posted by Ben
 - November 30, 2013, 03:01:40 am
Hi WFab, thanks for the help! I just tried out the macro and unfortunately it still has some issues that I am trying to avoid. I was going to try and explain further but you inspired me to make a macro to show what I want.  :) I attached an unlocked macro so you can see what I'm going for. It's pretty much what I want because it preserves sharp edges and produces a smooth linear slope with a consistent angle, however it's slow because of all those expanders. Using less expander passes only slightly improves performance and I'd say 6 could still get good results (I'm using 8 ). 4 passes starts to look stair-stepy/smudgy. One thing also to note is that I'm testing with very low roughness voronoi and previewing the result as a height map rather than a mask (much easier to see smooth/un-smooth slopes). Hope that helps explain what I want!

Off topic: Something unrelated that I just found a good test case for is how important it is to force WM to execute threads in a certain order, even if it involves adding extra devices. For example, I put this comment in the macro:

QuoteKeeping the device count equal between concave and convex allows the expanders to stay on pace with each other to prevent one tree from waiting on the other.

The "Delay" clamp device below is only there to mirror the inverter on the concave edges so that both have the same amount of devices.

Almost a 20% performance increase!

It's a very contextual trick and in this case conveniently simple, but I do think there's a lot more to gain from thinking about stuff like this. Message for Stephen: In the future it might be nice to have some kind of threading tools or maybe WM could tell us when a combiner (or any device with multiple inputs) is waiting on only 1 input for an extended period of time. That way we would know to fix the timing in that part of the device tree.
Posted by WFab
 - November 28, 2013, 12:22:21 am
An enhanced convexity selector macro will be posted in the macro library. stay tuned!!!  :)
Posted by Ben
 - November 18, 2013, 12:09:12 am
Blur is a great work around in many cases and I use it a lot to do great things but there are many cases where highlighting edges with a large sample distance while preserving the sharpness of the concave and convex edges is very much wanted.

Another issue (which has actually been somewhat fixed with the new multires features) is that Select Convexity is resolution dependent. If I have a 4096x4096 world then my highlighted edges are super small. Multires provides a way around this issue but it still doesn't give me hard edges.

I attached an image that shows what can be done, as you mentioned, with blur, and also my problem/partial solution to high res renders. Both rows are the same except the bottom row renders the first 2 steps at 256 and then upsamples to 4096 to match the top (which is 4096 throughout).

About the top row, the problem with high res renders and select convexity is that I get no distance in world coordinates. This then gives the following blur barely any substance to produce a nice result. I would have to set the blur radius quite low to get any contrast out of the result, or I'd add contrast after the blur (but there's hardly anything there to boost).

The second row shows how multires enables us to sample much further distances in world coordinates. Since select convexity samples 1 pixel distance and not 1 meter or whatever in world coordinates, and the 256 res pixels are 16 times larger than the 4096 ones, we now have a something we can blur and use. The bonus is if you do it completely at 256 and upscale after, you just saved a lot of render time too.

Anyway, this still doesn't give me what I want in a lot of cases lol :P

Edit: the image is a little large so you may have to scroll for the 3rd column with the blur.
Posted by Construc
 - November 17, 2013, 10:58:16 am
As a workaround, you could always add a blur filter to it, it would have almost the same effect.
Posted by Ben
 - November 17, 2013, 01:19:05 am
I know the focus is elsewhere at the moment but it would be great if Select Convexity had a radius option. I attached an image rendered from Filter Forge (which has radius) showing 3 results with a radius of 1, 16, and 32 from left to right. I've found it to be a very useful tool for all kinds of purposes. The 1 pixel sample distance in WM feels very limiting to me.