Additive transparancy

I'm trying to do an additive transparancy shader that adds the color value of transparant objects together. I'm quite bad at explaining myself, but I'll try nevertheless:

What I want to do is similiar to the 'Color Dodge' blending mode in Photoshop - when several objects overlaps each other it creates a 'burn' effect where eg. areas with no overlap is dark blue, areas with overlap is light blue more overlab is cyan and area with the maximum overlaps is white. Max has got a similiar effect, where you just hit the 'additive' button under the transparanct options.

I've looked a bit at the Color Math' node, messed around with Incandencense and Transluency but without result so far, so please help if you've got a clue.

Ivanp.

You're probably looking for the Mix2Color and Mix8Color nodes. They have all the add/substract/multiply and other blending modes that you find in Photoshop.

Matt


Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com

Actually I believe he is looking to have two objects overlap additively, not two textures. I know how it works in MAX, but I must confess I don't know how to do it in XSI off the top of my head.

You might be able to do it with the right combination of transparency and translusency.

The mix nodes work with any attribute that can be translated to/from a color, not just textures. This means you can add transparency, translucency, bump, etc...

Matt


Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com

Cheers for the replies. How would the shading network look like when doing the additive transparancy fess describes? Sofar I've tried connecting two constants to the colorMath_Basic with the add turned on which is connected to the color and transparancy of another constant node. This sort of does what I want, but instead of ending up with the above mentioned color range from blue through cyan(ish) to white I ended up with only two different colors. I tried with the mix8colors node instead, but I got the same result. I would like to be able to see more of the transparant cubes.

All suggestions are welcome.

Ivanp

Oooooooooooh! I thought you meant something else, sorry.

What you're looking for isn't a surface shader, but rather a volume shader. You can connect a "scalar_state" (optional) and a few color nodes to the volume port of the object's material to modulate the density of the volume. Basically, you modulate the intensity/transparency of the volume according to the raylength of the volume ray. If a volume is too thick and murky, then you adjust the color to be more transparent (eg: adjust alpha value of the color). Just make sure your surface shaders are set to a decent level of transparency or else you won't see the volume inside (volumes are only visibile where the surface is non-opaque).

the only other method which requires less technical work is compositing which you'll need to cut mattes if other elements reside in the scene. You'll probably need to render your overapping objects in a separate pass as well. In fact, perhaps even each cube in separate passes so you retain alpha control of each independently. Use the various image adjustment nodes in the XSI compositor (or other software) to modulate the effect. Once the colors have been added to your liking, then you paste the results atop the rest of your scene.

Matt


Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com

Brilliant, cheers Matt! It looks like the scalar_state into the volume port will do the job. But how will this work on textured grids with alpha mapping? Grids are only two dimensional, so how will the volume shader work on this?
What I want to create is a group of people which is going to be based on photos on textured grids with transparancy mapping. The additive transparacy is quite important in order to achieve the 'look' im after.

Just use really flat cubes instead of grids.

As for the scalar_state, let me just add you'd only need that node if you're doing falloff calculations to make the color fade in/out from the surface of your objects. If you just want a consistent color density across the volume, then just plug a colorshare node directly into the volume port of your object's base material.

TIP: If all the grids ....er...cubes are using the same settings, then put them into a group and apply the color share to the volume port of the group's material.

This should render fairly fast as it's not like a smoke shader that needs to do any special calculations - it's just a straight color remap.

Matt


Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com

hey Matt, would it be possible to have some parts of a material inherited from one group and the rest from another group?

Like in this case, you could have different materials on multiple objects, and then assign them to a group that overrides only the volume (or surface, or shadow) part of the material.

what was I thinking - you don't need to use volume shaders. The effect can easily be achieved using a "Constant" material shader plugged into the group's surface and shadow ports. The additive color can be created by setting transparency to 0.5 (give or take a bit), and activating "incandescense" by defining a color and boosting it's strength to 0.5 or so. Where the cubes overlap, the color will additively mixed just like in a compositor.

Also, make sure that the ray depth values for reflection, refraction, and sum are increased from their default values of 2, 2, and 4 respectively to something more useful like 10 or more. Otherwise when more than 2 cubes overlap, the transparency won't be accomodated for beyond the 2nd overlapping cube. If you are rendering only cubes, then there won't be any noticeable speed hit.

As for the 2nd question: Yes you can isolate materials from various sources, but you can only have one phenomena open in the rendertree at any given time. Basically, you put all the materials on the group at the same time then use color mixers to activate/deactivate the colors your interested in using.

It's a bit tricky, but you'll need something like the raytype node and a few mixers to pull this off. Essentially, you'll have to sample and query the type of ray hitting the surface of the object and be able to match the various raytypes to the materials. Once you get your answer, you can use the mixers to turn one material on and the others off for every sampled pixel in the image.

If a shader were available to query the object's tag labe, you would be able to use that to identify objects as well....or at least find out if the currently sampled triangle belongs to an object you're currently querying. Tags change from frame to frame even for the same object. So any comparisons would have to be relative and not absolute (eg: compare tags between sample and object, not sample and fixed tag id number).

Matt


Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com

well, at least it's possible, if not simple. Thanks for the info!


...and activating "incandescense" by defining a color and boosting it's strength to 0.5 or so. Where the cubes overlap, the color will additively mixed just like in a compositor


Why is it neccesary to define a color for the incandecence? - I mean, - the color that gets added should really only be the objects own color and not the color of the incandecence. But as far as i can tell it more or less does what I want. Thanks very much for the help.

Ivanp

It forces the colors of the cubes to be mixed additively instead of averaged. Incandescence is like a fake emission of light. Light mixes additively. Material colors are subtractive (they absorb color) and therefore mixing is averaged, not added.

Matt


Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com

Aaahhh.. I see - thanks. By the way - a color correction node into the incandecene color port makes some really nice colors when tweaking the contrast on the textured grids - seems like it works in the way I want it to now. Again cheers for the help&patience.

Ivanp.