PDA

View Full Version : Re: Compiling for linux


MunCHeR
08-10-2004, 10:58 AM
Hi all, well I'm nothing of a programmer by any stetch, just wondering if anyone could explain for exapmle how to compile some of BigMuh's shaders for linux as they have the source code included, and it would be fun to help out the community in some way, just tired of waiting for somebody else to do it. I cant seem to find a diffraction shader for linux, maybe someone would be kind enough to explain the steps for us newbs.

Kind regards

MunCH

Splin
08-11-2004, 08:51 PM
Yeah, I vote for that too :thumbsup:
Some time ago made even pathetic try on that but was unsucsessful, very curious about that.
Good question MunCHeR!

MayaPT
08-12-2004, 10:44 AM
Hi guys,

I had a little look at the Diffraction shader and in the source i found reference to shader.h which i can't find anywhere, so when i go about compiling in order to obtain the Diffraction.so i get errors which i believe come mainly from there. Maybe if any of u guys know where that shader.h i manage to compile it although i'm as newbbie as u guys in this matter.


Best regards,

MayaPT

DiGiman
08-13-2004, 10:27 PM
in the installation documents that come with maya for linux, it describes the process for compiling shaders for linux. Check it out, it might be of some use.

MunCHeR
08-14-2004, 04:57 AM
lol, well I had a quick look, and it seems the install and licensing book goes as far as telling you what version of gcc to use etc, on par with the rest of the alias documantation :scream:
I was more after perhaps a simple step by step guide, can anyone else help out here :D

Cheers

MunCH

MunCHeR
08-16-2004, 10:58 AM
OK guys, googling this is kinda exhaustive and fruitless thus far, atleast for a mental giant like myself:D, but i did come across this interesting link:

http://www.qarl.com/menu/class/cs323_fl98/mrmanual_1.9/shaders.html

very interesting read, I understand the first paragarph heh, seeya all in a few weeks when I understand a little more:eek:

MunCH

augustus
08-16-2004, 12:23 PM
You can look at mental ray user manual to find info about how to compile a shader:
Linux x86, gcc

gcc -c -O3 -fPIC -Bsymbolic shader.c

ld -export-dynamic -shared -o shader.so shader.o

Look maya devkit/menyalray/include for shader.h (also geoshader.h, mi_version.h, mayaapi.h)

MunCHeR
08-16-2004, 09:52 PM
Many thanks Augustus, I shall look into it :thumbsup:

MunCH

MayaPT
08-16-2004, 10:03 PM
hi MunCHeR

i just went through that link u posted before and i managed to compile both the diffraction and the dirtmap shader just using 'gcc -shared -o Diffraction.so Diffraction.cpp'. I'm already running the shaders on maya and they are working ok.

Hope this helps


MayaPT

dd_005
08-17-2004, 01:06 PM
Hi all. I just found a little script that works fine.
It seems that this is thebigMuh who write this.

So, to compile a shader as I understood:

1 - Copy shader.h (and if needed the othes .h files from /usr/aw/maya*.*/devkit/mentalray/include

2 - create a file "makeshader" with execution ability ( chmod a+x makeshader ) an paste that in



#!/bin/sh

### usage: "makeShader shadername"

name=$1

gcc -ansi -fPIC -I/usr/X11R6/include -c -O3 -mcpu=pentiumpro -fexpensive-optimizations -finline-functions -funroll-loops -fomit-frame-pointer -frerun-cse-after-loop -fstrength-reduce -fforce-mem -fforce-addr -DLINUX -DLINUX_X86 -DX86 -DEVIL_ENDIAN -D_GNU_SOURCE -D_REENTRANT -DSYSV -DSVR4 -Dinline=__inline__ -DHYPERTHREAD -I. -I. $name.cpp

g++ -shared -export-dynamic -static-libgcc -Wl,--whole-archive -o $name.so $name.o -Wl,--no-whole-archive

rm $name.o



3 - now you have to " sh ./makeshader nameofFile " <- whitout the .cpp extension

And that should be fine :)
Don't hesitate to correct me if needed, I'm just discovering that.


ps: sorry for my bad english

dd_005
08-17-2004, 04:37 PM
Hi all. I'm just discovering how to compile shader, and I foud a useful script...
Here is a resume of how i understood the thing...

1 - Copy shader.h (and the others files.h if needed.) they are located in /usr/aw/maya*.*/devkit/mentalray/include/

2 - Create a file " makeshader " and past this script.


#!/bin/sh

### usage: "makeShader shadername"

name=$1

gcc -ansi -fPIC -I/usr/X11R6/include -c -O3 -mcpu=pentiumpro -fexpensive-optimizations -finline-functions -funroll-loops -fomit-frame-pointer -frerun-cse-after-loop -fstrength-reduce -fforce-mem -fforce-addr -DLINUX -DLINUX_X86 -DX86 -DEVIL_ENDIAN -D_GNU_SOURCE -D_REENTRANT -DSYSV -DSVR4 -Dinline=__inline__ -DHYPERTHREAD -I. -I. $name.cpp

g++ -shared -export-dynamic -static-libgcc -Wl,--whole-archive -o $name.so $name.o -Wl,--no-whole-archive

rm $name.o


3 - make sure the " make shader " is executable ( chmod a+x makeshader ) and execute it with
" sh ./makeshader nameoftheshader " <- whitout the extension .cpp

That should work :thumbsup:
I've compile mix8Layer successfuly with that method.


But I've a problem. Some shaders doesn't have a file.cpp (like Oren-nayar or bumpcombine)
How to compile them??

Thank you for this thread, and sorry for my english :wise:

MunCHeR
08-28-2004, 07:44 AM
OK guys had my first go at this, since I keep getting beaten to it hehe, I compiled the

Oren-Nayar Blinn shader for mental ray v2 from highend, which comes with the source code, seems to compile OK, though I get an error message at the end saying:
OrenNayar.c:159:2: warning: no newline at the end of file

and

specBlinn.c:123:2: warning: no newline at the end of file

anyway dont think its a fatal error coz the shaders load up in the MR shader manager, though there is only an OrenNayar.mi file, and mental rar refuses to render it, not quite sure if you just slap the shader on a sphere and hit render or connect it to something else.

Any ideas?

MunCH

CGTalk Moderation
01-18-2006, 10:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.