discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] lighting angle?

E
Ervan
Sat, Oct 1, 2016 8:21 PM

I'm trying to use openSCAD for 2D drawings then exporting to PNG.  The
lighting angle becomes significant because the top view has everything with
the wrong color, i.e. too gray, because of the lighting angle.  The viewing
angles which make the lighting correct, then add an artificial 3D
perspective to the drawing, which makes the .png export wrong.  Trying to
rotate the whole object into the light will work for preview, but then there
doesn't seem to be an obvious view angle (like "top") to get a flat
projection of it.

--
View this message in context: http://forum.openscad.org/lighting-angle-tp1508p18499.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I'm trying to use openSCAD for 2D drawings then exporting to PNG. The lighting angle becomes significant because the top view has everything with the wrong color, i.e. too gray, because of the lighting angle. The viewing angles which make the lighting correct, then add an artificial 3D perspective to the drawing, which makes the .png export wrong. Trying to rotate the whole object into the light will work for preview, but then there doesn't seem to be an obvious view angle (like "top") to get a flat projection of it. -- View this message in context: http://forum.openscad.org/lighting-angle-tp1508p18499.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Sat, Oct 1, 2016 9:40 PM

Try this working around code:

$vpr=[0,0,0];

lightFromAbove() your_2D_object();

module your_2D_object() circle(20);

module lightFromAbove() {
rotate([-40,0,0]) scale([1,1/cos(40),0.01])children();
}

--
View this message in context: http://forum.openscad.org/lighting-angle-tp1508p18503.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Try this working around code: > $vpr=[0,0,0]; > > lightFromAbove() your_2D_object(); > > module your_2D_object() circle(20); > > module lightFromAbove() { > rotate([-40,0,0]) scale([1,1/cos(40),0.01])children(); > } -- View this message in context: http://forum.openscad.org/lighting-angle-tp1508p18503.html Sent from the OpenSCAD mailing list archive at Nabble.com.
E
Ervan
Sun, Oct 2, 2016 10:25 PM

Very clever.  This solves the problem of proper lighting on a 2D object as a
work around.  Thanks.

rotate([-40,0,0]) scale([1,1/cos(40),0.01])children();

Only issue I found was that this doesn't work for text, but it can be
prefixed with this:

module unrotate_for_light() {
scale([1,cos(40),100]) rotate([40,0,0]) children();
}

The command line is a separate problem, but this seems to work:

openscad.com --camera=0,00,00,00,0,0,1000 ....

--
View this message in context: http://forum.openscad.org/lighting-angle-tp1508p18510.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Very clever. This solves the problem of proper lighting on a 2D object as a work around. Thanks. >rotate([-40,0,0]) scale([1,1/cos(40),0.01])children(); Only issue I found was that this doesn't work for text, but it can be prefixed with this: module unrotate_for_light() { scale([1,cos(40),100]) rotate([40,0,0]) children(); } The command line is a separate problem, but this seems to work: openscad.com --camera=0,00,00,00,0,0,1000 .... -- View this message in context: http://forum.openscad.org/lighting-angle-tp1508p18510.html Sent from the OpenSCAD mailing list archive at Nabble.com.