lighting angle?

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

lighting angle?

nophead
The light seems to come from above and to the left of the object. When
you view the object with the diagonal view this makes the top and the
left end bright but leaves the front dark.

Is there anyway of changing this? I rotate the view so the front is
facing the light and it looks much better.

Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

kintel
Administrator
On Sep 11, 2011, at 11:22 AM, nop head wrote:

> Is there anyway of changing this? I rotate the view so the front is
> facing the light and it looks much better.

At the moment, you've got two light sources which are fixed relative to the screen (from lower left front and from upper right back).
I added a note in TODO.txt that we should add more options.
Would an option to toggle a headlamp as an alternative work for you?

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

nophead
On 11 September 2011 11:41, Marius Kintel <[hidden email]> wrote:
> On Sep 11, 2011, at 11:22 AM, nop head wrote:
>
>> Is there anyway of changing this? I rotate the view so the front is
>> facing the light and it looks much better.
>
> At the moment, you've got two light sources which are fixed relative to the screen (from lower left front and from upper right back).

The diagonal view is from upper front left so shouldn't one of the
lights be from that direction?

> I added a note in TODO.txt that we should add more options.
> Would an option to toggle a headlamp as an alternative work for you?

I don't think it needs anything extra as I can always spin the object
to face the light. It is just that the default diagonal view faces the
front of the object (as defined by the front view) away from the
light. I think it just needs left and right swapping on the light
positions.

>
>  -Marius
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>

Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

kintel
Administrator
On Sep 11, 2011, at 13:01 PM, nop head wrote:
>
> I don't think it needs anything extra as I can always spin the object
> to face the light.

OK, I get what you mean - front semantics. The easy way out is to just change the diagonal view slightly so that the object's front faces the light. I've commited a fix.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

William Adams
In reply to this post by nophead
While you're looking at lighting, could you add an ambient light mode?  I'd like the option of doing my own lighting on occasion.

-----Original Message-----
From: Marius Kintel
Sent: Sunday, September 11, 2011 4:15 AM
To: [hidden email]
Subject: Re: [OpenSCAD] lighting angle?

On Sep 11, 2011, at 13:01 PM, nop head wrote:
>
> I don't think it needs anything extra as I can always spin the object
> to face the light.

OK, I get what you mean - front semantics. The easy way out is to just change the diagonal view slightly so that the object's front faces the light. I've commited a fix.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

kintel
Administrator
On Sep 11, 2011, at 19:18 PM, William Adams wrote:

> While you're looking at lighting, could you add an ambient light mode?  I'd like the option of doing my own lighting on occasion.
>
Concrete ideas as welcome :)
I think we'll have to rewrite the whole 3D scene handling code eventually. If that is done using a more high-level library than OpenGL (think OpenScenegraph or the likes), it would be quite easy to add interesting high-level alternative navigation and presentation modes.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

nophead
In reply to this post by kintel
Yes rotating the diagonal 90 degrees around Z will give the same
effect but I thought that would be less backward compatible than
moving the lights.

On 11 September 2011 12:15, Marius Kintel <[hidden email]> wrote:

> On Sep 11, 2011, at 13:01 PM, nop head wrote:
>>
>> I don't think it needs anything extra as I can always spin the object
>> to face the light.
>
> OK, I get what you mean - front semantics. The easy way out is to just change the diagonal view slightly so that the object's front faces the light. I've commited a fix.
>
>  -Marius
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>

Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

kintel
Administrator
On Sep 11, 2011, at 20:22 PM, nop head wrote:

> Yes rotating the diagonal 90 degrees around Z will give the same
> effect but I thought that would be less backward compatible than
> moving the lights.
>
Hehe, good point. Otoh, gotta give people a taste of backwards-compatibility not being something you can expect down to the last screenshot ;)

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

William Adams
In reply to this post by kintel
I haven't looked at the lighting code, but really, all I need is for facets to be the color that I set them to.
 
There are two cases where I want to just deal with my own lighting.
1) For surface, where I have the normals for every vertex, I can at least calculate a light value for the facet, and just set that value.
2) For cases where I'm rendering an image onto the surface (just for kicks), again I'd like the facet to be the color I set.
 
I can create various lights, directional, spot, even ambient, on my own, within OpenScad, and just apply the values to my facets.
 
So, actually, I guess what I'm asking for is just to turn off the internal lighting, and allow the facets to be the color that I set them to.
 
-- William

===============================
- Shaping clay is easier than digging it out of the ground.


http://internationalwilliam.spaces.msn.com/

 
> From: [hidden email]

> Date: Sun, 11 Sep 2011 19:48:02 +0200
> To: [hidden email]
> Subject: Re: [OpenSCAD] lighting angle?
>
> On Sep 11, 2011, at 19:18 PM, William Adams wrote:
>
> > While you're looking at lighting, could you add an ambient light mode? I'd like the option of doing my own lighting on occasion.
> >
> Concrete ideas as welcome :)
> I think we'll have to rewrite the whole 3D scene handling code eventually. If that is done using a more high-level library than OpenGL (think OpenScenegraph or the likes), it would be quite easy to add interesting high-level alternative navigation and presentation modes.
>
> -Marius
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

nophead
Can you have a 3D view on a 2D screen without lighting? I think it
would look flat and be ambiguous.

On 11 September 2011 21:32, William Adams <[hidden email]> wrote:

> I haven't looked at the lighting code, but really, all I need is for facets
> to be the color that I set them to.
>
> There are two cases where I want to just deal with my own lighting.
> 1) For surface, where I have the normals for every vertex, I can at least
> calculate a light value for the facet, and just set that value.
> 2) For cases where I'm rendering an image onto the surface (just for kicks),
> again I'd like the facet to be the color I set.
>
> I can create various lights, directional, spot, even ambient, on my own,
> within OpenScad, and just apply the values to my facets.
>
> So, actually, I guess what I'm asking for is just to turn off the internal
> lighting, and allow the facets to be the color that I set them to.
>
> -- William
>
> ===============================
> - Shaping clay is easier than digging it out of the ground.
>
>
> http://internationalwilliam.spaces.msn.com/
>
>
>> From: [hidden email]
>> Date: Sun, 11 Sep 2011 19:48:02 +0200
>> To: [hidden email]
>> Subject: Re: [OpenSCAD] lighting angle?
>>
>> On Sep 11, 2011, at 19:18 PM, William Adams wrote:
>>
>> > While you're looking at lighting, could you add an ambient light mode?
>> > I'd like the option of doing my own lighting on occasion.
>> >
>> Concrete ideas as welcome :)
>> I think we'll have to rewrite the whole 3D scene handling code eventually.
>> If that is done using a more high-level library than OpenGL (think
>> OpenScenegraph or the likes), it would be quite easy to add interesting
>> high-level alternative navigation and presentation modes.
>>
>> -Marius
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> [hidden email]
>> http://rocklinux.net/mailman/listinfo/openscad
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>
>

Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

William Adams
Meaning, I will add lighting myself.
 
I could add 1, 2, 3, or more point or directional lights, and calculate the light values at my vertices.  Then I can color the individual facets accordingly.  No gradient across the face of the thing (unless it was supported), but at least I could do my own lighting.
 
Basically the same thing you have to do when programming in OpenGL ES, or current GL models above 3.x
 
I recognize this is a fringe sort of thing, and perhaps what would really float my boat is if I could participate more fully in the rendering pipeline.
 
None of this enhances the CSG aspects, which are most important.  I just thought I'd mention it while lighting was being discussed.
 
-- William

===============================
- Shaping clay is easier than digging it out of the ground.


http://internationalwilliam.spaces.msn.com/

 
> Date: Sun, 11 Sep 2011 22:04:56 +0100

> From: [hidden email]
> To: [hidden email]
> Subject: Re: [OpenSCAD] lighting angle?
>
> Can you have a 3D view on a 2D screen without lighting? I think it
> would look flat and be ambiguous.
>
> On 11 September 2011 21:32, William Adams <[hidden email]> wrote:
> > I haven't looked at the lighting code, but really, all I need is for facets
> > to be the color that I set them to.
> >
> > There are two cases where I want to just deal with my own lighting.
> > 1) For surface, where I have the normals for every vertex, I can at least
> > calculate a light value for the facet, and just set that value.
> > 2) For cases where I'm rendering an image onto the surface (just for kicks),
> > again I'd like the facet to be the color I set.
> >
> > I can create various lights, directional, spot, even ambient, on my own,
> > within OpenScad, and just apply the values to my facets.
> >
> > So, actually, I guess what I'm asking for is just to turn off the internal
> > lighting, and allow the facets to be the color that I set them to.
> >
> > -- William
> >
> > ===============================
> > - Shaping clay is easier than digging it out of the ground.
> >
> >
> > http://internationalwilliam.spaces.msn.com/
> >
> >
> >> From: [hidden email]
> >> Date: Sun, 11 Sep 2011 19:48:02 +0200
> >> To: [hidden email]
> >> Subject: Re: [OpenSCAD] lighting angle?
> >>
> >> On Sep 11, 2011, at 19:18 PM, William Adams wrote:
> >>
> >> > While you're looking at lighting, could you add an ambient light mode?
> >> > I'd like the option of doing my own lighting on occasion.
> >> >
> >> Concrete ideas as welcome :)
> >> I think we'll have to rewrite the whole 3D scene handling code eventually.
> >> If that is done using a more high-level library than OpenGL (think
> >> OpenScenegraph or the likes), it would be quite easy to add interesting
> >> high-level alternative navigation and presentation modes.
> >>
> >> -Marius
> >>
> >> _______________________________________________
> >> OpenSCAD mailing list
> >> [hidden email]
> >> http://rocklinux.net/mailman/listinfo/openscad
> >
> > _______________________________________________
> > OpenSCAD mailing list
> > [hidden email]
> > http://rocklinux.net/mailman/listinfo/openscad
> >
> >
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

kintel
Administrator
In reply to this post by William Adams
On Sep 11, 2011, at 22:32 PM, William Adams wrote:
> 1) For surface, where I have the normals for every vertex, I can at least calculate a light value for the facet, and just set that value.
> 2) For cases where I'm rendering an image onto the surface (just for kicks), again I'd like the facet to be the color I set.

At the moment, OpenSCAD doesn't give you access to any of this and there are no plans for defining such low-level access to surface attributes. This sounds way way down the road in terms of OpenSCAD.

 -Marius
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

William Adams
Fair enough.  Maybe a different renderer some time in the future.  If such a renderer existed, I'd just be able to reposition the lights, add some, perhaps add some other artifacts to the scene for rendering purposes (like materials and the like).  In the meantime, I'll make due with what's there.
 
-- William

===============================
- Shaping clay is easier than digging it out of the ground.


http://internationalwilliam.spaces.msn.com/

 
> From: [hidden email]

> Date: Sun, 11 Sep 2011 23:44:22 +0200
> To: [hidden email]
> Subject: Re: [OpenSCAD] lighting angle?
>
> On Sep 11, 2011, at 22:32 PM, William Adams wrote:
> > 1) For surface, where I have the normals for every vertex, I can at least calculate a light value for the facet, and just set that value.
> > 2) For cases where I'm rendering an image onto the surface (just for kicks), again I'd like the facet to be the color I set.
>
> At the moment, OpenSCAD doesn't give you access to any of this and there are no plans for defining such low-level access to surface attributes. This sounds way way down the road in terms of OpenSCAD.
>
> -Marius
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

Ervan
In reply to this post by kintel
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.
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

Ronaldo
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();
}
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

Ervan
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 ....
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

rickan
In reply to this post by nophead
Seems like there were some on this thread who wanted what might be called
flat, all-around or ambient lighting such that the orientation and view
angle do not affect apparent face colors. I also want to request an option
like that.

I'm creating an optical illusion and shadows give it away so without this
option I have to adjust the face colors to compensate for the shadows. Seems
a shame to have to do that when a flat lighting option would obviate that
considerable effort.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

tp3
That might fit into that feature request:

https://github.com/openscad/openscad/issues/3339

ciao,
  Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

nophead
The problem with flat lighting is all the faces would be the same colour, so you would not be able to see any edges. The same happens when you use the orthogonal projection and view something from above. Something like a blind hole becomes completely invisible.

On Fri, 14 Aug 2020 at 18:19, Torsten Paul <[hidden email]> wrote:
That might fit into that feature request:

https://github.com/openscad/openscad/issues/3339

ciao,
  Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: lighting angle?

rickan
In reply to this post by rickan
Here's the illusion:

Illusion.png <http://forum.openscad.org/file/t1112/Illusion.png>  

It's a view of 12 of the 30 faces of a rhombic triacontahedron.

If the lighting weren't so extraterrestrial, I would not have had to make it
so dark, but it didn't turn out to be all that difficult to calculate the
colors needed to produce this, and, now that I've made it, I see that it
works better breaking the illusion by rotating the view with lighting that's
not flat:

DisIllusion.png <http://forum.openscad.org/file/t1112/DisIllusion.png>  



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org