PDA

View Full Version : [Python Script] Faking Global Illumination. 1.1.0


rferl
11-19-2007, 12:46 AM
Recently I wrote a python script for maya.

Faking Global Illumination. 1.2.0 (http://www.highend3d.com/maya/downloads/mel_scripts/rendering/misc/Faking-Global-Illumination-4973.html)


http://static.highend3d.com/downloadsimages/4973/Compare.jpg

- Fakes Global illumination in very fast way. For maya 8.5 and 2008
- This tool makes a Magic light! to your scene.
- You should add occlusion to your scene to see the actual results.
- This is NOT a light system, so add your lights before rendering the scene.
- Do not trust to this tool so much. It is useful in some cases. Play with the Options like Ramp color, Light intensity , etc to reach your desire image. Actually I wrote this script for a commercial. Just want to share it with all of CGTalk and Highend3d friends. haVe FuN.
- Download the sample file here (http://rodmena.com.googlepages.com/fa_fgiSample.ma).
- Feel free to send me bugs at: rodmenacom@gmail.com



http://static.highend3d.com/downloadsimages/4973/yrs.jpg



Cheers, Farsheed.

DimensionalPunk
11-19-2007, 04:43 AM
Okay, this looks interesting but I've never run a python script.

This is in my Maya.env:
PYTHONPATH = C:\Program Files\Autodesk\MayaBonusTools2008\python

So I added your script to that directory and in Maya change the Command Line from MEL to Python and type 'import fa_fgi', but it gives me '# Error: No module named fa_fgi'.

rferl
11-19-2007, 05:01 AM
If you have not done so already, it is a good idea to setup a directory for your published python scripts so that they will be accessible from within maya. you do this by setting the PYTHONPATH environment variable in Maya.env. if you want to use your current maya scripts directory simply add this to your Maya.env: PYTHONPATH = $MAYA_SCRIPT_PATH
____________________________________________

Or add this variables to environment:
Name: PYTHONPATH
Value: %MAYA_SCRIPT_PATH%

*Notice that you should create MAYA_SCRIPT_PATH before.


____________________________________________

then place my script directory in your PYTHONPATH directory.

Keep me informed. Thanks for your intrest and good luck.

Hamburger
11-19-2007, 09:12 AM
Hey this looks excellent! It didn't seem to work on mia_material shaders though, just Maya's standard shaders (because of the ambient light). Very cool script though.

achoury
11-19-2007, 12:56 PM
hi
Ok here is my script path
PYTHONPATH = C:\Documents and Settings\Administrateur\Mes documents\maya\2008\scripts
and here is the error when i try the command: import fa_fgi;

import fa_fgi
# Error: No module named fa_fgi
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# ImportError: No module named fa_fgi #

so i have changed the script path to this one:
PYTHONPATH = C:\Documents and Settings\Administrateur\Mes documents\maya\2008\prefs\scripts

and here is the error:

import fa_fgi
# Error: Bad magic number in C:/Documents and Settings/Administrateur/Mes documents/maya/2008/prefs/scripts\fa_fgi.pyc
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# ImportError: Bad magic number in C:/Documents and Settings/Administrateur/Mes documents/maya/2008/prefs/scripts\fa_fgi.pyc #


i've already setup the env variable in my OS
PYTHONPATH = %MAYA_SCRIPT_PATH%

so what is the problem?

Rachid

achoury
11-19-2007, 01:07 PM
sorry double post

rferl
11-19-2007, 02:28 PM
Well, I fully test it under 8.5 and I sent it to one of my friends and she told me that the script works under 2008 too, :applause: but maybe sha was wrong:banghead:.
I will test it in a few days. Actually this script compiles with python version 2.4.3.
I can't guess what is the problem:eek:. but I will solve it next week. I havn't maya 2008 :cry:
yet.

rferl
11-20-2007, 07:59 AM
I udated to v1.2 and fix some bugs. you can download it from Here:deal: (http://www.highend3d.com/maya/downloads/mel_scripts/rendering/misc/4973.html).

-Usage:
1- set MAYA_LOCATION variable in environment:
Example:
Name: MAYA_LOCATION
Value: D:\Program Files\Autodesk\Maya8.5;
2- Put this file in your PYTHONPATH. if you have not set it yet, set it now:
Example:
Name: PYTHONPATH
value: F:\Documents\maya2008\scripts;
3- Start maya and in python window type:
import fa_fgi
4- Add your lights to the scene.
5- Render it.
6- After first load Script works with this command:
reload(fa_fgi)

Cheers.

rferl
12-17-2007, 12:14 PM
I updated to v1.3 and many bugs are solved. You can download the source code from:
http://groups.google.com/group/python_inside_maya/t/3bf87f60743a1c8e
Cheers.

wdaniel
12-17-2007, 03:49 PM
is there a more detailed installation exlpination for this . i don't fully understand.

w...............

rferl
12-17-2007, 04:24 PM
I explian it one more time:

1- Create a folder in one of your drives named myPythonScripts. The name can change to anything you want. for example you create this folder: C:/myPythonScripts

2- Set PYTHONPATH environment variable. (If you dont know how to set environment variables, just right click on your mycomputer icon, select properties, go to advanced tab and push "Environment Variables" button. you can create new variables there.)

http://docs.google.com/File?id=dftn3xbb_2fkpdr4g7

the variable name should be: PYTHONPATH
the variable value should be: C:/myPythonScripts;

3- Set a new variable name: MAYA_LOCATION and add your maya installation path as its value:

the variable name should be: MAYA_LOCATION
the variable value should be: D:\Program Files\Autodesk\Maya2008

Set the value based on your maya location.


4- Now copy fa_fgi.pyc to this folder. (select the file according to your maya version)

5- open maya, in the maya script editor go to python shell and type:

import fa_fgi
fa_fgi.create()

6- Create a shelf button from this two lines and use it when ever you like.

Chhers, Farsheed.

wdaniel
12-17-2007, 07:00 PM
it just dosn't work would vista make a diference. way can you just pop it into the python script editor


w......................

rferl
12-17-2007, 07:57 PM
Then you should download the source. It is a dirty way to use script editor to excute all the script. Download the source and do what you want.
Cheers, Farsheed.

thematt
12-17-2007, 10:22 PM
so that's only working under maya renderer right? because I've test it under mental ray but don't see much difference on doing it with you script or using a ambiant light with the env sphere conenct to it or without.
+ when I disconnect the smpler info mothing seems to changed in the render?
I don't really see the use of it actually (sampler info).

enlight us please on how you use that baby.Sincerely though it would be more intersting to post the network and explain what it does that the clumpsy python .py, although most people could reverse engeneer it.

thanks for the effort though

cheers

wdaniel
12-17-2007, 10:38 PM
first we need an easyer way to install it.

w...............

rferl
12-17-2007, 11:20 PM
Hi, here is the source code (http://groups.google.com/group/python_inside_maya/t/3bf87f60743a1c8e).
Download the sample scene (http://rodmena.com.googlepages.com/fa_fgiSample.ma) to understand how it works.

Cheers, Farsheed.

wdaniel
12-17-2007, 11:42 PM
i just want to use it and see if it will work in my pipeline i don't want to reprogram anything i know nothing about programing and variable. i guess its not for me, to bad for me it looked promissing.

w....................

sacslacker
12-18-2007, 10:52 PM
first we need an easyer way to install it.

w...............

It's just like any other python script man. Take an hour and get a basic understanding of what's being described here and it will make your Maya life much easier. Really, there is no programming involved and you should learn a bit about what is being described here. I mean, if you want to integrate it in your pipeline, who's the one that set the pipeline up? Having general knowledge of how to set up environment variables is not (!=) to programming. =)

EDIT: and thanks for sharing the script, it's certainly interesting.

CGTalk Moderation
12-18-2007, 10:52 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.