Monday, August 30, 2010

RENDERMAN SHADERS, SLIM TEMPLATEs


# File: v3d_cGatherMegaAovDynamo.slim
#
# Description: Render separate surface attibute (aov, shading component) each in separate relative AOV.
# All perform in 1 (ONE) shader tracing call, get banch of it FAST.
# Access to full render pass control in post! Automaticly create new AOV, like if we need "DiffuseDirect", we get "_reflect_DirectDiffuse" pass.
# What if we have incandescence in primary pass AND reflection - on post we turn off incandescence, but it stay in reflection.... with this template you get full control.
# All pass in list generated, first use as output of template (first visualized).
# Can be used with reflection and refraction! (even get multiple ray depth, self reflect/refract)
# Very powerful feature.
#
# Usage example:
# (dont forget raytraycing on)
# Create delux shader. Add Rim and Incandescence (and connect texture to color value). Attach it to sphere.
# Create constant shader, connect this template to color and attach to ground plane below sphere.
# In "What to do" field add 'Rim' first.
# Now by default we trace 3 variables - Rim Incandescence DiffuseDirect. For each of this automaticly created new AOV's.
# By "aovPrefix" field on output can be catched new AOV: _reflect_Rim, _reflect_Incandescence, _reflect_DiffuseDirect.
# (if use refraction vector, "aovPrefix" can change to _refract_ or anything what you want)
# Add this names (color _reflect_Rim) to "channel" and "secondary display" in Renderman Globals.... All done. 

# File: v3d_cCatchLightOutput.slim
#
# Description: Catch AOV variable casting by light. Like render diffuse and get shadow pass, L direction pass,
# or any you like to send (it even can be pattern or texture map)
#
# Usage: Attach AOV to light (in my shader in separete slot), or colorAOV and light send it.
# Or produced output in standart lights shader is:
# color: _shadow, _cl_noshadow
# floats: __nondiffuse, __nonspecular,
# _contribRim, _contribThinTranslucence,
# _contribBackScattering, _contribSubsurfaceScattering

# File: v3d_cCatchLightOutputAOV.slim
#
# Description: Same as v3d_catchLightOutput.slim, but in DynamicFunction can resend AOV without extra nodes.
# Catch AOV variable casting by light. Like render diffuse and get shadow pass, L direction pass,
# or any you like to send (it even can be pattern or texture map)
#
# Usage: Attach AOV to light (in my shader in separete slot), or colorAOV and light send it.
# Or produced output in standart lights shader is:
# color: _shadow, _cl_noshadow
# floats: __nondiffuse, __nonspecular,
# _contribRim, _contribThinTranslucence,
# _contribBackScattering, _contribSubsurfaceScattering

# File: v3d_envLatlLens.slim
#
# Description: Render environment latitude/longitude map from camera. Render in float and get HDRI environment texture.
#
# Usage: Create plane geometry in front of camera, attach constant shader to plane (you can parent plane to camera and off visible in reflection etc. parametr on shape)


# File: v3d_cNormalTangent.slim
#
# Description: Convert tangent space normal map to camera space normal.
#
# Usage: (convert to normal) and attach to custom slot in displacement, or input normal in diffuse function etc.

# File: v3d_cShadowSoftOcclusion.slim
#
# Description: Ultra-fast soft shadow rendering (with highest quality!) by using occlusion. Original idea from Dmitry Novikov.
#
# Usage: Connect to light shader "shadow" slot (or custom output slot from my shader and catch from surface).
# File: v3d_cPostEnv.slim
#
# Description: Generate coordinates to use in IBL or add reflection in 2D.
# Mode = 0 - for reflection
# Mode = 1 - for image base lighting
#
# Note: Image base lighting in this case may not very accurate,
# because in 2d looking 1 sample from coordinate image.
# For example, coord. can render in double resolution with low sample, and resize it down after add reflection ("antialiasing" in post, course image file size much bigger).
#
# Usage: attach to AOV and render it, combine in 2D package with appropriate script/macros.


# File: v3d_fMultiMapZbrushManual.slim 
#
# Description: For ultra high detail displacement map, like 10 maps in 4096*4096 pixel resolution (total 40960*40960, without one huge image),
# when using Zbrush and MultiDisplacement (model separated to groups with > 0-1 UV space)
# UV groups must be in U direction (for simple managing). If you need more 10 set, create second copy and set offsetU value to start position.
#
# Usage: Map 1 = UV 0-1 (U), Map 2 = UV 1-2 (U), etc.

# File: v3d_fMultiMapZbrushAuto.slim 
#
# Description: For ultra high detail texture map, like 10 maps 4096*4096 pixel resolution, in total 40960*40960, without one huge image,
# when using Zbrush and MultiDisplacement plugin to export texture (model separated to groups with > 0-1 UV space)
# UV groups must be in U direction (for simple managing). Can set offsetU value to start U position if uv starts not from 0-1.
# Updated dynamic version - select one map and other regions maps be connected automaticly. No tedious selection of 101 texture map by hand.
#
# Note: if you using Zbrush (current MultiDisplacement3 export plugin), you can view very small seam between region changes.
# To remove it a little bit scale down uv shell border in Maya. File number index must start from not zero (not name.0000.tif)
# In Zbrush set '.' after texture name (name. ) and all other naming convention must right.
#
# *.bat file example to batch convert files to tex
# for %%t in (*.tif) do "%rmantree%/bin/txmake" -float "%%t" "%%t.tex"
#
# Usage: select 1 texture map and all other be automaticly connected. (used mask - fileName.#.extension)
# File: v3d_nBumpedNormal.slim
#
# Description: bump normal, can create cool effect like underlaying layer lacquer surface (polished wood etc.)
#
# Usage: Primary use with delux component to achive one bump map on diffuse and different bump map on specular etc.
# File: v3d_lCategoryLights.slim
#
# Description: Set of standart lights improved with category and custom output variable (can attach AOV)
# File: v3d_scNull.slim
#
# Description: null shading component, to easy attach custom AOVs to delux shader.
#
# Usage: attach to delux, and attach AOVs to inputs
#
# File: v3d_xRibBox.slim
#
# Description: Set of RibBox notes, to fast create some usefull tricks.
#
# Usage: Create and see descriptions.
# File: v3d_xMegaAOV.slim
#
# Description: Connect multiple AOV to surface in one time. Can view separate AOV.
#
# Usage: Connect and give name to AOV channel. This map not need used in primary shading, is need only be attached to surface and calculate in "backgroung".
# For example attach to AddFx surface.

# File: v3d_fMultiBlendShape.slim
#
# Description: Add different Dispacement map value depend on blend shapes, like wrinkle on face when smile, different map when angry etc...
#
# Usage: use mel script - v3d_multiBlendShapePrimvar.mel, on proc call change name of blendshape node and target surface name
# (multiBlendShapePrimvar pCubeShape1 blendShape1;) This create primvar on shape node (also print names in output)
# copy this names line by line to "Attribute name" field and connect associated texture.
#
# To do: may create full automatic, get file names - file.'blendshapename *'.tex - and auto generate all texture() call * read primvar
# but it cause not able select custom multiregion texture etc. depend on production think about name convention.
OTHER templates
# File: v3d_accumColor.slim
#
# Description: simple accumulation effect, like "Color Accum" on particle shape effect.
#
# Usage: Attach to particles (or surface)







# File: v3d_cBrushed.slim
#
# Description: modifyed ward anisotropic specular template
#
# Usage: connect vector to input




# File: v3d_cEnvironmentMap.slim
#
# Description: Reflection map with blur, gamma, HVS tweaks.

# File: v3d_cFloatRGB.slim
#
# Description: Simple surface shader to combine 3 float to color,
# use for collect and view individual float channel to AOV output


# File: v3d_cSmoothstep.slim
#
# Description: Smoothstep to color, create smooth step float function to color
#
# Usage: input image or pattern and set minimum and maximum value.
#
# Example: input = color noise (frequency = 20); mini = 0.6; maxi =.7;

# File: v3d_cUVregionView.slim
#
# Description: For zbrush multitexture show uv regions more than 1 (0--1, 1--2,n -- n+1) in different color.

# File: v3d_cWireFrameSubd.slim
#
# Description: Render wireframe on polygon subdiv surface. Better on quad.
# Actually show topology after smoothing. Same result as polygon>smooth (view at triangles)

# File: v3d_dDisplaceAndBump.slim
#
# Description: example using displacement and bump together

# File: v3d_fCircle2D.slim

# Description: circle in ST space

# File: v3d_fCircle3D.slim
#
# Description: circle in 3d space

# File: v3d_fPower.slim
#
# Description: pow() float function
# File: v3d_fStairs.slim
# Description: Create steps effect on float pattern or image
#
# Usage: input float pattern and get result. Interesting effects if using in in displacement.

# File: v3d_fWave.slim
#
# Description: simple example animated sin() wave shader with internal parametr time
# File: v3d_lEnvironmentMix.slim
#
# Description: Simply mix 2 environment light.
# Interesting looking effect with 1st map is strong blured, 2nd crisp, and use sharp mix mask.
# File: v3d_sAddFxPlus.slim
#
# Description: AddFx shader + additional slots to connect AOV channels
#
# Usage: attach color ao float AOV to empty slots.
# File: v3d_sAovExample.slim
#
# Description: example AOV dyamic shader
# File: v3d_uvTrunc.slim
#
# Description: Truncate ST coordinates.
# Create pixel blocky effect (like big screen created from small lamps etc.)
#
# Usage: attach to any pattern or texture in coordianate slot
# File: v3d_uvTruncWorld.slim
#
# Description: Truncate ST coordinates in world space or another connected coord system.
#
# Usage: attach to any pattern or texture in coordianate slot
# File: v3d_volSimpleFog.slim
#
# Description: Simplest volume shader
# File: v3d_xConversion.slim
#
# Description: Some convertion function to can connect different date type in slim
#
# Usage: Simply connect input.



v3d_chroma.sl (WIP) (source not available)
Chromatic aberration refraction shader. (fast)
As camera lens:
Lustre:



RENDERMAN TECHNIQUES
v3d_particle_userPP
User per particle atributes, transfer values to prman shader (in Slim).
Randomize color instance or change animation offset in crowd.
v3d_ribCropper (WIP)
When render very complex, with a lot of memory consumption, may cause memory not proper realised and grow to crash. Especially with huge image resolution.

This TCL script divide image to crop region in rib, send to alfred and generate nuke or shake script, what automaticly compile parts to one final image

Work in network rendering