Forums

You are not logged in.

#1 2012-04-29 04:36:10

yaoyansi
New member
Registered: 2010-11-22
Posts: 6

how to use maya_phong() with prman?

Hi all,
I write a surface shader which uses 3delight's maya_phong() function. Then I compile the shader and render my rib with prman13.5. But the output image seems not right. 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:

Code:

surface phong1()
{
// define some extern variables which are used in 3delight shaders 
 color __transparency = color (1,1,1);
 float __refracts = 0;
 uniform float __reflects = 0;
 
// define the shaders ---------------------
#include <phong.h>
void phong1 (
)
{
  vector ambientColor = vector (0,0,0);
  vector i_color = vector (0,0.5,0.02975);
  float cosinePower = float 26.299999;
  float diffuse = float 0.82642;
  vector incandescence = vector (0,0,0);
  float matteOpacity = float 1;
  float matteOpacityMode = float 2;
  vector normalCamera = vector (1,1,1);
  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();
}

Prman shader.exe complains some errors for 3delight maya rsl shader. I convert some float type to color or vector type in shading_utils.h, and those error disappears. Then I compile the shader with prman shader.exe

Code:

shader.exe -o maya_pointlight.slo -I"E:\modified_3delight" maya_pointlight.sl

shader.exe -o phong1.slo -I"E:\modified_3delight" phong1.sl

My rib file test_scene.rib:
(Note that I also use 3delight maya_pointlight shader for the point light.)

Code:

##RenderMan RIB-Structure 1.0
version 3.03
#    Generated by Liquid v2.3.5 (buildtime= 1:50:32.62)
#    User  : yaoyansi
#    Time  : Sun Nov 18 00:02:00 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 ] 
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
    Format 768 576 1.000000
    ShadingInterpolation "smooth"
    Quantize "rgba" 255 0 255 0.5
    Projection "perspective" "fov" [ 42.184677 ] 
    ScreenWindow -1.333333 1.333333 -1.000000 1.000000
    Clipping 0.100000 10000.000000
    Transform [ 0.999263 -0.020760 -0.032290 0.000000 0.000000 0.841149 -0.540803 0.000000 -0.038388 -0.540405 -0.840529 0.000000 0.842702 1.101467 44.267792 1.000000 ]
    #Display Drivers:
    #Display 6
    #Display 7
    #Render To Maya renderView :
Display "test_scene.tif" "file" "rgba"
    Shutter 1.000000 1.000000
    WorldBegin
        TransformBegin
            CoordinateSystem "worldspace"
        TransformEnd
        TransformBegin
            Rotate -90.000000 1.000000 0.000000 0.000000
            CoordinateSystem "_environment"
        TransformEnd
        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 0.000000 5.000000 0.000000 1.000000 ]
            #LightSource "liquidpoint" 1 "intensity" [ 0.500000 ] "lightcolor" [ 1.000000 1.000000 1.000000 ] "float decay" [ 0.000000 ] "string shadownamepx" [ "" ] "string shadownamenx" [ "" ] "string shadownamepy" [ "" ] "string shadownameny" [ "" ] "string shadownamepz" [ "" ] "string shadownamenz" [ "" ] "float shadowbias" [ 0.010000 ] "float shadowblur" [ 0.000000 ] "float shadowsamples" [ 16.000000 ] "float shadowfiltersize" [ 1.000000 ] "color shadowcolor" [ 0.000000 0.000000 0.000000 ] "float lightID" [ 0.000000 ] "string __category" [ "" ] "float __shadowF" [ 0.000000 ] "color __shadowC" [ 1.000000 1.000000 1.000000 ] "color __unshadowed_Cl" [ 0.000000 0.000000 0.000000 ] "float __nondiffuse" [ 0.000000 ] "float __nonspecular" [ 0.000000 ] 
            LightSource "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" [ "_pPlane_pPlaneShape" ] 
            Illuminate 1 1
            #mark14
            Color [ 0.000000 1.000000 0.000000 ]
            Opacity [ 1.000000 1.000000 1.000000 ]
            #shading group: phong6SG
            #Surface "E:/MyDocuments/maya/projects/default/generatedShader/phong1" 
            Surface "phong1" 
            #no volume shader.
            #no displacement shader.
            Transform [ 0.387079 0.000000 0.000000 0.000000 0.000000 0.330529 0.000000 0.000000 0.000000 0.000000 0.603717 0.000000 0.000000 0.000000 0.000000 1.000000 ]
            PointsGeneralPolygons [ 1 ] [ 4 ] [ 0 1 3 2 ] "P" [ -30.707306 -0.000000 20.895386 30.707306 -0.000000 20.895386 -30.707306 0.000000 -20.895386 30.707306 0.000000 -20.895386 ] "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 1.000000 1.000000 1.000000 1.000000 0.319530 0.000000 0.319530 ] 
        AttributeEnd
    WorldEnd
FrameEnd

Then I render the rib file with this script:

Code:

prman test_scene.rib

The output image seems not correct.

Last edited by yaoyansi (2012-11-18 00:41:53)

Offline

 

#2 2012-04-29 04:40:43

yaoyansi
New member
Registered: 2010-11-22
Posts: 6

Re: how to use maya_phong() with prman?

The entire plane is expected to lighted by the point light,
but the result is only the half of the plane is lighted.
Where is the problem? Could you give me any clue?

Here is the output image:
http://hojocn.googlecode.com/files/test_scene_3de.jpg

Last edited by yaoyansi (2012-11-18 00:55:02)

Offline

 

#3 2012-04-29 12:08:10

aghiles
3Delight Developer
Registered: 2007-01-03
Posts: 1081
Website

Re: how to use maya_phong() with prman?

Shouldn't you be asking this question on PrMan's forums ?

If "worst comes to worst", render it in 3Delight :)

-- aghiles

Offline

 

#4 2012-11-18 00:30:35

yaoyansi
New member
Registered: 2010-11-22
Posts: 6

Re: how to use maya_phong() with prman?

I render the rib with 3delight 10.0.5 with this script:

set DELIGHT=E:\dev\render\renderer\renderman.compliant\3delight\10.0.5

E:\dev\render\renderer\renderman.compliant\3delight\10.0.5\bin\shaderdl.exe -o maya_pointlight.sdl -I"E:\dev\render\renderer\renderman.compliant\3delight\10.0.5\maya\rsl" maya_pointlight.sl

E:\dev\render\renderer\renderman.compliant\3delight\10.0.5\bin\shaderdl.exe -o phong1.sdl -I"E:\dev\render\renderer\renderman.compliant\3delight\10.0.5\maya\rsl" phong1.sl

E:\dev\render\renderer\renderman.compliant\3delight\10.0.5\bin\renderdl.exe test_scene.rib

pause

And it generate the same result.

Offline

 

#5 2012-11-18 04:15:21

ogre
Member
From: Poland
Registered: 2007-01-22
Posts: 575
Website

Re: how to use maya_phong() with prman?

This shader looks relly relly weird. Are you sure you know what you're doing ? :)


- Michal

Offline

 

Board footer

PunBB is © Copyright 2002–2005 Rickard Andersson

You are here: Resources » Forums
Follow us on Twitter
© 2006-2011 dna research. All Rights Reserved.
Trademarks & Copyrights Notices