Displacement mapping

41 views
Skip to first unread message

Ladislav Ledvinka

unread,
Jan 12, 2024, 4:54:17 PMJan 12
to FilterMeister Mailing List (FMML)
Hello,
I've been working in FilterMeister for a while, I'm not an expert in the C programming language, although I know it well to some degree, but I'm trying to make a classic filter like the Displace filter in Photoshop, where I would directly copy the content from the desired layer(and not saved as .psd greyscale image then loaded) that will serve as the height map or a displacement map for the other layer that needs to be displaced. For example, I have two layers, one is perlin noise and the other is text. The perlin noise should act as a displacement map for the text to be warped in relation to the dark and light pixels. I think the pointer_to_buffer() function should be used in conjunction with memcpy(), memmove() or memset(). Although I am trying to solve this problem somehow, I will still need your help.
For clearer picture of what I want to achieve, please take a look at Substance Designer's Warp node.

Thanks to anyone who offers to help,
Ladislav

paul.s...@telenet.be

unread,
Jan 13, 2024, 2:43:46 PMJan 13
to filter...@googlegroups.com
Hi Ladislav,


For B&W images, I should simply put the displacement map in a color channel of an rgb image, e.g. the blue channel.
If color is needed, you can put the displacement map in the Alpha channel. As long as you avoid 0 values, the Alpha channel can be reversed to max value (255 or 32768) at the end of the processing, to turn your image back to full opacity. I'm convinced that this way will be the fastest processing.

More challenging is to maintain continuity in the displacement of the pixels at sub pixel level. This means interpolation between successive pixels. Bilinear can do.


Regards, Paul

Van: "Ladislav Ledvinka" <catapult...@gmail.com>
Aan: "FilterMeister Mailing List (FMML)" <filter...@googlegroups.com>
Verzonden: Vrijdag 12 januari 2024 22:54:17
Onderwerp: [FMML2] Displacement mapping

--
You received this message because you are subscribed to the Google Groups "FilterMeister Mailing List (FMML)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to filtermeiste...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/filtermeister/93f0cc7c-ac0b-45fa-a44b-d9b5db706871n%40googlegroups.com.

Ladislav Ledvinka

unread,
Jan 14, 2024, 8:14:31 AMJan 14
to FilterMeister Mailing List (FMML)
Hello Paul,

I thought of considering two of the RGB channels, one to be the original image and the other to serve as the displacement map. But my question is, since on each of the channels the white pixel represents full opacity, while the black one has no opacity, will this be a problem for the calculations and how can be solved, any thoughts on this?

Thank you,
Lad

paul.s...@telenet.be

unread,
Jan 14, 2024, 8:48:27 AMJan 14
to filter...@googlegroups.com
Hi Ladislav,

If you only use the rgb channels, there's no problem with transparancy/opacity. Transparancy is only controlled in the Alpha channel. Suggestion: you can use e.g. r for original image, g for the displacement map and b for the result. So you can repeat your settings endlessly until you obtained the desired result, without affecting the first two.


Van: "Ladislav Ledvinka" <catapult...@gmail.com>
Aan: "FilterMeister Mailing List (FMML)" <filter...@googlegroups.com>
Verzonden: Zondag 14 januari 2024 14:14:31
Onderwerp: Re: [FMML2] Displacement mapping

Reply all
Reply to author
Forward
0 new messages