How to rotate objects but maintain drop shadow? [SOLVED]

Post questions on how to use or achieve an effect in Inkscape.
User avatar
cameralibre
Posts: 5
Joined: Sun Jan 10, 2016 12:00 am

How to rotate objects but maintain drop shadow? [SOLVED]

Postby cameralibre » Sun Jan 10, 2016 12:23 am

Hello, I have an image comprising many different objects, all with a drop shadow applied (Filters>Shadows & Glows>Drop Shadow...).
The settings are currently:
Blur radius: 1px
Horizontal offset: 1px
Vertical offset: -1.1px

My problem is that when I want to rotate an object, the drop shadow rotates as well. Obviously this make no sense to the viewer - suddenly the light is coming from different directions. Even if I remove the filter, rotate the object and reapply it, the result is the same - the drop shadow seems to take its coordinates from the original coordinates of the shape.
Here's an example of the current outcome above, and the desired effect below:
Image
What I want to achieve is that however I move or rotate an object, the shadow is always up and to the right of that object.
Is there a way that can I set up Inkscape (or just this project) in a way that the drop shadow effect uses global coordinates?
Attachments
dropshadow.svg
(6.26 KiB) Downloaded 231 times
Last edited by cameralibre on Sun Jan 10, 2016 7:13 am, edited 1 time in total.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to rotate objects but maintain drop shadow?

Postby Moini » Sun Jan 10, 2016 12:44 am

Yes, there is :)

Go to Edit -> Preferences -> Behaviour -> Transforms. Select 'Optimized' at 'Store Transformation'. This will ensure that paths are stored without additional transform matrices, but by adapting each of their node's position.

Now select all filtered (drop-shadowed) objects and remove their filters. Filter -> Remove Filters. The filter needs to be gone, or it won't work, as that triggers the addition of a transform matrix, which we do not want.

Make sure they are not part of a group (groups get transform matrices added, as there is no other way to save their rotation status).

Rotate them.

Now reapply the filter. It will be in the correct place.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
cameralibre
Posts: 5
Joined: Sun Jan 10, 2016 12:00 am

Re: How to rotate objects but maintain drop shadow?

Postby cameralibre » Sun Jan 10, 2016 1:10 am

Thanks for the reply!
I checked, and I already had 'optimized' selected...
I went through your instructions using the example project which I attached to my post, and it is exactly the same - the shape at top right still has its drop shadow going to the left.

I'm using Inkscape 0.91 on Kubuntu 15.10, if that's relevant.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: How to rotate objects but maintain drop shadow?

Postby Lazur » Sun Jan 10, 2016 1:30 am

Hi.

The trick is to have two separate transformation to the objects.
Apply the filter on a group of the objects and rotate the objects inside after entering the group.

Or don't use transformations at all, by rotating the nodes with the node tool on each duplicant path.

dropshadow2.svg
(3.61 KiB) Downloaded 245 times

User avatar
cameralibre
Posts: 5
Joined: Sun Jan 10, 2016 12:00 am

Re: How to rotate objects but maintain drop shadow?

Postby cameralibre » Sun Jan 10, 2016 1:53 am

The first option works, thanks!
The second option is what I did to create this test project, but unfortunately it isn't feasible on complex objects with many nodes or curves.

The problem for me is that I wanted to share my files with a large community and allow everyone to remix them by moving and rotating the different objects, I was hoping that all they would have to worry about would be moving objects, and the drop shadow would still work. The SVG I wanted to use has about 300 different shapes in it, so it could be complicated making lots of groups and maintaining the correct order of operations. The grouping process is also a tricky workaround to explain, and difficrult to achieve as well - I can't find a way to do it with the mouse alone - if I hit f2, select an object in the group, then f1, click on it to bring up 'scale' arrows, I can't click on it again to see the rotate arrows, as that selects the whole group.

So the way I did it was:
f2
select object
f1
select object
Shift+Ctrl+M
type in a guess in the rotation tab
apply

Is the grouping process the simplest way to achieve this, and is there a better workflow for achieving it that the one I used?
http://www.cameralibre.cc
Free Culture videos made with Free/Libre/Open Source Software about Open Hardware, Open Data, Open Everything

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: How to rotate objects but maintain drop shadow?

Postby Lazur » Sun Jan 10, 2016 2:06 am

There shouldn't really be a difference between rotating with the handles or with the transformation panel.

If you share the file with others possibly anything could happen.
The mentioned "put all objects inside a group" is not the best either, as if the objects overlap the shadows won't rendered at the intersections.
(For that each object should be put inside a group alone...)
But if that is ok for the specific use, you could try editing the file/xml to add the dropshadow filter to the layer of the objects itself.
Then it won't be a problem of entering a group each time.
Until someone resizes the page, which would result in the same distortion on the drop shadows.

User avatar
cameralibre
Posts: 5
Joined: Sun Jan 10, 2016 12:00 am

Re: How to rotate objects but maintain drop shadow?

Postby cameralibre » Sun Jan 10, 2016 2:20 am

ok, I don't think this will be possible for us to do this with Inkscape unfortunately :(
In my image there is a lot of overlapping, so applying the filter to a layer won't work, and others aren't as willing to edit XML as I am!

There shouldn't really be a difference between rotating with the handles or with the transformation panel.

I am curious about this though - how do you get the rotate handles to appear on a single object within a group? every time I click twice on an object (which is what I normally do when rotating an independent object) the second click selects the whole group, not the individual object. Is there another way you do it?
http://www.cameralibre.cc
Free Culture videos made with Free/Libre/Open Source Software about Open Hardware, Open Data, Open Everything

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to rotate objects but maintain drop shadow?

Postby Moini » Sun Jan 10, 2016 2:29 am

Oh, it *is* easily possible.

I only missed one point in my description, as it does not seem to reliably remove the already existing transform attributes:

After removing the filter, just *move* everything up and down a tick.
This will remove all transform attributes (and don't use a group).
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
cameralibre
Posts: 5
Joined: Sun Jan 10, 2016 12:00 am

Re: How to rotate objects but maintain drop shadow?

Postby cameralibre » Sun Jan 10, 2016 6:05 am

yes, that works! thanks a lot.

Is there a way to mark this thread as 'solved'?
http://www.cameralibre.cc
Free Culture videos made with Free/Libre/Open Source Software about Open Hardware, Open Data, Open Everything

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to rotate objects but maintain drop shadow?

Postby Moini » Sun Jan 10, 2016 7:00 am

@cameralibre: I think the way they do it here is to change the title to something that starts with SOLVED, not sure, though.

Btw. I've been thinking that it might be easier to not use the dropshadow filter with all its transformation implications at all, but to create the shadows manually:

Select all objects that will have a shadow, group them (or not, as you like, - you could also move the shadows to a different layer to make selection of all non-shadow objects easier).
Duplicate the group / the selection.
Set its fill to black, reduce the opacity, add some blur.
Lower the shadows (if not grouped or on a different layer, this takes some time for 300 objects - but editing single objects and their shadow later is easier...).
Move them as you see fit, so the shadows fall into a specific direction.

You'd need to repeat that for each change you make to the objects in the group, but it might be a little quicker and more straighforward than to think about removing all the transforms and changing the preferences.
Just so you've got another alternative at your disposal ;)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”