Intro
Since I'll be working on a architectural visualization project, I will document the techniques I found interesting. The first notable one so far are the planks near a pool area.For the planks, I found an 1kx1k tileable image. With some scripting and hypershade trickery, it is more than enough, even at closeups.
Goal
1. add transform noise to the planks
2. offset UV of individual planks
3. add different values to the planks
Technique 1: Transform Noise
To add transform noise to the planks, I wrote a little script to jitter the planks around a bit.
Mel Script
for ($i = 94; $i < 146; $i++) { select -r ("pCube" + $i); xform -cp; float $mx = rand(0.5); float $my = rand(0.5); float $mz = rand(0.5); float $rx = rand(0.5); float $ry = rand(0.5); float $rz = rand(0.5); move -r $mx $my $mz; rotate -r -os $rx $ry $rz; };
Before |
After |
Technique 2: Per Plank UV Noise
There are several ways to do this, but this is more flexible and simpler. The other way involves using shading switches which I will use on the next technique, which could be applied here, but can get confusing very quickly with multiple values. I simply add a couple of lines that moves the UVs around between 0 and 1.
for ($i = 94; $i < 146; $i++) { select -r ("pCube" + $i); xform -cp; float $mx = rand(0.5); float $my = rand(0.5); float $mz = rand(0.5); float $rx = rand(0.5); float $ry = rand(0.5); float $rz = rand(0.5); float $mu = rand(1); float $mv = rand(1); move -r $mx $my $mz; rotate -r -os $rx $ry $rz; select -r ("pCube" + $i + ".map[0:17]"); polyEditUV -u $mu -v $mv ; };
Technique 3: Per Plank Value
Here I will map different values on to each of the planks. You could do it at any location, color gain, color offset on the texture, diffuse intensity, layered etc etc etc. I will use the color gain slot on the textures. So the basic idea is to use a shading switch to switch different values onto the color gain slot. I will use 4 different values, our original texture value will be the brightest, whilst the other 3 will be increments of 0.1 starting from 0.7.
Shader Tree
Before I start with technique 3, lets take a look at my simple plank shader tree.
Before |
After |
I duplicated the texture node as I don't want the values effecting my bump. I then create 4 ramps and a triple shading switch. The four ramps has my different values which I will randomly assign to the triple switch.
To use the switch first connect it into any slot on the shader, then press add surfaces inside triple shading switch. This will add all the surfaces that has the shader assigned to it. Next we will add the ramps to each of the switch inputs by using melscript.
Mel Script
for ($i = 0; $i < 52; $i++) { int $j = rand(4)+1; connectAttr -force ("ramp" + $j + ".outColor") ("tripleShadingSwitch1.input[" + $i + "].inTriple"); };
Here I randomly select a ramp from 1 to 4 to connect to each of the inputs. And here are the results.
Before values per plank |
After values per plank |
Conclusion
As shader/technical artists, we're a little more technically inclined, so instead of tiling one huge 4k textures in photoshop, we can use these little tricks to add noise into our scene.
0 comments:
Post a Comment