Bending a simple shape

Started by sboerner, January 03, 2020, 02:17:14 PM

Previous topic - Next topic

sboerner

I've been thinking it would be handy to be able to bend a simple shape by a specific angle. Tried using the warp shader and got a pretty good result, but the problem is it skews shapes instead of rotating them.

So here's what I've come up with so far. It's ugly but it seems to work, though I haven't tested it in any real scenes yet. Basically it breaks the shape into two halves (at Z = 0), rotates the positive half, then pastes them back together. The X and Z positions have to be manually tweaked to achieve a good fit. The result can be then rotated and placed freely in the scene.

There must be a more elegant way to do this.

WAS

Quote from: sboerner on January 03, 2020, 02:17:14 PMI've been thinking it would be handy to be able to bend a simple shape by a specific angle. Tried using the warp shader and got a pretty good result, but the problem is it skews shapes instead of rotating them.

So here's what I've come up with so far. It's ugly but it seems to work, though I haven't tested it in any real scenes yet. Basically it breaks the shape into two halves (at Z = 0), rotates the positive half, then pastes them back together. The X and Z positions have to be manually tweaked to achieve a good fit. The result can be then rotated and placed freely in the scene.

There must be a more elegant way to do this.

That's pretty genius, I have to say. But you'd think for simple, simple shapes like that, you could just use two SSS shapes and their built in rotation. That way you save on blue node computation.

Also when warping by a PF it will cause weird effects unless you're using a perlin with 0 noise variation, 0 variation methods, and 0 colour roughness. Than things will warp mostly proportionally. But no hard angles.

sboerner

QuoteThat's pretty genius, I have to say. But you'd think for simple, simple shapes like that, you could just use two SSS shapes and their built in rotation. That way you save on blue node computation.
Thought about that. But once the displacements (that's what this will be used for) are in the scene, any edits would require moving two nodes and then realigning them. At least this way you only have to do that once.



QuoteAlso when warping by a PF it will cause weird effects unless you're using a perlin with 0 noise variation, 0 variation methods, and 0 colour roughness. Than things will warp mostly proportionally. But no hard angles.
My first attempt used a few blue nodes to calculate the displacement and then piped that into a warp shader. But as it skews the shape the width changes after the bend. (Might be acceptable if the angle is very small.)

Kadri

Nice work.
A freely shapable simple shape shader with more control points would be great actually.

sboerner

Thanks. 


QuoteA freely shapable simple shape shader with more control points would be great actually.

Agreed. Even an svg import node would be awesome.

WAS

Quote from: sboerner on January 03, 2020, 03:19:40 PM
Quote from: undefinedThat's pretty genius, I have to say. But you'd think for simple, simple shapes like that, you could just use two SSS shapes and their built in rotation. That way you save on blue node computation.
Thought about that. But once the displacements (that's what this will be used for) are in the scene, any edits would require moving two nodes and then realigning them. At least this way you only have to do that once.



Quote from: undefinedAlso when warping by a PF it will cause weird effects unless you're using a perlin with 0 noise variation, 0 variation methods, and 0 colour roughness. Than things will warp mostly proportionally. But no hard angles.
My first attempt used a few blue nodes to calculate the displacement and then piped that into a warp shader. But as it skews the shape the width changes after the bend. (Might be acceptable if the angle is very small.)

That's actually interesting, it is as if it was simply skewed to the left isn't it? Rather than proportionally rotated.

sboerner

Yep, it is just skewed. I tried building some rotation into it but it didn't work . . . you're feeding displacements into the warp shader, not point locations. Maybe it's possible but I don't have the math to attempt it.

WAS

Quote from: sboerner on January 03, 2020, 09:22:37 PMMaybe it's possible but I don't have the math to attempt it.
Lol I hear ya there! :-X

Dune

Genius at work! A long time ago I have requested a simple shape setup where you can drop some points and make your own shape. Especially with a (smooth) curves editor that would be very handy. I also experimented with warping SSS's by greyscales in a more exact way (you can have a SSS bend around a white circle, e.g.), but it's a bit tricky. But this is neat, have to check it out.