Hello,

I'm just getting started with shaders, and I'm having some trouble
understanding how data is passed up and down the shader tree.

If I modify some attributes of the VertexContext in vertex_shader (like N or
PW), I can see those are passed along to the fragment_shader, and can access
the modified ones from there.
However, I can't manage to do the same thing with Cf. If I do this in
vertex_shader():

vtx.vP.Cf() = my_color;

... the VertexContext in fragment_shader() seems to ignore that (or it's
being overridden by something else). For now, I've been doing this in
fragment_shader(), but I don't know if that's good practice, or if I should
be doing that differently.

void fragment_shader(const VertexContext & vtx, Pixel & out) {
  VertexContext new_vtx(vtx);
  vertex_shader(new_vtx);
  // And then getting what I need from new_vtx instead

}


Also, this raises another question for me. Even if I can get the color I
want into the "out" Pixel, what should I do for the renderer to take into
account opacity? If I set my out Pixel to have an alpha of 0.5, it does
render out with an alpha of 0.5, but any objects behind are still fully
occluded. However, Fillmat seems to do what I would like to. What does
FillMat do to set its color and opacity?

Thanks,
Ivan
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to