snap align to reflection option
Open, NormalPublic


this is a quick patch primarily aiming at making lighting/setting up reflections a bit easier.
In addition to the existing "snap align to surface normal" it indroduces a new option "snap align to reflection". This enables the user to just point at a position on a mesh and the light/emmitter will be positioned so that the resulting reflections will appear exactly where desired...

quick video showing this (there might be other usecases as well...)

hope this is useful for others




Hi Phillip,

I encountered fail building blender after apply your patch. This is the log after I used your patch and this is the error log for make error

Hi Aditia!

Maybe something got malformatted (I had some other stuff in the diff I took out by hand...)
I have attached another patch. Does this one apply?


This is quite clever, simple idea but powerful. Some comments:

* The buttons are bit confusing and take up a lot of space. Maybe it should become a single enum button No Rotation/Snap to Normal/Snap to Reflection.
* Is there some way we could support this without the empty that fits with the transform system? Would be nice if you could just select a light and do it.
* Please use tabs instead of spaces for indentation

Hi Brecht, and thanx for your comments!

I will try to address them in the following days (a bit busy atm...) and post and updated patch then.
Not quite sure how it would fit without using an empty (lamp would have to preserve distance to surface, not really something one would consider "snapping" anymore), but will think about it - maybe I can come up with something.

Tiny update (only now have time again) as v02:

* cleaned up tabs/spaces
* regarding the buttons: I've noticed that r56706 already reduced the width of enum-based dropdown lists (good!). I have modified the original patch to only show the dropdown if "use_snap_align" is enabled. After thinking a bit about it I find this more consistent with the rest of Blender [e.g. in the same header we can toggle "show_manipulator" and once its there we have other options to choose from]. It just feels strange to have a dropdown defaulting to the equivalent of "do nothing" and having other choices burried in there, no? I also removed the icons in the dropdown (made it confusing as well I think because the same icon was used twice)
* no progress yet on using lights directly [I will experiment with that next]

patch updated to master
(after my migration to git here - I've also set up arcanist, if that helps)

The patch seems really nice to me, but would be cool if it's supported workflow where parenting to an empty is not needed. Any progress with that?

@Sergey Sharybin (sergey): I made it an addon for the time being. It's working a little differently [more like a brush], but no empties needed here. Just select the lamp/emitter and launch the modal op.
If this is interesting for you/others, please give it a go [feedback really appreciated]. Might also be a fun exercise porting this back to C if this functionality is considered for inclusion...

note: addon is alpha/beta and not ready for primetime, but could very well serve as a reference on how to proceed from here


  • Tool panel is in T-Region
  • select lamp/emitter
  • launch tool (shortcut Shift+Q)
  • move brush over surface, click-drag will position lamp/emmiter accordingly
  • F+mousemove will let you adjust distance from surface
  • F+middlemousescroll will let you adjust emitter strength
  • there are a couple of options (also user-preferences), hope the tooltips are explainatory for now

What do you think?

I didn't test the addon yet, but from the description it sounds rather really handy and more clear. Would be nice to have it wrapped around and ended up in official addons repository.

I tested the addon.
Display of the widget seems very complete and customizable. It works well.

The need to use middlemousescroll for adjusting strength is not obvious when you are only looking at the header.
It seems to be overcompilcated to hold F and scroll mouse wheel at same time.
Maybe you wanted user to be able to change distance and strength at same time but probably a trick to synchronize sliders would be more easy to use.

IMO, Shift F to change strength is more natural to somebody using sculpt and paint modes.

Strength slider does not work well with Cycles. It does not work if lamp don't have an emission node with a strength slider.
And value of the slider is still between 0 and 1 which does not correspond to ranges used for Cycles Lamps.
So if you want to decrease default point lamp, you quickly goes to negative values for the slider.
Maybe it could change value of color of lamp when it is not using nodes.
Cycles is a complicated case. If the tool becomes a kind of lighting setup mode, it should also take into account emitter size.

About that, color sliders or a call of color picker could also be a cool addition.
Problem is that you have to quit the mode, each time, you want to change a setting not taken into account by the addon.
Even with "Bend towards diffuse shading" slider, you have to quit mode. But it would be great to have it in interactive mode.
It is also a pity to quit to select another lamp that already exists.
IMO, switch through existing lamps could be a good use of mousewheel.

thanx for checking this out, @ronan ducluzeau (zeauro).
And thanx for the suggestions! I'll review this whole thing in depth in about a month from now (busy atm) and your suggestions will help a lot :)

That's awesome tool for product visualizations. great work :)
As zeauro said, would be more awesome to see distance adjustments in real. Strength already is, but I feel the same - slider is not corresponding to cycles range. Adjust Color on a fly sounds also great to me.

Another thing is - I wanted to post a bug, because I wasn't able to adjust strength, than I noticed this issue is related to Apples Magic Mouse. Classic (old) mouse wheel works.

Plus one private request - New light (Ctrl+LMB) generates a copy of selected object, would be helpful if copy will be with all setup of source. Like I created mesh light, thin long rectangle with disabled camera rays in object properties. But new generated object was original Plane.

Thank you
Just a quick test that made me happy :)

This is nice,

Maybe :

If nothing selected, add a popup to select a light.

If a light is well placed, clic on F to change the distance and strenght without having to replace the light to apply those settings.
Maybe add a color picker to the F settings too.

Also when working on a pen, we cannot change the strengt, maybe make this in two times like sculpt

F = Distance
Ctrl + F = Strenght

Or you can create a popup with all the usefull settings of the light.

Thanx again for checking this out (and also for the very helpful feedback -- this will be considered once I find time for the next round of fixes/enhancements)
Cant really promise an exact deadline for this, anyways: seeing that people are actually interested pushes this as a priority for me for sure :)
Will keep you updated here.

Add Comment