ground shadow - motion blur - very slow...

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
imitschmätschik
Posts: 2
Joined: 2011-05-16T05:36:45-07:00
Authentication code: 8675308

ground shadow - motion blur - very slow...

Post by imitschmätschik »

i might have missed something - but it seems that the only way to get a good realistic wall ground shadow for an rectngular object like a frame is:

convert -size 1000x1416 xc:none -fill black -stroke black -draw "roundrectangle 0,0 999,1415 83,83" -draw "rectangle 0,0 999,166" -draw "rectangle 834,0 999,1415" -fill none -background transparent -bordercolor none -border 275 -channel RGBA -motion-blur 0x125-60 -blur 0x2 test.png

it works - except that it is terrible slow ...

you might try it with a smaller sized image to get a result within a reasonable amount of time (see below)...

platin:~> convert --version
Version: ImageMagick 6.6.9-1 2011-05-12 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP OpenCL

platin:~> uname -a
Darwin platin 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386 i386

platin:~> convert -size 500x708 xc:none -fill black -stroke black -draw "roundrectangle 0,0 499,707 42,42" -draw "rectangle 0,0 499,84" -draw "rectangle 416,0 499,707" -fill none -background transparent -bordercolor none -border 139 -channel RGBA -motion-blur 0x63-60 -blur 0x2 test.png

My questions: is there a better way to generate realistic ground shadows? (Please do not respond with "use -shadow" / -shadow creates unrealistic drop shadows of objects with zero depth)
if no: Why is motion blur that slow ? Can i get arround this issue somehow?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ground shadow - motion blur - very slow...

Post by fmw42 »

I don't know if this will help your situation, but see http://www.imagemagick.org/Usage/distorts/#shadow3d
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ground shadow - motion blur - very slow...

Post by anthony »

Shadows are also related to Reflections though more free form in position and less colorfull...
http://www.imagemagick.org/Usage/advanced/#reflections
Shadows will generally obey the same rules as reflections, except for the last two rules (direction and distance form contact point). They may not fall directly downward, but point away from the light source (parallel for distant light sources). Also they will not be a same distance from the 'surface contact point', but they will have the same ratio of distances, just not 1:1 ratio as you get for reflections.
To get very realistic shadows you will need to look at the same things in reflections. that is like reflections, shadows get 'fuzzier' with distance, but the fuzziness is not circular but oval shaped in the same direction as the shadow! IM provides methods for doing variable and oval shaped blurring!

See Compound fonts, Distance Blurred Shadow, which demonstrates BOTH effects, and could be used with ANY shape!
http://www.imagemagick.org/Usage/fonts/#var_blur
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
imitschmätschik
Posts: 2
Joined: 2011-05-16T05:36:45-07:00
Authentication code: 8675308

Re: ground shadow - motion blur - very slow...

Post by imitschmätschik »

fred, anthony,

thank you for your answers. in fact i have read the example sections you mentioned before, but i think the problem is, that all examples rely on objects with zero depth.
Of course i can try to draw the shadow by hand, fill it and blur it with an (oval shaped) gradient / but that will be a very special operation for an i.m.O. general problem.
Thinking of a "wall shadow" from an object with a fixed depth i would say one has to move the object with a customizable angle, record/paint the trace, (similar to motion blur), and than distance blur/fuzzy it....
the problem with motion blur is, that sharp edges produce unnatural traces/shadows ....
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ground shadow - motion blur - very slow...

Post by anthony »

The sharp edges is what variable blurs fix. The more distant the shadow is from the generating object the more blurry it should be. Not only that but the blur is typically oval shaped.

However you are right in that most shadows generated are typically of a flat object, which is either hovering just above the surface, or is perpendicular to the surface. Other arrangements are posible, just more difficult.

If you really want to get full 3-dimensional shadow effects, as well as reflection, you will need to go to a full raytracer. However raytracing is generally slow, and the more realistic you get, the slower it becomes.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply