Hi all,
I write a surface shader which uses 3delight(10.0.4)'s maya_phong() function. Then I compile the shader and render my rib file with prman13.5. But the output image seems wrong. I'm not sure where is the problem, may be the incorrect use of maya_phong().
Here is my shader and rib file.
My surface shader phong1.sl:
vector specularColor = vector (0,0,0);
float reflectivity = float 6e-005;
vector reflectedColor = vector (0.16528,0.16528,0.16528);
uniform float refractions = float 0;
float refractiveIndex = float 1;
uniform float refractionLimit = float 6;
float lightAbsorbance = float 0;
float shadowAttenuation = float 0.5;
uniform float reflectionLimit = float 1;
float translucence = float 0;
float translucenceDepth = float 0;
float translucenceFocus = float 8e-005;
vector transparency = vector (0.42148,0.42148,0.42148);
uniform float i_reflectionMaxDistance =4;
uniform float i_reflectionSamples =4;
uniform float i_reflectionBlur =4;
uniform float i_reflectionNoiseAmplitude=4;
uniform float i_reflectionNoiseFrequency=4;
vector outColor = vector (0,0,0);
vector outTransparency = vector (0.42148,0.42148,0.42148);
{
color _outColor;
color _outTransparency;
maya_phong(color ambientColor,
color i_color,
cosinePower,
diffuse,
color incandescence,
matteOpacity,
matteOpacityMode,
normal normalCamera,
color specularColor,
reflectivity,
color reflectedColor,
refractions,
refractiveIndex,
refractionLimit,
lightAbsorbance,
shadowAttenuation,
reflectionLimit,
translucence,
translucenceDepth,
translucenceFocus,
color transparency,
i_reflectionMaxDistance,
i_reflectionSamples,
i_reflectionBlur,
i_reflectionNoiseAmplitude,
i_reflectionNoiseFrequency,
_outColor,
_outTransparency
);
Ci = _outColor;
Oi = _outTransparency;
outColor = vector Ci;
outTransparency = vector Oi;
}
}
// call the shaders ------------------
phong1();
}
compile the shader with prman shader.exe
\>shader.exe -o "E:/MyDocuments/maya/projects/default/generatedShader/phong1.slo" -I"%LIQUID_ROOT%/dependence/_3delight" "E:/MyDocuments/maya/projects/default/generatedShader/phong1.sl"
My rib file er_rm_shader_graph_phong3_perspShape.0001-3delight.rib:
(Note that I also use 3delight maya_pointlight shader for the point light.)
##RenderMan RIB-Structure 1.0
version 3.03
# Generated by Liquid v2.3.5 (buildtime=11:33:32.87)
# Scene : E:/MyDocuments/maya/projects/default/er_rm_shader_graph_phong3
# User : yaoyansi
# Time : Sun Apr 29 18:53:48 2012
Option "limits" "bucketsize" [ 256 256 ]
Option "limits" "gridsize" [ 256 ]
Option "limits" "texturememory" [ 65536 ]
Option "limits" "eyesplits" [ 10 ]
Option "limits" "othreshold" [ 0.996000 0.996000 0.996000 ]
Option "limits" "zthreshold" [ 0.996000 0.996000 0.996000 ]
Option "searchpath" "shader" [ "&:@:.:~:rmanshader://E/dev/autodesk/maya/myplugin/project/liquid_/2.3.3/lib/shaders:E:/MyDocuments/maya/projects/default/" ]
Option "searchpath" "texture" [ "&:@:.:~://E/dev/autodesk/maya/myplugin/project/liquid_/2.3.3/lib/textures:E:/MyDocuments/maya/projects/default/://E/mydocuments/maya/projects/default/rmantex/" ]
Option "searchpath" "archive" [ "&:@:.:~://E/dev/autodesk/maya/myplugin/project/liquid_/2.3.3/lib/rib:E:/MyDocuments/maya/projects/default/://E/mydocuments/maya/projects/default/rib/" ]
Option "searchpath" "procedural" [ "&:@:.:~://E/dev/autodesk/maya/myplugin/project/liquid_/2.3.3/lib/plugins:E:/MyDocuments/maya/projects/default/" ]
Option "searchpath" "display" [".:@:D:\Program Files\Pixar\RenderManProServer-13.5.2/etc:E:/dev/autodesk/maya/myplugin/project/liquid_/2.3.3/displayDrivers/PRMan/"]
Hider "hidden" "int jitter" [0]
PixelSamples 4.000000 4.000000
ShadingRate 1.000000
PixelFilter "box" 2.000000 2.000000
Option "user" "string pass" [ "beauty" ]
#Ray Tracing : OFF
Option "trace" "int maxdepth" [ 0 ]
FrameBegin 1
ShadingInterpolation "smooth"
Quantize "rgba" 0 0 0 0.000000
#Display Drivers:
#Render To Maya renderView :
Display "E:/MyDocuments/maya/projects/default/rmanpix/er_rm_shader_graph_phong3_perspShape_1_renderman.bmp" "it" "rgba" "int merge" [0] "int mayaDisplayPort" [6667] "string host" ["localhost"]
Format 768 576 1.000000
Projection "perspective" "fov" [ 42.184677 ]
ScreenWindow -1.333333 1.333333 -1.000000 1.000000
Clipping 0.100000 1000.000000
Shutter 1.000000 1.000000
Transform [ 0.998240 -0.055041 -0.022084 0.000000 0.000000 0.372367 -0.928086 0.000000 -0.059306 -0.926452 -0.371711 0.000000 -5.636015 11.409916 98.953972 1.000000 ]
WorldBegin
TransformBegin
CoordinateSystem "worldspace"
TransformEnd
TransformBegin
Rotate -90.000000 1.000000 0.000000 0.000000
CoordinateSystem "_environment"
TransformEnd
ReverseOrientation
AttributeBegin
Attribute "identifier" "name" [ "_pointLight1_pointLightShape1" ]
ConcatTransform [ 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 -0.000000 -0.000000 -1.000000 0.000000 13.137122 15.475898 13.821261 1.000000 ]
LightSource "E:/dev/render/renderer/renderman.compliant/3delight/10.0.4/shaders/src/maya_pointlight" 1
"intensity" [ 1.000000 ]
"lightcolor" [ 1.000000 1.000000 1.000000 ]
"color shadowcolor" [ 0.000000 0.000000 0.000000 ]
"float decay" [ 0.000000 ]
"string shadowmapname" [ "" ]
"float shadowBias" [ 0.010000 ]
"float shadowBlur" [ 0.000000 ]
"float shadowSamples" [ 16.000000 ]
"float shadowFilterSize" [ 1.000000 ]
"float __nondiffuse" [ 0.000000 ]
"float __nonspecular" [ 0.000000 ]
"string __category" [ "" ]
AttributeEnd
Illuminate 1 0
AttributeBegin
Attribute "identifier" "name" [ "_pPlane1_pPlaneShape1" ]
Illuminate 1 1
GeometricApproximation "motionfactor" 1.000000
Color [ 0.000000 0.500000 0.029750 ]
Opacity [ 0.578520 0.578520 0.578520 ]
#shading group: phong1SG
Surface "E:/MyDocuments/maya/projects/default/generatedShader/phong1"
#no volume shader.
#no displacement shader.
Transform [ 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 -0.642661 -10.365156 8.772568 1.000000 ]
PointsGeneralPolygons [ 1 ] [ 4 ] [ 2 3 1 0 ] "P" [ -18.502369 -0.000000 16.700991 18.502369 -0.000000 16.700991 -18.502369 0.000000 -16.700991 18.502369 0.000000 -16.700991 ] "vertex normal N" [ 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 ] "facevarying float[2] st" [ 0.000000 0.001809 0.997722 0.001222 1.000000 1.000000 0.000000 1.000000 ]
AttributeEnd
WorldEnd
FrameEnd
Render this rib file:
\>prman er_rm_shader_graph_phong3_perspShape.0001-3delight.rib
The output image seems not correct.Here is the output image:
My Question is:
1. I guss that my usage of maya_phong() is wrong, but I'm not sure where the problem is. Could you give me any help?
2. Can 3delight shader header files(e.g. phong.h) be used with prman?
Thank you in advance.