PDA

View Full Version : Premultiplied color


ruddiger52
02-26-2010, 06:27 PM
How can I change the premultiplied color of some premultiplied rendered footage. In combustion this is very easy to do. I just cant find it in nuke. I need to change it from black to white.

Thanks

MasonDoran
02-27-2010, 02:15 PM
make friends with the tab key......will bring up a hotbox where you can type Premult or unpremult ;)

Unfortunately though, Nuke assumes the color of the alpha channel for the premult. ie: black for 0, and white is 1. You will have to setup your own network if you want a different color.

scrawford
02-27-2010, 08:49 PM
this thread has a workaround for you

http://www.vfxtalk.com/forum/do-you-premult-white-t18526.html?t=18526&highlight=premult

ChristopherP
02-27-2010, 09:43 PM
the actual solution (other than the workaround posted) is also in this linked thread...one really shouldn't use any other background-color than black to premultiply against when rendering ;)


c.

thatoneguy
02-28-2010, 07:05 AM
(fg * a) + (bg * (1-a) = Comp.

This is the most important equation to know in compositing. It's the equation for a standard "Over" composite. If you know it and understand it you'll be able to solve many a problem. In plain english it's:

(Premultiplied Foreground) + (Background * Inverted Alpha) = Composite.

In this case you've already composited your fg over your bg (white). So you have:

(fg * a) + (1 * (1-a)) = comp.

What you want is just the (fg*a) part so what you do is simply subtract the other term:

(fg * a) + (1 * (1-a)) - (1 * (1-a)) = (fg * a)

That still can look a little intimidating so written out more simply you can see it as:

A + B = C

but we just want A so we subtract "B" and get:

A + B - B = A

In this case "B" = the inverted alpha. In short. Invert the alpha and subtract it from the fg.

Class Dismissed! Go make some art! :beer:

P.S. Christopher's solution though is the best.

ruddiger52
03-02-2010, 06:20 PM
Wow thanks for the info. I dont see a link for ChristopherP?

ChristopherP
03-03-2010, 10:05 AM
i was talking about the linked vfxtalk-thread scrawford posted...sorry for the confusion :)

ruddiger52
03-03-2010, 06:09 PM
Cool thanks for clarifying. So I understand the overall concept described in the thread, but I don't get how the following translates into anything in nuke.

set cut_paste_input [stack 0]
version 5.1200
push $cut_paste_input
Dot {
name Dot1
selected true
xpos 345
ypos -141
}
set N28375e50 [stack 0]
Dot {
name Dot2
selected true
xpos 479
ypos -141
}
push $N28375e50
push $N28375e50
Invert {
channels rgba
name Invert1
selected true
xpos 227
ypos -145
}
Constant {
inputs 0
channels rgb
color {1 0 0 0}
name BG_COLOR
selected true
xpos 168
ypos -238
}
Copy {
inputs 2
from0 rgba.alpha
to0 rgba.alpha
name Copy1
selected true
xpos 168
ypos -108
}
Premult {
name Premult2
selected true
xpos 168
ypos -69
}
Merge2 {
inputs 2
operation minus
name Merge1
selected true
xpos 311
ypos -69
}
Dot {
name Dot3
selected true
xpos 345
ypos -6
}
Copy {
inputs 2
from0 rgba.alpha
to0 rgba.alpha
name Copy2
selected true
xpos 445
ypos -16
}
Dot {
name Dot4
selected true
xpos 479
ypos 57
}


Is this a script I need to input somewhere?

alkali22
03-03-2010, 06:28 PM
That's how Nuke comps are stored. Just copy all that (don't miss any brackets) and paste it into your Nuke DAG.

ChristopherP
03-03-2010, 06:31 PM
you can literally just copy&paste that segment into nuke. or save it as a .nk file somewhere and import it back into nuke via file->import script.

edit: doh, replied a little too late ;)


c.

CGTalk Moderation
03-03-2010, 06:31 PM
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.