Grasshopper

algorithmic modeling for Rhino

Create Vectorized Output (make2D) with a Spherical camera

I am looking create the equivalent of a make 2D that matches my output generated with a vray spherical camera (FOV:360), the goal being to have a vectorized equirectangular image that would work in inside a GoogleStreet view format, and match up with the rendered version of the same view. Below is a photoshop mockup of what I am trying to make:

This is a rendered 360 degree spherical panorama, In the blue highlighted area I used photoshops find edges filter to create the appearance of outlines- but it does a pretty poor job compared to the actual vector outline I am hoping for. 

Does anyone have any ideas on where to start with a script that would do this well? My guess would be to project visible edges onto a sphere and then unwrap them as a 2:1 rectangle... that sounds nice in theory but  there are a few immediate practical problems:

1. How to dynamically project curves so that each point along a curve is translated from its location towards a single center point (ie the center of the spherical camera)- this would mean that the projection angle changes for every point. All of the lines I am projecting are straight, but when they are projected onto a sphere they will end up curved. Perhaps a dividecrv, project each resulting pt, and then interpolate would work- but it seems like there should be a cleaner method.

2. If I can project the curves properly onto a very small sphere located where my camera is, How to unwrap the curves on that sphere into a 2:1 rectangle. Does anyone know a way to translate from 3D points coordinants to 2D equirectangular ones?

Bonus- Can I polarize this output and still have my vector lines? If I can get this far I will be estatic, but as a stretch goal can I polarize my vector lines, so that again they will match up with the polarized version of the rendering below (same image, just scaled to a square and photoshop>distort>polarize):

Views: 2724

Replies to This Discussion

maybe this is a start....

This is a HEAVY method: (better scripting or so)

- make EVERYTHING a curve

- calculate how much subdivision that curve needs:

  more for a longer curve and more if the curve is near the camera (some function)

- divide every curve

- project all points to a sphere centered to your camera location

- use UV coordinates to rebuild your "unrolled" environment (with interpolate curve)

the more the points the heavier the definition (good function > better)

a lot of manual tweaks needed

the final result must be manually trimmed to finish :S

(adjust sphere seam location (just rotate the sphere) to re-position the line that split the photo)

no ideas for the polarize stuff...

good luck :D

forgot :P

Attachments:

This is really great- thank you. Much better than where I had gotten too:

but your Srf closest Pt is much better- and the uv Point output makes life so much easier.

Any way to get it to not project hidden lines? That way its a make2D instead of a wireframe... though I am guessing thats what you meant by the manually trim to finish bit.

Thanks again, this is amazing.

I have no idea of how make2d works....

With this method tangent edges are completely missing and there are no ways to get hidden lines....

Another method (I don't know if this work, neither if it's feasible/easy) could be:

- set a custom viewport with small camera lens (10/20)

- place camera where you need (F6 to see camera "control points" in other viewports)

(beware that moving camera in this way you can mess tilt, camera lens, zoom, and position again)

- for every 90° do a make2d run

- finally trying manually to stitch and unroll the 4 pieces  :S

Instead, by knowing rhino common someone could directly make a script that uses make2d methods but in the way you need...

Maybe!

(I use this last word too often XD sorry)

Make 2d isn't directly available when scripting. One could write a script to run the make2d command in Rhino's command line, but that's a bit dirty workaround.

Here a bit faster approach without projection (was it really necessary ?) and without sphere closest point. The principles are the same...


The second image ("polarize") posted by Peter appears to be an image made by inversion.

Take a look at inversion at Wolfram, you may also find Daniel Piker's page informative (with a lot of really cool inversion examples).

Attachments:

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service