doublesided_shader.ma (2.4 KB, 296 views)
Last edited by jsprogg; 13-04-2007 at 07:11 AM.
#
4
13-04-2007
, 07:29 AM
Subscriber
Join Date: Dec 2006
Firstly, thanks for writing that for me, I appreciate it alot.
Secondly, I get the following error when I go to test it:
// Warning: rman Warning: S05001 Shadeop error: argument types clash in op _assign at pc 850 in "C:/Documents and Settings/James/My Documents/maya/projects/Trapped/renderman/box/shaders/doublesided_shader_doublesidedM_".
Shader "C:/Documents and Settings/James/My Documents/maya/projects/Trapped/renderman/box/shaders/doublesided_shader_doublesidedM_", Geometry "lidShape1". //
And it just renders the default grey.
However, when I tried it on a plane in an untitled file, it worked OK. Any ideas?
James
#
5
13-04-2007
, 07:31 AM
Lifetime Member
Join Date: Feb 2004
Location: Chicago
did you seperate the lid into a seperate object ?
I don't think it would work very well if you have more than one shader on the object with this.
#
6
13-04-2007
, 07:35 AM
Subscriber
Join Date: Dec 2006
er....it's not a poly cube, it's a number of planes rotated into the shape of a cube, then it's transformations frozen.
I'm only applying that texture to that plane...
#
7
13-04-2007
, 07:37 AM
Lifetime Member
Join Date: Feb 2004
Location: Chicago
hmm.. if if worked on a new plane I can't see why it wouldn't work on this plane, have you done anything to the plane ?
Simply answer is to replace this plane with a new one with no subdivions.
Last edited by jsprogg; 13-04-2007 at 07:40 AM.
#
8
13-04-2007
, 08:17 AM
#
9
13-04-2007
, 10:06 AM
Lifetime Member
Join Date: Feb 2004
Location: Chicago
I see the problem ..you never mentioned you wanted to render with renderman.
You need to create a rederman custom shader, this is quite involved and needs enviroment variables to be added so you can access the rendermantree and would take me while to write.
#
10
13-04-2007
, 10:08 AM
Subscriber
Join Date: Dec 2006
oh dear.
I should be able to work that out..
I hope
thanks for looking thou
#
11
13-04-2007
, 10:13 AM
Lifetime Member
Join Date: Feb 2004
Location: Chicago
can you not use Mentalray ? this shader will work with Mentalray or maya software.
#
12
13-04-2007
, 10:18 AM
Subscriber
Join Date: Dec 2006
I may, it's just I've been redndering with RMfM and results between the two renderers are fairly staggering...
Thanks again for all your help...
#
13
13-04-2007
, 11:42 AM
Lifetime Member
Join Date: Feb 2004
Location: Chicago
james I am writing you instructions but it will take a while because it's a lot of steps and not easy to explain simply.
#
14
13-04-2007
, 02:08 PM
Lifetime Member
Join Date: Feb 2004
Location: Chicago
ok I must be insane but heres how to create a custom double sided shader in RenderMan ..
go to the control panel on Windows and double click on System.
select the advanced tab in system properties window then click on
Environment variables.
Create a new variable
Variable name: RMANTREE
Variable value: c:\Program Files\Pixar\RenderManForMaya7.0-1.0\rmantree
(your path to rmantree might not be the same on your machine)
next below in the system variables window you should now see a variable called Path
double click on that and then in the variable value window we need to modify the path.
If it doesn't end in a semi colon add one then in windows explorer browse to your renderman folder
and select the bin folder then copy the address at the top which will be something like
c:\Program Files\Pixar\RenderManForMaya7.0-1.0\bin
and paste this after the semi colon in the variable path then click ok.
This will now allow you to compile custom shaders for renderman.
Open notepad
you need to comment so at a later date you or whoever knows what this shader is.
to comment in renderman you use /* (forward slash and astrix)
to close a comment you use */ (astrx and forward slash)
Anything between those two comment will be ignored by renderman but you can read if you open the shader.
lets create a basic shader and compile it and connect it in Maya.
copy the following script into notepad and it's very important that you get the cases correct
so capital O but small i,capital C but small s
----------------------------------------------------------------------------------------------------
ok so comment /* this a double sided shader*/
surface myDtextureShader (string image_file1= ""; string image_file2= ""; ) {
color imageToUse;
color imageFront = texture(image_file1);
color imageBack = texture(image_file2);
/*check the normals and see if they are facing the camera*/
normal n = normalize (N);
normal Nf = faceforward (n,I);
if (n == Nf ) {
/* if this is true then the normal did not get flipped */
imageToUse = imageFront;
} else {
/* if this is false then the normal did get flipped */
imageToUse = imageBack;
}
Oi = Os;
Ci = Cs * imageToUse * Oi * diffuse(Nf);
}
-----------------------------------------------------------------------------------------------------
ok this is the basic shader so save this with a .sl extension
for now create a folder called shaders on one of your drives and save it as myDtextureShader.sl in that.
Now you need to complie the shader as maya will not take this .sl file
so open up the command prompt start/all programs/Accessories/command prompt
type in the drive letter you created the shaders folder on and then a colon and hit enter.
for example if the shaders folder is in D then you would type this
c:\Documents and Settings\ your name >d:
next type cd shaders (D:\>cd shaders)
you will see this D:\shaders>
next type myDtextureShader.sl (D:\shaders>myDtextureShader.sl) hit enter and it will compile
you should now have a complied shader with a .slo extension in your shaders folder.
Leave the command prompt open for now.
Ok assuming you got no errors it time to move to Maya.
In Maya open the hypershade and then with the renderman plugin loaded
right at the top of the create menu click on Render Man Shader
click ctrl+A and in the attribute editor click the little folder next to shader at the top
and browse to the myDtextureShader.slo file.
now comes the awkward part because you can't load an image into this shader without converting it
a .tx file.
Move the two texture files you want into the shader folder you created.
In the command prompt type txmake then the name of the first file and then frontImage.tx
(so it will look something like this D:\shaders>txmake xxxx.jpg frontImage.tx) hit enter.
type again txmake and the name of the second file and then backImage.tx
you should now have the two files converted to .tx which renderman can read.
back in Maya attribute editor under RenderMan Shader Parameters
image_file1 using forward slashes type the path to the frontcolorM.tx file
image_file2 using forward slashes type the path to the backcolorM.tx file
example D:/shaders/frontcolorM.tx
ok all that remains is to MMB drag the renderman shader from the hypershade to your object.
test render and relax.
Last edited by jsprogg; 13-04-2007 at 02:31 PM.
#
15
13-04-2007
, 02:53 PM
Subscriber
Join Date: Dec 2006
Wow!!!
You went to town there, thank you sooooo much.
I'll give it a bash tonight/early hours of tomorrow morning. I know I'm going to be up late.
Thanks once again!!
James
You may not post new threads |
You may not post replies |
You may not post attachments |
You may not edit your posts |
BB code is On |
Smilies are On |
[IMG] code is On |
HTML code is Off
|