Friday, July 9, 2010

Invader Fractal in Mel version 1 Still some squares being left out, but all in all looking good. version 2 Complete, but need to add more size variations version 4 variation 1 Rewrote most of the space filling portion, and added frames etc. variation 2variation 3Based on Jared Tarbells Invader Fractal. except done in maya melscript.Below is the space filling portion of the script, using a main grid of 100x50 squares, we go through each one($j), if $j is white, j++, if not, search a random sized area for white squares, if a white square exists, we search random sized area - 1 for white squares and so on until random size = 1 and it must be black due to the first condition. If the random sized area have no white squares, we call the invader_plane()(not shown), which makes the invader plane at that area, and color that particular area white on the main_grid and continue(j++). There are two for loops within the main loop, L loop for going horizontal, which are increments of 50, and the K loop going vertical, which are increments of 1.
------------------------------------------------------------------------------------------------

Tuesday, June 1, 2010

For example, the water line, where the side of a cliff/moutain/hill is washed off and exposes the mud/stone underneath. Or how snow appears at a certain altitude, or timber lines. You can use a measure distance tool to find the min max, and you can choose the coordinate system to find p. Usually world, or object.

Monday, May 10, 2010

Water droplets on leafs.Its a specular component with displaced shading normal. Some techniques demonstrated here are,1. adding/modifying displaced shading normal2. using the shape, and tile node to create the droplets and patterns 3. using shading normal to specify the angle where the droplets would fall away due to gravity.--------------------------------------------------------------------------------------------------------------------

The tree branch of the specular component of the water droplet, remember, its just a component of the leaf surface.It consists of the spec(cook torrance), reflection, and refraction. None of it ray traced, but requires an hdri environment map, for this example, find a map thats green on the bottom, with cool fill light, and warm key.
--------------------------------------------------------------------------------------------------------------------

First let us define the shape and pattern of the droplet. We'll use a circle shape node, with a fuzz of 4. Connect to a float spline to define the profile of the droplet, as demonstrated on the left. Use a tile manifold node, where we can adjust the frequency and jitter, and under the manifold of tile, lets warp the ST a little to give it a more irregular look.
--------------------------------------------------------------------------------------------------------------------

I also multiply the above with this function, which is that every point thats flat or less than x angle is white, while everything thats steep and greater than x angle is black. Using the dot product between the vector that points in the world y direction and the normal, we get the cosine of the angle.
--------------------------------------------------------------------------------------------------------------------

The key to the droplet is here, we displace the point on surface for this specular component by adding the above to p.--------------------------------------------------------------------------------------------------------------------The rest is pretty straightforward, be sure to mask out the droplet on both the refraction and
spec. I also connected "diffuse>colortogray" to the refraction intensity to control the shadow side of the leaf droplet. Otherwise it'll be too bright, on further thought, I probably should do the same to the spec component as a precautionary measure.
--------------------------------------------------------------------------------------------------------------------
Note 1: One problem I have encountered is when the leafs are animated, the angle cut off is too sharp, one possible solution is simply to bake in the position of the droplets into a texture. Anything more complex, for example, droplet falling off the leaf would be better dealt with in FX.

Friday, April 16, 2010

laying out a typical shader. In this example is a character with clothes and some accessories. The blue nodes are AOV nodes(as in bluescreen mattes, get it?), the green nodes are control mattes. The red nodes are global control nodes, occ. Yellow are ensembles, and purple are unused. If there's a way to define our own custom colors, please share.

with some errors in the above code, we can use this in a vector slbox to slightly alter the shading normal which we can then plug into a shading component(specular and reflection). say we want to break up the specular reflection of specular to make it look like water droplets on skin. we use the above code, use a fractal for "a", create our own point p and normal n, and normalize the final n. It'll look like this,

The addition of point "shader" (0,0,0) in the second line accounts for the fact that N is really a vector (or normal), and thus should not transform in the same way as a point.
This is the old way of transforming vectors and normals. These days, we encourage you to use the following equivalent (but less confusing and cheaper!) construct:
normal Nsh; Nsh = ntransform ("shader", N); For vectors (as opposed to normals), one should use the vtransform function.

Thursday, March 25, 2010

When working in slim and using an auto maya shading group > slim script, slim will generate a graph layout for every node. For me, I like to work with a single graph layout, like in Shake. You could delete the layouts one by one, or you can read on, it'll be slightly different what with all the different pipelines.
Here's my workflow,
1. reference the rigging file
2. save as rig.ma
3. export the maya shaders into slim, it'll generate all the necessary connections, textures > diffuse > delux > ensemble, and a billion layouts.
4. in slim, select all your nodes, thus grouping all the nodes into one graph, and rename the graph to "all"
5. export your slim palette, our company has an auto export script which will export the palette, the attach mel, the meta file, and the aov all at once. If not, you'll have to manually do this part.
6. find your palette, open with text editor, search for layouts, it look something like this,
graphlayouts {
layout Diffuse_layout {
arrangemethod auto
roots 1400_DXwEjq30000
traversemethod upstream
scroll {{} {}}
transforms {1 {0 0}}
}
7. delete all the layouts between graphlayout {} except the one you made, "all".
8. save. open rig.ma, attach the palette.

Saturday, February 6, 2010

sometimes you don't want the specular or reflection component to be affected by bump/displacement, create a vector slbox and plug into the normal of the component
normal nn;
displacement("__Norig",nn);
result = normalize(nn);

Thursday, January 28, 2010

ingredients,
1. sampler info
2. set range
3. blender
1. connect point camera Z of sampler info to value x of set range.
2. set min/max to 0 and 1, and set old min to distance between camera and furthest point in scene. for example -1000.
3. connect out value x to blender.blender
output the color.

Monday, January 18, 2010

Faking parallax is one trick i've learned in videogame texturing, its applicable in non-videogame surfacing as long as it is used in the mid to far background.
The bulb inside this headlight is created using the above technique, as we turn and look from the side, the bulb will become occluded, achieving a small sense of depth.
The basic concept is to take the camera normal and use it to offset the UV
normal Ns = normalize(transform("camera", N));
float x = xcomp(Ns);
float y = ycomp(Ns);
float z = zcomp(Ns);
result = x;
the above code is like facing direction, but only in the x direction, make another one for y. Invert y, set a new min/max with remap. The input min/max should be -1 to 1 and the new min/max should be something less than +/-0.25, depends on your texture and how much shift you want. Connect to a manifold slbox with the following snippet,
float ss = s+v3;
float tt = t+v4;
result_Q = point(ss,tt,0);
result_dQu = (0,0,0);
result_dQv = (0,0,0);
where v3 and v4 are the x and y from above.
and then connect to your textures/shapes ST.
You can do this in maya as well, just connect the camera normal from sampler info to uv offset of a place2d node. With a setrange in between, something like that, out of the top of my head.

Monday, January 4, 2010

This create a small package that splits colors to RGB or just three outputs with some simple contrast controls.
1. Import a gammaimage
2. create 3 color slbox and add a color v1 to each of them and add the following code
color red = comp(v1,0);
result = red;
duplicate the code to green and blue substituting 0 with 1 and 2 respectively.
3. create a float spline, and rename the first knot to low, and last knot to high.
4. duplicate the spline and rename the spline to each color. ie red_spline
5. shift select the SLBOX nodes in order of R then G then B. and select the splines in order as well.
6. Right click and click on package.
7. open the package, select red_spline, publish basis, low, p0, high, p1. Do the same for GB.
8. close the package.
This package takes three inputs and has simple contrast controls, it would be great if someone can add the float spline GUI inside the package.