### Author Topic: Ideas on how to transform shapes without distortion / uneven blurring.  (Read 1327 times)

#### JohannTheCreator

Hey guys. I was wondering if anyone has figured out how to transform a shape without distortion. What I mean by that is when you use a transform 2d on a shape to say squish it to 50% of its height, it distorts the shape to were the top edge is different from the sides. So say I wanted to make this (in the pic attached) to where the vent is just shorter, it doesn't really work that well because the top edge is skinnier than the side edge.

Appreciate any ideas, guys.

#### Alex Jenyon

A really simple request like this is what makes procedural modelling / texturing interesting... and really hard.

In order to do what you are asking, the application has to have some idea of what a 'vent' is, and know that you can't have 0.5 of a slat, and that you should scale the existing number of slats up until there is room add an extra one.

It's certainly possible, but not straightforward - you'd need to code in some kind of basic logic (in a function graph) that does this, and then add an even border around it later.

If you didn't care about the slats being distorted, and are just concerned with the border, then an easy / cheap option would be to crop off the border, scale the slats to whatever size you wanted, and then add an even border around it using expand / edge detect.  This might give you rounded corners, though.

You could also take the alpha channel of your scaled image (without the border), and scale it up by 5% or so, and subtract the original alpha channel to get a border.  It wouldn't be completely even unless your image was completely square, but it would be close.  To get it perfect, you'd need to know the aspect ratio of the image, which takes us back to function graphs again.

Hope that helps - happy to give you some pointers if you think it's worth the time diving into functions.

#### JohannTheCreator

Well the vent border is separate from the slats in my graph. You can notice in the picture the slats are the same. Only the border is being transformed (I'm using the border shape as the mask in the blend node between the slats and the border). I set up a parameter to change the number of slats to compensate for that.

I think what I'm thinking would be the solution but don't know yet the way to do this through the graph is somehow chop off the middle parts of the border edges. But yeah, I don't know if there is a way to do that through with nodes.

#### JohannTheCreator

Made a ss of the graph with some notes to better show what I'm trying to do. So yeah basically I'm trying to vertically smash the frame. The graph shown doesn't work, but it gives an idea of what I'm aiming for.

#### JohannTheCreator

Alright so I made a node network of transform 2Ds / masks and I think I'm pretty close to making everything work. I'll keep this thread posted with my progress.

#### mattywyettsimmonds

I had a similar problem with making a brick without stretching the blurred edges, My work around was to use a transform node plugged into a symmetry node. I'd use the offset in the transform and in symmetry node will look like it's scaling. Use Mirror x / Mirror Y.

#### JohannTheCreator

I had a similar problem with making a brick without stretching the blurred edges, My work around was to use a transform node plugged into a symmetry node. I'd use the offset in the transform and in symmetry node will look like it's scaling. Use Mirror x / Mirror Y.

Yeah, I think that is pretty close to the solution I am finding as well. One thing I can't figure out though is how to blend the two transform vertically and horizontally altered shapes afterwards.

#### mattywyettsimmonds

Shouldn't need to merge anything if done right, check the graph in the attachment, if you drop the node into a graph and edit the values you can see what it does.
Last Edit: December 21, 2016, 06:02:20 pm

#### mattywyettsimmonds

Actually after quick tests that graph was not perfect for your needs. but I attached an image showing a graph that is I think. The only settings to look at are on the symmetry slice ones which is in the screenshot for you. Oh also set the transform node to no tiling, for obvious reasons.

#### JohannTheCreator

Actually after quick tests that graph was not perfect for your needs. but I attached an image showing a graph that is I think. The only settings to look at are on the symmetry slice ones which is in the screenshot for you. Oh also set the transform node to no tiling, for obvious reasons.

Ha. Yeah. I didn't even know there was a symmetry slice node already... That'll teach me to use that space bar search more often. But yeah, I just plugged the frame into that with a T2d and it works great.

Appreciate all the help guys!

#### mattywyettsimmonds

I had a bit of time on my hands and had some fun making the full vent with controls and comments. Find it attached. ^^