Linking an images' luminace value to a lights' intensity value

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  08 August 2012
Smile Linking an images' luminace value to a lights' intensity value

I'm trying to control a lights' intensity value with the luminance value of an image. Does anyone know how I could possibly do this.

The image is a time lapse sequence. The sun is passing from the horizon to the midday sky through a lot of clouds. So the sun is flickering very fast as it rises.

I was thinking I could track the sun moving across the sky, and then crop it down to a 4x4 pixel image sequence. Then I could link the luminance values from the image sequence to a lights' intensity. I could use multiply node if the values are too small.

Any suggestions would be grand.

  08 August 2012
colorAtPoint command to sample the image from a file node, do this in form of an expression to be run on every frame.
  08 August 2012
Hi!! Thanks for your reply.
I've been searching the internet to understand how to create an expression and how to use the colorAtPoint command. But it's all way over my head.

I was wondering if you could expand a little on your explanation. For example, where on the file node do I create the expression?

Any help is greatly appreciate

  08 August 2012
From the sound of it, you'd want to create expression on your light's intensity.

The general idea is...
light.intensity =

But if you already create an HDR sequence, just add that as a texture to your light's color.
  08 August 2012
Thanks for your help guys.

I do have a hdr image sequence, but when I attach that to the light intensity or the light color it does nothing... I just get a zero value in the lights intensity and a constant white value in the lights color.
I used the connection editor to do this and went through the whole list of attributes that would let me connect with the intensity and or color.
I tried filenode outColor to the lights color
filenode colorGain to the lights Color
filenode defaultColor to the lights Color
etc. etc.
Nothing worked, which seems very unusual.

I tried the expression but I'm just not understanding them. I kind of get it if I saw someone else do it, but I couldn't repeat it. So to make one on my own is pretty much close to impossible for me.
I did attempt it though... right click the intensity attribute on my light > create expression. In the editor:
sun_pointLightShape1.intensity = colorAtPoint -u .5 -v .5 file2;
I got the colorAtPoint part from the maya help files. I also tried:
sun_pointLightShape1.intensity = colorAtPoint -o RGB -u .5 -v .5 -u 0.0 -v 0.1 file2;
But there were many syntax errors.

If I can't work this out then I'll have to animate by hand 1148 frames of light flickering through clouds to match a back plate, so any other ideas would be greatly appreciated.


Last edited by breakerdrea : 08 August 2012 at 07:30 AM.
  08 August 2012
I just did a little test. Maya 2011. Added HDR to a spot light color normally like texture map. Render with Vray and it shows up without doing anything fancy. I'm guessing the value is correct too because it looks way different than software render.
  08 August 2012
When you plugged the texture into the light intensity, did you do a render?

This might seem like a stupid question, but it's not obvious to everyone. In Maya, the color swatch will turn black or white or something random because it can just display a single value and not the many values that a texture can represent. Even if the texture is a solid color, Maya will not represent that color in the value or color swatch.

You have to render to see if your light is working as it should.
  08 August 2012
Thank you, thank you, thank you!!!

Thank you so much for your help. You were right Nyro, all I had to do was a render to see... I was just looking at the values in the attribute editor.
I also inserted a multiply divide node in between and I can now increase or decrease the intensity globally.

You guys saved me a whole lot 'o work.

  10 October 2012
Trouble with 32bit floating files colorAtpoint

I am doing something quiet similar to breakerdrea, but I need to change the color of the light driven by the colorAtPoint.
I found out that the colors that been read are just wrong if the colour is very bright (r0.965 g0.972 b0.801) it will be that colour in maya (r0,957 g1 b0) or a dark colour (r0.007 g0.002 b0.004) will be in maya (r1 g0 b0.416). Do you have an idea where that is coming from?

float $RGB[] = `colorAtPoint -o RGB -u .5 -v .5 fileweiss`;
select -r pointLight1 ;
setAttr "pointLightShape1.color" -type double3 ($RGB[0]) ($RGB[1]) ($RGB[2]) ;

I am using
Maya 2013
32bit floating
I tried exr, hdr, tif32bit
The test files are generated with nuke and photoshop
  10 October 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:28 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.