# Procedural Material Development
Notes following this video: https://www.youtube.com/watch?v=0ZxWeMjxQug&t=69s
Material Dev to be done on shoe but can be used on anything
### BSDF Review
- roughness ... low is shiny, high is not
- specular -- don't mess with too much in proc mat dev. amount of light reflection an object can accept. 0 = won't be very reflective, 1 = will be reflective.
- metallic -- usually want to be 1 for on, 0 for off. not much of an in between state unless going for really certain look in proc mat dev
- arisotropic + arisotropic rotation -- another thing not really touched.
- sheen -- lets light wrap around object a bit more. good for things like fabric
- clearcoat -- kind of gives a second layer of roughness.
- transmission -- good for things that require transparency
### Object Setup + Lighting
Start by selecting everything then use "ctrl + a" to apply visual geometry to mesh
- notice after this that all modifiers have been applied

Once that is done, select everything and "ctrl + J" to join everything together into one mesh

***At the beginning of video instructor had us apply visual geometry to mesh, then joined everything together -- then seems to start over without doing those things. So we are starting over without doing those things***
Add a plane mesh as a "ground" then give it a bevel mod to create a curved background. Go into Cycles. Then set world strength to 0 because we are going to add lighting and we want to use that to see what's up

Add area light above the shoe

Add camera, SHIFT + ~ can be used to active fly mode while in camera view to reposition exactly as desired. best to square up view
- SHIFT + ~ activates 'FLY MODE' even without camera view active and seems to be very helpful
- ALT + G moves something to center (random)

Add Empty Cube then parent the backdrop, the camera, and the light to the Empty Cube. Be sure to make sure Empty Cube is last in parent chain


Doing this parenting will enable you to go into camera view and do a variety of rotation fuckery WHILE selecting the Empty Cube to keep light camera and backdrop steady while you go about said rotation fuckery

Add in a point light and another area light to create a 3 point lighting system -- parent extra lights to the Empty Cube as well (CTRL + P)

Setup workstation to be optimized and take less computer resources
- left side working view
- bottom right rendered view
- top right shader editor

Now we can do rotation fuckery in the left side and see the shoe automatically spinning in a smaller (less intensive) screen on the bottom right, yay

Take a min to organize
- LCAR = Lights Cameras (Action) References
- Shoe = parts of the shoe

## Mat Dev
### Bump Maps
Now we are going to start with some BUMPS
- Voronoi for foam type of mat, magic for fabric type of mat, noise for rubber type of mat
- Link all materials together (keeping in mind the same thing as with parenting, the last in the chain is the top of the tree)
- Add BSDF, change color of top of tree, see how all objects change with that edit

#### Voronoi
Start with Node Wrangling in an Image Texture. Change Image to Voronoi. Add Bump. Voronoi output into Height input of Bump. Bump output into Normal input of BSDF
- (post screenshot) change input of Texture Coordinate node to Object instead of UV

Play around with value's and stuff till you get something you like

#### Magic
To go for a more fabric type of texture, change Voronoi node to Magic node and play with values until you are happy with look

#### Noise
To go for a more rubber type of texture, change Magic node to Noise node, turn Sheen down on BSDF, play with values
- with no detail on the Noise node, roughness will not do anything

These are the three basic types of BUMP mapping to do for procedurally generating textures -- now it will get a bit more advanced as we move into Transmission and Subsurface Scattering
Before moving on, delete Bump Mat off of shoe, but first click shield button to create a fake user for it to preserve it

### Transmission
Select everything on shoe in your viewport, link materials with CTRL + L give new Gummy Mat to everything

First thing to do is to turn the transmission up

To make Transmissive colors really pop, you want this value on the color wheel to be turned all the way up to 1

Roughness is important to have for Transmission as high Roughness will not let light through to affect the Transmission. Must have Roughness down

Some other good values to use here are Clearcoat, Clearcoat Roughness, Transmission Roughness. Play around with values

Using Alpha vaue is kind of like turning down opacity but not exactly

#### Tangent on Transparency and Light Paths
With transparent items, blender's light path settings come into play. Blender sets default light path on how much light may bounce around because if it was infinite then computations would take forever. So to play with this we will turn Alpha down to 0 and then adjust light path settings

Can also use preset Light Path settings Blender has through this menu

Note to self: the purple was showing up in the above screenshots because I did not have all Mats selected and working with new Gummy Material being created. Fixed it:

IOR will do stuff to how light bounces around (not exactly sure). But most normal items will have a value between 1.3 and 1.6 (added sphere to see its effects better)
- usually best to leave it as default but can be helpful depending on the scenario

Turning IOR value to 1 will make it behave like a transparent material, but too much

Now we will move on to Subsurface Scattering. Hit the shield icon to make the Gummy Mat a fake user and protect it from being deleted, then remove the Gummy Mat from all

### Subsurface Scattering
Make a new material and link all objects to same Mat. Now play with Subsurface on BSDF and see how it changes
- Allows light to penetrate a bit rather than bounce off of object

Duplicate the new material and put it on to only a few of the objects

To really make the color pop more, add Hue Saturation node

Do the same thing for the Mat that was duplicated

#### Cycles vs. Eevee Considerations
Cycles:

Eevee:

On new mat turn off subsurface, cut tie to hue saturation node, turn tranmission all the way up, then change blend mode to Alpha Blend

Can also play with Alpha value here for transparent stuff in Eevee

In general, Eevee is okay, Cycles is better.
### Procedural Gradient
Now the instructor had us get rid of everything we made and start over applying a plain grey material to everything on the shoe

For now we will keep it on Eevee for faster rendering. Make new "Pattern" Mat, link it to just a few objects, node wrangler into BSDF, change Image to Gradient, use Generated output on Texture Coordinate node.
- Notice gradient will flow left to right on the two objects we selected for the mat

Rotation on the Z axis will make gradient flow front to back instead of left to right

Without any nodes selected, Shift + Ctrl + left click on gradient node to add viewer thingy which will make it even more noticeable in rendered view

Going back into cycles. Adding ColorRamp

Can change colors on ColorRamp to make it gud

Can add more colors to ColorRamp and play with Transmission + Roughness for various looks

Can add in Hue Saturation and increase value on the node to make the colors really pop

Adjusting Hue rather than changing colors on ColorRamp

Now we are going to delete all of that stuff to make the gradient texture and start over for a new thing
### Procedural Speckle
Node Wrangler into BSDF, change Image to Noise, Shift + CTRL + left click on Noise to adjust view output
- use Object input instead of UV input on Texture Coordinate (not in picture)

Get rid of viewer. Add in a ColorRamp, move sliders very close, and play with values of Noise to create a cool look

Now we can add a Mix node and plug the ColorRamp color output into the Fac input of it, then Color1 and Color2 correspond to White/Black on the ColorRamp. Then add Hue Saturation to make the color pop

Can plug ColorRamp color output into height input of added Bump node, which goes into Normal input of BSDF. Can also plug ColorRamp back directly into BSDF and ignore Mix/Hue nodes if you want to easily go back to Black and White, or keep Mix/Hue to stay with colors.


Can turn off the Transmission effects for a different look

### Procedural Camo
Get ride of Bump, Mix, and Hue nodes. We will use Noise to generate camo patterns.
- Notice changes to Noise scale, and ColorRamp slider positions

Change ColorRamp to Constant, turn down scale on Noise to form base Camo-like pattern
- Move the ColorRamp sliders to be about even (not in picture)

Add in MixRGB node, plug ColorRamp output into Fac input, added a third slider on the color ramp, adjusted scale on Noise Texture.

To add another layer of color with a different offset, add inanother MixRGB node. Duplciate Noise Texture and ColorRamp nodes. Vector output of mapping into duplicated Noise Texture Vector input. Plug duplicated Texture and Colors into new Mix Node, choose color.
Drop in a Hue Saturation node between final Mix and BSDF to easily change up color schemes

Now can change up and combine various forms of Texture nodes, for example changing this to from Noise to Magic
- go HAM mixing and matching various node combination

### Image Unwrapping
Node Wrangler in a new Image Texture on the base with everything else reset
- open an image on the Image node (not pictured)

Drag out a UV editor. Set it to display the same image that you have loaded into the Image Texture node

Select the entire basemesh in your non rendered display port (top left). See how the selection corresponds to the UV in the UV Editor

With base mesh selected, press U, then Smart UV Project
- Cube Projection can also work well here, try different options

Play with the positioning of the UV's until happy with result / look

Add in a Gamme Node, put up the value a bit, turn down Specular on BSDF

Now turn this into a fabric using techniques from earlier. Plug Magic Texture node into Normal of BSDF. Add Bump node between Magic and BSDF. Magic Texture color output into height input of Bump. Object output of Texture Coordinate node into Vector input of Magic node.
- Can increase Sheen on BSDF for some extra pop

Play with values of stuff until oke

Now we are gonna slap a dope logo onto the strap
- Node wrangler in new Image chain into BSDF of new texture for Strap. Change UV Editor away from the image used in the prevoius stage

Load in logo, play with values and position UV to get it situated to satisfaction

Add in ColorRamp, Invert, MapRanger nodes, plug in as shown, play with values until you get something that is oke


Now we are going to get rid of the Image Texture on the base and Strap Texture with logo and move into something more advanced for procedural textures
### Intermediate / Advanced Proc Mat Dev
Node Wrangler into BSDF, change to Wave Texture

Select the bottom ring of the shoe base, mark seam

Do the same for the back side of the shoe

Now select everything and do a regular unwrap, result will follow seams and should appear like below

Now rotate the unwrap and play with Wave Texture values to get the waves to go along the length instead of the width

Adjust values on Wave Texture until you think is oke

Move wave texture chain down into normal, slap a Bump node in. Add Noise texture, plug Object output of Texture Coordinate into Magic Vector input

Add in a ColorRamp, adjust values till oke

Add in a MixRGB node, plug in as shown

Add another ColorRamp, do more stuff with various values, create ridge-like type of texture

Change colors till oke

***END OF PART 1***
## Dope Patterns
This section is me documenting dope patterns I came up with after learning the above.

~~


~~

~~

~~

~~
(Inner Blade pattern)

(Outer Blade pattern)
