Exporting Paths from Photoshop to Cinema 4D

From NoskeWiki
Jump to navigation Jump to search


NOTE: This page is a daughter page of: Adobe Photoshop and Cinema 4D

I tried at one point to use Photoshop to draw and generate paths around buildings on map imagery, but with limited success.

Techniques for Drawing Paths in Photoshop

To draw paths manually in Adobe Photoshop:

  • Open "montage.tif" and save as a photoshop document ("montage.psd").
  • Select the Pen tool [p] and draw your first path with "Make: Shape" on the top bar (helps you see shape better).
  • Go Window > Paths to see Paths window, and in the top right click the down arrow and "Save Path..." and call "Building1"
  • Add a new Path (bottom button), draw 2 more shape Paths and rename your second path layer "Building2-3".
  • Export your paths from PhotoShop into Cinema 4D:
    • Make sure you have several paths.
    • Go File > Export > Paths to Illustrator with "All Paths" and save as "buildings.ai".
    • In Cinema4D go File > Merge then select the same file and import.
    • Select the new "buildings" null object, make sure it is position is 0,0,0 and rotation set to 0,-90,0 and it should be aligned with your satellite image - providing both are centered and scaled such that one meter = one pixel.
    • Sadly you'll lose the path names / layers... instead they'll just be called "Path 1", "Path 2" and "Path 3" and I haven't worked away around this.

To generate paths from pixels:

  • Open a satellite view where buildings are highlighted in a different color.
  • Go Select > Color Range and then you can click the color you want with an eye dropper and the preview should show all the buildings selected. Click "ok".
  • Play with Select > Modify > Expand / Contact to help get rid of extra pixels you may have picked up.
  • In the Paths window, select the top right drop down and "Make Work Path" and this will turn your selection into a path.
  • Export your "Paths to Illustrator" and import into Cinema 4D (as above).
  • The only problem with this is that your path will be around pixels, so unless a building's pixels are perfectly vertical and horizontal. Photoshop has no path simplification routines, but you might have *some* luck in Adobe Illustrator.

Path Smoothing in Illustrator

Smoothing paths in [Adobe Illustrator]:

  • Open the .ai file in Illustrator.
  • Hit [ctrl+a] so you can see paths (otherwise they are invisible).
  • Go Object > Path > Simplify and in the dialog click "Straight Lines" (you don't want curved ones for buildings) "Preview" and angle threshold of maybe 40 degrees. This should decrease your # of points, but I found didn't do nearly as good a job as hoped. The problem it has: it only factors angle - not distance.... so if you have a 45 degree edge, each point will be only 1 pixel apart, but form a 90 degree angle.

Optimizing and Simplifying Paths in Cinema 4D

To optimizing a path in Cinema 4D:

  • In Cinema 4D you can get rid of sharp edges, but selecting polygon(s) and click the little settings cog next to Mesh > Command > Optimize, and chose 1.01 meters (pixels) and apply. Any points closer than this will be merged. The problem here is that it doesn't factor in distance, so that you may now have many points (>1 pixel apart) which form a perfectly straight line, but it won't know that these points can be removed.
  • You can select polygon points in the viewport and right click > Round, but this rounds points - not what you want either.

Simplifying a path in Cinema 4D using a plugin:

  • I haven't done it yet, but I plan to write a Cinema 4D plugin along the lines of this one which will do good spline simplification.