Home Page › forums › Autodesk/Discreet › Flame and Smoke › Expression to export luminance value?
- This topic has 7 replies, 6 voices, and was last updated 14 years, 11 months ago by loops.
-
AuthorPosts
-
December 1, 2005 at 4:51 pm #200464Andy MilkisParticipant
Hi All,
I am trying to work up a plan to link the luminance of an image to the y or z position of 3D Geometry using expressions. So far, though, I have been unable to find a way to extract 8bit luminance values (0-255) to a variable that I can link.
Any thoughts?
Thanks,
Andy
December 1, 2005 at 9:10 pm #211255loopsParticipantCan’t be done 🙁
If the geometry you want to move is /really/ simple, you could build it with an extended bicubic and use surface displacement to move it according to a clip’s luminance, but only if it’s /really/ simple, since displacement moves the surface relative to the normal at that point, not relative to the global axes.
Or it would be easy enough to write a Spark to convert a clip’s luminance into an animation channel that you could paste elsewhere, or even link to an Axis in Batch.
That would be useful for all kindsa stuff. I might do that myself…
December 2, 2005 at 12:15 am #211251XavierParticipantSapphire Flicker Remove spark creates a channel that’s derived from the average values of the pixels inside it’s analysis box.
I’m sure you could copy that channel and paste it in action and find a way to use it from there.
Good luck.
— Xavier
December 2, 2005 at 2:08 am #211256loopsParticipantGood point that man 🙂
But since I’ve written the Spark anyway I may as well post it. It just takes the red value of the bottom left pixel of the input and creates a keyframe on every frame. If you want the average of the whole frame, or a different location’s value, just blur or transform the clip first, I can’t be arsed making it complicated 🙂
64-bit Irix binary here
32-bit Irix binary here
Stick ’em in your /usr/discreet/product_name/sparks folder and you should be good to go, but don’t blame me if it explodes or whatever, standard disclaimer, yadda yadda.
I ain’t got a Linux system to hand, so if you want a Linux version you can compile it yourself from source which is here
Some usage instructions in the code – look how easy it is to write a Spark! Anyone else got any to share? For free mind, to “commercialize” your Sparks you need to join the dev program.
Code:/* sparkRedToCurve.c – My First Spark ™Simply copies the value of the red channel of the bottom
left pixel of the each input frame to the animatable
control value to create a curve following the value of the
pixel, which you can copy and use elsewhere. 8-bit only.To use: you don’t need to click process, just playing or
scrubbing is enough to create keyframes. Then hit Copy
in the Animation buttons, Exit the Spark and Paste the
keys somewhere interesting. If you do click Process,
you’ll get a clip of random garbage.To compile: put this in the sparks folder, add it to the
Makefile (ugly) and run make. On Irix you’ll need
some kind of compiler installed and gmake instead of
regular make.Made with 154 grams of fruit per 100 grams of product. */
#include “spark.h”
/* Define our single control, an integer at position 6 */
SparkIntStruct SparkInt6 = {
0, /* Initial value 0 */
0, /* Minimum value 0 */
255, /* Maximum value 255 */
1, /* Increment step */
SPARK_FLAG_NO_INPUT, /* Don’t let the user change the value */
“Bottom left pixel red %d”, /* Label for the control */
NULL /* Optional on-change callback function */
};/* Return number of input clips required */
int SparkClips(void) {
return(1);
}/* New memory allocation interface – defining this keeps Batch happy */
void SparkMemoryTempBuffers(void) {
}/* We want to run at the module level, not on the desktop */
unsigned int SparkInitialise(SparkInfoStruct sparkInfo) {
return(SPARK_MODULE);
}/* Returns how many frames to output for each input frame */
int SparkProcessStart(SparkInfoStruct sparkInfo) {
return(1);
}/* The real work is in here */
unsigned long *SparkProcess(SparkInfoStruct sparkInfo) {
SparkMemBufStruct resultBuffer, inputBuffer;
char *result, *input;/* Check result buffer is locked */
if(!sparkMemGetBuffer(1, &resultBuffer)){
return(NULL);
}
if(!(resultBuffer.BufState & MEMBUF_LOCKED)) {
return(NULL);
}/* Check input buffer is locked */
if(!sparkMemGetBuffer(2, &inputBuffer)){
return(NULL);
}
if(!(inputBuffer.BufState & MEMBUF_LOCKED)) {
return(NULL);
}/* Get a pointer to the array of pixels in the input frame */
input = (char *)inputBuffer.Buffer;/* Set our control value */
sparkSetCurveKey(SPARK_UI_CONTROL, 6, sparkInfo.FrameNo, input[0]);/* Return pointer to result buffer – note that we
haven’t actually touched it so it will be full
of garbage – who cares? */
return(resultBuffer.Buffer);
}/* Do nothing on uninit */
void SparkUnInitialise(SparkInfoStruct sparkInfo) {
}December 2, 2005 at 3:33 am #211250John MontgomeryKeymasterloops wrote:Good point that man 🙂But since I’ve written the Spark anyway I may as well post it.
That is waaaaay awesome — thanks so much for sharing. Its totally cool to see folks sharing stuff here….one of the big reasons Jeff, Mike and I started the site.
December 3, 2005 at 1:57 am #211253BKMParticipantYes.. very cool. I’d love to be able to create sparks. But scripting/coding isn’t my thing. 😥
However, this brings me to a general Discreet Question….
Why doesn’t Discreet write more Sparks for their systems? I would think that they could come up with some useful ones. I suppose this would come in more handy with Smoke/Fire as they have soft effects on the timeline. And most of the optics/FX tools are available in batch on IFF. (right?)
Smoke/Fire has FX tools (optics, etc.) but they are clip to clip processes and not real editor friendly.
I would think that these tools could be made sparks witch would make them more usefull in the timeline. Better layer to layer blend modes would be nice.
Thoughts?
BKM
December 4, 2005 at 11:13 am #211252boomji_vbParticipantjohnmont wrote:loops wrote:Good point that man 🙂But since I’ve written the Spark anyway I may as well post it.
That is waaaaay awesome — thanks so much for sharing. Its totally cool to see folks sharing stuff here….one of the big reasons Jeff, Mike and I started the site.
whoa !!! dude. thanks so much for this lil tute.
i’m a gonna dig into this with much glee 😉 .
hope i dont botch things up…too much 😆b
December 4, 2005 at 4:17 pm #211254loopsParticipantMore blend modes for Smoke… maybe when I next get some free time 🙂 They wouldn’t run anything like as fast as the Axis blend modes since those are done in hardware. Although on a Linux system with their more exciting graphics, you could do any blend mode in hardware really fast with a fragment program… damn, that’s an interesting thought… I wish I had one :-/ Should be able to do all kinds of things in hardware.
-
AuthorPosts
- You must be logged in to reply to this topic.
