Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Link lightcolour to pixelcolour

Link lightcolour to pixelcolour

Anonymous
Not applicable
1,624 Views
39 Replies
Message 1 of 40

Link lightcolour to pixelcolour

Anonymous
Not applicable
Hey!
I have a little problem, but I think that it can be solved with a MaxScript.
I want a video to be displayed on a LED-display. I simply made an array of 300 volumetric spotlights. Now I would like to link the colours of each light to the colour of the according pixel of a video. My example array has 20*15 lights, so I would make a video with the same resolution.
First of all, do you understand what I'm trying to say? I'm not a native speaker 🙂
Then is something like this possible?

It would be a great help to me!

Thanks in advance!

0 Likes
1,625 Views
39 Replies
Replies (39)
Message 2 of 40

Anonymous
Not applicable
I remember bobo had a tutorial that used a bitmap to drive the creation of an array of boxes, you could probably look at that as a start point.

http://www.scriptspot.com/bobo/

click on the maxscript2 and look for the public maxscript tutorials.
0 Likes
Message 3 of 40

Anonymous
Not applicable
Hm, that looks complicated for someone who has no idea of MaxScript at all, as it has to be modiefied.. But I will gibve it a try! Thank you very much Dan!

Nevertheless, I'd be very happy if someone is willing to give me a hand with that script! 😉
0 Likes
Message 4 of 40

Anonymous
Not applicable
Oh ok I didn't realise you are just starting with script , if you post a simple test scene then I could knock up a quick example script that operates on your file. It might be easier to see what its doing if its directly applicable to your specific problem domain.

Cheers

Dan
0 Likes
Message 5 of 40

Anonymous
Not applicable
Wow, you are my hero! 😉
But what kind of scene do you want me to post? If I understand bobo's script, it counts the pixels of the image(sequence) and creates an equal amount of colored boxes. It would be perfect if the script could do the same just with lights and animated color.
So, what do you need me to do?
0 Likes
Message 6 of 40

Steve_Curley
Mentor
Mentor
Your "scene" is the Max file you're working on - <filename>.max. Zip it, then attach it to a post as you did with the original image.

There's an example in the Maxscript Help explaining how to access the pixels in a bitmap. That part shouldn't be difficult. The tricky bit will be doing it for a different image per frame, and working out how to change things on a per frame basis. The callbacks are the problematic part (for me), which is why I'm not attempting this myself 😛

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 7 of 40

Anonymous
Not applicable
Yeah, sure. But I wasn't sure what for he needs my scene, as I made the LED-array manually and the script would create everything from scratch by itself, right?
However, here you are:


Edit: Could you tell me where to find that example in the MaxScript Help, Steve? I'm not sure where I have to look. Thanks! 🙂

16770_Tcf7VeY9LD97IakgFkF2.zip

0 Likes
Message 8 of 40

Steve_Curley
Mentor
Mentor
Not necessarily - you already have the lights set up, no point re-creating them in the script as this is a "one off" project (I assume?)

Maxscript Help > Maxscript Language Reference > Values > Bitmap Values
Maxscript Help > Frequently asked questions > Writing better & faster scripts > Never get a single pixel...
Also
Maxscript Help > Maxscript Tools and Interaction with 3ds Max > Change Handlers and Callbacks > General Event Callback Mechanism

Have fun 😉

ps. It helps if you put your Max version (and brief system specs) in your sig. Important with Maxscript questions due the the number of differences between the versions.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 9 of 40

Anonymous
Not applicable
What's a "one off" project? As I said, I'm not a native speaker 😉
This was actually just a test scene. It would be great if I could make displays with different resolutions. But I assume that it's not that difficult to change the resolution later in the script?
0 Likes
Message 10 of 40

Steve_Curley
Mentor
Mentor
Sorry - I meant that this is not a job you would need to do repeatedly in multiple different scenes - correct me if I'm wrong.

"One off" simply means to be used once in this one scene then never again.

In other words, if you need to be able to create an array of lights, and have them affected by an .avi, in multiple scenes, then that impacts on how the script is written. It would probably need a UI so you could tell it the size of the array, for example, which in the current scene would not be needed because the lights already exist.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 11 of 40

Anonymous
Not applicable
I'm afraid I do need different sizes in different scenes...
Did you have a look at Bobo's tutorial? He made a script with UI that can count the pixels. Isn't something like that possible only with lights?
I'm currentliy having a look at the examples in the Help, but I'm afraid I didn't choose the best topic to get into MaxScript...
0 Likes
Message 12 of 40

Anonymous
Not applicable
Hi I did some modifications to the tutorial script, I attached the max scene it operates on and the image sequence the script reads in.
As it was a quick example I set it to read the images in from the C drive as I'm pretty sure every one has one of them! But you can alter the script to read in the squence from anywhere you like.

Anyway it should shed some light on how to go about it, I'm not saying its the only or best way but its a possible solution.

The next step I suppose would be to extend it to do the scene setup side of things, if you need any help with that then let us know.

Cheers

Dan

16780_UytvpjAShmaAVjTJP1X6.zip

0 Likes
Message 13 of 40

Anonymous
Not applicable
Actually the more I think about it the more you will definitely need to automate the scene setup, as creating and associating all them volume light effects to lights would be a nightmare by hand(I think).
0 Likes
Message 14 of 40

Anonymous
Not applicable
Thank you so much for your effort. I will take a closer look tomorrow. Just one question now: Why do you change the fog color and not the light color?
0 Likes
Message 15 of 40

Anonymous
Not applicable
Thats because I am new to using volume lights I assumed incorrectly that the fog colour was the correct way to change the colour.

In that case that makes things alot simpler, I updated the the script to just animate the light color of each light and I have also changed the scene slightly.

The only difference apart from only having one volume light effect is I have made each light a child of the previous light. This because this script gets the next light to work on via the .children property. Seemed like a quick way to loop through the lights rather than getting by name or collecting them up into an array.

16792_CMVqy1RD3cqRP5xuzQAt.zip

0 Likes
Message 16 of 40

Anonymous
Not applicable
All right. Now how can I make my own light array work with that script? I'd like to create arrays of different sizes out of photometric Target Lights. What do I have to change to achieve that?
0 Likes
Message 17 of 40

Anonymous
Not applicable
I got a bit of a workload to get through but, if your after pointers for creating lights then the maxscript listener is good for finding out the correct comands such things as light creation and also look into FOR loops. you will want a loop which repeats your light creation code and uses the loop index as a multiplier for offseting the light position so they dont get created ontop of each other.

The maxscript help has some good tutorials for getting the hang of script concepts.
0 Likes
Message 18 of 40

Anonymous
Not applicable
Nah, the script doesn't have to create those lights, I don't want it to be any more difficult than it has to be. I tried to edit the script so that it changes the color of my manually created array of photometric lights, but it didn't work. I just replaced every $Spot01 with $TPhotometricLight01 and made them all children of the previous light, but i suppose that's not enough.. What else do I have to change?
0 Likes
Message 19 of 40

Steve_Curley
Mentor
Mentor
Here's a starting point. It is NOT complete by any means, creates standard spots (I haven't worked out how to create photometric ones yet).
Ignore the filename stuff - it doesn't do anything (yet).

16859_dBlsDhyf8KSmf5JZQMiI.zip


Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 20 of 40

Anonymous
Not applicable
Cool, it even creates the array! 🙂
Now do I understand it correctly that one of the main problems is to address photometric lights instead of standart lights? Is it such a big difference?
0 Likes