• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can I change glow values based on values in a CSV file?

Community Beginner ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

Heya.

 

Am I able to modulate glow intensity based on values I have in a CSV file? I have a CSV file where I have the luminance value of each frame, and I want to be able to make the glow more intense when the frame is darker, and less intense when the frame is brighter.

I would like AE to somehow reference the CSV file and change the glow property based on the frame number and the luminance level in the CSV.

 

Is this possible?

 

Thanks.

TOPICS
Expressions , Scripting

Views

133

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

What does your CSV file look like?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

There's many thousands of values, but here's a snippet:

 

Frame,Luminance,Cut
0,65.07,X
6,64.38,
12,63.55,
18,62.07,
24,61.25,
30,60.42,
36,61.15,
42,61.96,
48,62.44,X
54,62.94,
60,63.46,
66,64.56,
72,65.42,

 

And at the end of the CSV is:

 

Top 10 Brightest Frames
Rank,Frame,Luminance
1,4956,72.05
2,6354,71.95
3,4950,71.93
4,9096,71.92
5,4962,71.66
6,6384,71.65
7,9102,71.62
8,6390,71.61
9,18150,71.59
10,9126,71.45

Top 10 Darkest Frames
Rank,Frame,Luminance
1,36090,53.20
2,36096,54.48
3,29262,55.44
4,36102,55.53
5,48714,55.92
6,13722,56.10
7,51234,56.18
8,50940,56.25
9,45720,56.26
10,29256,56.2

 

The top 10 values are so I can go to the lightest and darkest frames to sample what the glow intensity looks like at it's most extreme values.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

Oh, I should clarify, the "Cut" are the frames where a jump-cut occurs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

This probably won't exactly fit your situation, but based on the info provided it should be helpful for you to try it. First, I think you'll need to truncate your CSV file so that it only has the first set of data (Frame, Luminance and Cut). Import that file into AE (I've assumed the file name is "Glow.csv"). Drag the file into your comp timeline, so the expression will able to retrieve the number of rows. Then apply this expression wherever you need to retrieve the current, interpolated luminance value:

numRows = thisComp.layer("glow.csv")("Data")("Number of Rows");
curFrameVal = timeToFrames(time);
prevFrameVal = nextFrameVal = 0;
for (i = 0; i < numRows; i++){
  prevFrameVal = nextFrameVal;
  nextFrameVal = footage("glow.csv").dataValue([0,i])
  if (curFrameVal <= nextFrameVal) break;
}
if (i >= numRows){
  footage("glow.csv").dataValue([1,numRows-1]);
}else{
  nextLumVal = footage("glow.csv").dataValue([1,i]);
  prevLumVal = i == 0 ? nextLumVal : footage("glow.csv").dataValue([1,i-1]);
  linear(curFrameVal,prevFrameVal,nextFrameVal,prevLumVal,nextLumVal);
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

Oh wow, so I can import CSV files into AE and even put them in the timeline? Do I need to put it in the timeline, or can it be from the project bin? Thanks so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2024 Dec 02, 2024

Copy link to clipboard

Copied

LATEST

You can leave them in the project bin, but puting them in the timeline gives you access to the number of rows. Without that, you need to craft your expression so that it doesn't run off the end of the data and cause an error. That wouldn't be an issue if the last frame number is always beyond the end of your comp. Otherwise you might have to do a try/catch to catch the error locally (or use some capability I'm not aware of--which is certainly possible).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines