folkertdev / freestyle-svg-exporter

a Blender addon for exporting stylized lines created by the Freestyle render engine to an SVG format.
54 stars 18 forks source link

Freestyle feature request #7

Open e-crins opened 6 years ago

e-crins commented 6 years ago

Hi. I'm almost sure this is not the best place to ask. But I'd like to contact a freestyle dev. about a request.... I'd love to have line with correspond with local grey/light values of a model. The effect would be thick lines on the shadow side and thin lines on the light side of a model. And over all thicker lines on a model with a dark material and thinner lines on a model with a light material. This would result in line drawings like I learned to make with Rotring pens.

folkertdev commented 6 years ago

This sounds like a scripting task. If you can get access to the "shadow value" at a particular point on a mesh, then you can use the freestyle python API to control the thickness.

The real tricky point is finding out the amount of light that hits a an object at a particular point. If you can find out a way I'm happy to help with the freestyle side of things.

e-crins commented 6 years ago

Thanks for the reply. Hmmm Nice challenge to get me into python.... Are freestyle lines calculated from the render end result or inside Blender's 3D space? Getting light values at a particular point on a .png file might be easier than finding the amount of light hitting a point in 3D and then manipulating this value with material settings of the object....

folkertdev commented 6 years ago

both are available

A freestyle stroke is (at the point python can manipulate it) a list-like container of StrokeVertex objects, which have a point attribute in 2d image space, and a point_3d attribute in 3d global space.

But I think the 2d options is the better one, 3d is always tricky and there might by tiny inaccuracies (to the 3d point you get is not actually on the object and stuff breaks).

A possible approach is to use blender textures (so load the image as a texture), to use Texture.evaluate to get the pixel value.