Sorry, I forgot to add the “code” tag. Now the hyphens are correct!
Hi there,
If you ever experienced fatigue for constantly change the Locator Scale attribute at sunDirection (Physical Sun and Sky, directional light node), here is a simple solution.
What does this expression do:
It’s changing the Locator scale value depending on the distance between the camera (persp) and the sunDirection node.
sunShape node, Object Display section
- Create an expression for Locator Scale attribute
(right click, Create New Expression…) - Paste this code:
sunShape.locatorScale = 0.05 * sqrt( pow((persp.translateX - sunDirection.translateX),2) + pow((persp.translateY - sunDirection.translateY),2) + pow((persp.translateZ - sunDirection.translateZ),2) );
- Click to Create button.
- Change the multiplier for your needs.
You can easily create other expressions for other lights based on this (change the light name of course 🙂 ).
Cheers, D
[…] Auto Scale for Directional Light (MEL) A simple script which automatically scales the locator (easier to see) […]