CVSandCGIProduction shaders
From Odwiki
Back to the CVS and CGI Production
Shader management with CVS
Managing shaders with CVS is easy, the source code is in ASCII format and most of the files associated with shader development are fairly small. Whether you are editing shaders by hand with a text editor, or they are auto-generated with a shader editor (SLIM, ShadeTree, GenShade) or within the application (Houdini's Material & RenderMan Shader Export, Maya's Hypershade Export), or as a "client" to the application (MTOR for Maya), they all produce text files which are interpreted and/or compiled for use by the renderer. Below are a few examples of using CVS with managing shaders.
Contents |
RenderMan shaders
SLIM, Houdini, Maya/MTOR, ShadeTree, Genshade
In general, RenderMan shaders are built from ASCII source files and "compiled" into run time shader files to be read by the renderer. Even though the compiled shaders aren't really binary files in the sense of an executable application, they can be checked into the repository as binary files (without keyword expansion and linefeed conversion) since any version control commands can executed on the source files themselves. On exception of note is BMRT's shader dso format, a true dynamic shared object, which does contain non-ASCII bytes and should always be handled as a binary file in the CVS repository (*.sgi_m3.slc -k 'b').
Pixar SLIM RenderMan Shader Editor CVS files types to maintain:
file extension cvswrappers description .splt not needed SLIM pallette file .slim not needed SLIM appearance file .sl not needed RenderMan Shading Language file .slo *.slc -k 'b' compiled RenderMan shaders .slc *.slc -k 'b' compiled BMRT shaders .sle *.sle -k 'b' compiled Exluna shaders
SLIM palettes and appearances (shaders), are stored as ASCII files and as such are easily managed with CVS. Using SLIM with Houdini, also entails using the rmands and/or bmands commands to build the dialog scripts for Houdini to include your shaders in it's dialog boxes (GUI).
The "compiled" shaders, are also ASCII files and can be stored in the repository as such. But since the edits actually happen in the source file(s), it makes more sense to handle the compiled shaders as binary files through cvswrappers (turn off keyword expansion and don't convert linefeeds).
Houdini RenderMan Shaders
(This does not yet cover SHOPs/VOPs/OTL's, etc.)
CVS files types to maintain:
file extension cvswrappers description .hip *.hip -k 'b' Houdini scene file .ds not needed Houdini dialog script file .sl not needed RenderMan Shading Language file .slo *.slc -k 'b' compiled RenderMan shaders .slc *.slc -k 'b' compiled BMRT shaders .sle *.sle -k 'b' compiled Exluna shaders
Houdini RenderMan shaders are generated internally, referanced through SHOPs and specified file locations ($HFS/houdini/ri_shaders), etc. Just like any RenderMan shader, the source file is in ASCII format and thus can be managed with CVS easily. Refer to the Houdini documentation for detailed information on RenderMan shaders, including where to locate your custom shaders, how to generate dialog scripts for Houdini to display dialog boxes to control parameters of your shaders andhow to set options in the RIB output (such as where the renderer can find your shaders). The "compiled" shaders, are also ASCII files and can be stored in the repository as such. But since the edits actually happen in the source file(s), it makes more sense to handle the compiled shaders as binary files through cvswrappers (turn off keyword expansion and don't convert linefeeds). Helpful utility: mshop/emshop (John Coldrick)
A|W Maya/Pixar MTOR SLIM
Palettes and Appearances CVS files types to maintain:
file extension cvswrappers description .splt not needed SLIM pallette file .slim not needed SLIM appearance file .sl not needed RenderMan Shading Language file .ma not needed Maya scene files (ASCII format) .mb *.mb -k 'b' Maya scene files (binary format) .slo *.slc -k 'b' compiled RenderMan shaders .slc *.slc -k 'b' compiled BMRT shaders .sle *.sle -k 'b' compiled Exluna shaders
Maya's MTOR creates references to SLIM palettes and appearances (shaders) as part of the Maya scene file .
The "compiled" shaders, are also ASCII files and can be stored in the repository as such. But since the edits actually happen in the source file(s), it makes more sense to handle the compiled shaders as binary files through cvswrappers (turn off keyword expansion and don't convert linefeeds).
Example:
Snippets from a typical Maya file (Mel script) which uses SLIM palettes and appearances:
The MTOR partition within the Maya scene file:
createNode partition -n "mtorPartition";
addAttr -ci true -sn "rmd" -ln "rmanData" -bt "UNKN" -dt "string";
addAttr -ci true -sn "sd" -ln "slimData" -bt "UNKN" -dt "string";
setAttr ".rmd" -type "string" (
" RManControls {\n"
+ "\tRIBFormat ascii\n"
+ "\tRIBGen immediate\n"
+ "\talfEnvKey {}\n"
...
setAttr ".sd" -type "string" (
"slim 1 TOR slim {\n"
+ "palettereference /media/people/mstory/shaders/blue_vortex.splt\n"
+ "}\n");
An object definition using a SLIM appearance and it's reference to the appearance in the SLIM palette file:
createNode nurbsSurface -n "revolvedSurfaceShape1" -p "revolvedSurface1"; addAttr -ci true -sn "sss" -ln "slimSurf" -bt "UNKN" -dt "stringArray"; setAttr -k off ".v"; setAttr ".fbd" no; ... setAttr ".sss" -type "stringArray" 1 "0ZQ0MmpFLGE00000" ;
Snippets from the referenced SLIM palette file:
slim 1 palette slim {
palette 0ZQ0MmpFLGD00000 {
guiinfo 600x400+584+385 1 {
graphArea {
graphState "work area 0" {
zoom 0
offset 0 0
}
...
label blue_vortex
function shadingmodel "Metal_1" "pixar,Metal#0" {
identity 0ZQ0MmpFLGE00000
description {The classic CG metal. Simulates the look of a rough metalic sur
face. Most believable when used with environment lights.}
master {$torShaders/$INSTANCENAME}
previewinfo {
shadingrate 5
objectsize 1
objectshape Sphere
frame 1
}
parameter color SurfaceColor {
...
ShadeTree projects
CVS files types to maintain:
file extension cvswrappers description .stree not needed ShadeTree file .sl not needed RenderMan Shading Language file .sli not needed shader interface file .rib not needed render interface file .slo *.slc -k 'b' compiled RenderMan shaders .slc *.slc -k 'b' compiled BMRT shaders .sle *.sle -k 'b' compiled Exluna shaders
ShadeTree project files are all ASCII files and can be managed easily with CVS.
The "compiled" shaders, are also ASCII files and can be stored in the repository as such. But since the edits actually happen in the source file(s), it makes more sense to handle the compiled shaders as binary files through cvswrappers (turn off keyword expansion and don't convert linefeeds).
Example:
Here's a snippet of an ShadeTree file, it's all ASCII:
# Stree file written at Sat Jul 11 18:33:47 1998
stree-version 1.0.32
toolbar
{
button 0=add
button 1=subtract
button 2=multiply
button 3=divide
button 4=negate
button 5=mixed
button 6=UserDefined
button 7=rgb2color
}
opdesk
{
# BOXES
# SurfaceOpacity_1
opbox
{
filename SurfaceOpacity
wid 1
xypos 903.000000 384.000000
opboxdefs
{
maxinstances 1
}
...
SESI Houdini Materials
(This does not yet cover SHOPs/VOPs/OTL's, etc.)
(TOPS, SHOPS, VEX)
CVS files types to maintain:
file extension cvswrappers description .hip *.hip -k 'b' Houdini scene file N/A ??? Houdini material palette ($HFS/houdini/mat/) .vfl not needed VEX shader source file .vex *.vex -k 'b' VEX shader compiled file
Houdini material palettes are CPIO ASCII archives just as are Houdini .hip files VEX shaders are ASCII compiled source files (.vfl) and For a discussion of how to handle the CVS directories within Houdini .hip files, which includes materials palette, click here.
An example of "expanding" the contents of a Houdini materials palette:
earth mstory-114% pwd
/media/people/mstory/houdini/mat
earth mstory-115% ll
total 640
drwxr-xr-x 2 mstory user 57 Dec 31 22:37 CVS
-rw-r--r-- 1 mstory user 182 Dec 31 22:16 KNAZ
-rw-r--r-- 1 mstory user 74246 Dec 31 22:16 NAU-ACAD
-rw------- 1 mstory user 27763 Jan 11 14:18 animated_shaders
-rw-r--r-- 1 mstory user 182 Dec 31 22:16 channel_2
-rw-r--r-- 1 mstory user 86527 Dec 31 22:16 misc
-rw-r--r-- 1 mstory user 119969 Dec 31 22:16 xion
earth mstory-134% file *
CVS: directory
KNAZ: ASCII cpio archive
NAU-ACAD: ASCII cpio archive
animated_shaders: ASCII cpio archive
channel_2: ASCII cpio archive
misc: ASCII cpio archive
xion: ASCII cpio archive
earth mstory-116% cpio_expand animated_shaders
55 blocks
table of contents for animated_shaders stored in cpio.animated_shaders.contents
55 blocks
animated_shaders expanded into the directory cpio.animated_shaders.dir
earth mstory-117% cat cpio.animated_shaders.contents
node_type
blue_texture.init
blue_texture.def
blue_texture.parm
blue_texture.picuu
blue_texture.shaderdata
blue_texture/ortho1.init
blue_texture/ortho1.def
blue_texture/ortho1.parm
blue_texture/texture1.init
blue_texture/texture1.def
blue_texture/texture1.parm
blue_texture/wrap1.init
blue_texture/wrap1.def
blue_texture/wrap1.parm
earth mstory-118% ls -al cpio.animated_shaders.dir/
total 112
drwxr-xr-x 3 mstory user 4096 Jan 11 14:19 .
drwxr-xr-x 4 mstory user 4096 Jan 11 14:19 ..
drwxr-xr-x 2 mstory user 4096 Jan 11 14:19 blue_texture
-rw-r--r-- 1 mstory user 248 Jan 11 14:19 blue_texture.def
-rw-r--r-- 1 mstory user 13 Jan 11 14:19 blue_texture.init
-rw-r--r-- 1 mstory user 309 Jan 11 14:19 blue_texture.parm
-rw-r--r-- 1 mstory user 24020 Jan 11 14:19 blue_texture.picuu
-rw-r--r-- 1 mstory user 10 Jan 11 14:19 blue_texture.shaderdata
-rw-r--r-- 1 mstory user 9 Jan 11 14:19 node_type
earth mstory-121% cd cpio.animated_shaders.dir/
earth mstory-123% file *
blue_texture: directory
blue_texture.def: English text
blue_texture.init: ascii text
blue_texture.parm: ascii text
blue_texture.picuu: uuencoded file
blue_texture.shaderdata: ascii text
node_type: ascii text
earth mstory-124% cat blue_texture.parm
{
version 0.8
stdswitcher ( 3 3 3 3 3 3 3 )
diff ( 0.28101 0.422008 0.986 )
amb ( 0 0 0 )
spec ( 0.351928 0.359 0.146831 )
reflect ( 0.295554 0.397081 0.434 )
trans ( 0 0 0 )
emit ( 0 0 0 )
refract ( 1 )
apara ( 1 )
aperp ( 1 )
aroll ( 1 )
fog ( "on" )
rough ( 0.024 )
shadow ( 1 )
bias ( 0.05 )
blur ( 0 )
}
NOTE: Default Houdini materials and their file types (ASCII cpio archive)
earth mstory-137% ll $HFS/houdini/mat/ total 7184 -r--r--r-- 1 20 21 345587 Oct 5 22:09 bump -r--r--r-- 1 20 21 220521 Oct 5 22:09 checker ... -r--r--r-- 1 20 21 199416 Oct 5 22:09 wrapture earth mstory-138% file $HFS/houdini/mat/* /usr/hfs//houdini/mat/bump: ASCII cpio archive /usr/hfs//houdini/mat/checker: ASCII cpio archive ... /usr/hfs//houdini/mat/wrapture: ASCII cpio archive
Maya Shading Groups and Networks
CVS files types to maintain:
file extension cvswrappers description .ma not needed Maya ASCII file .mb *.mb -k 'b' Maya binary file
Maya shading networks are stored in the Maya scene file or can be exported from the Hypershade or Multi-Lister window (exported files are mel scripts and should be saved in MayaASCII format). So if saved as ASCII files, they can be handled by CVS correctly, allowing diff, update and merge operations to work properly.
TODO: Examples



