|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| create ambient occlusion shelf button with custom settings?
|
|
|
i have to bake AO maps all the time at work. anyone mind showing how i can have a shelf button with custom settings?
this way i can just click on my object, press the button and it already have the settings i like for baking.
i want to do a rendermap button in the same way, but i’m sure if someone explained how to do it for AO it would apply for rendermap too. would really, really appreciate any help on this.
|
|
|
|
[quote=mypeople;20500]i have to bake AO maps all the time at work. anyone mind showing how i can have a shelf button with custom settings?
this way i can just click on my object, press the button and it already have the settings i like for baking.
i want to do a rendermap button in the same way, but i’m sure if someone explained how to do it for AO it would apply for rendermap too. would really, really appreciate any help on this.
There are three (at least) ways to bake ambient occlusion maps:
1) Use ultimapper’s AO output - with a self-cloned mesh a parent hi-res mesh so it won’t require the depth range computation.
2) Use rendermap’s AO output. Works, if you don’t have overlapping uv’s.
3) Use mental-ray AO shader connected to the diffuse shader and bake the ambient occlusion map as the albedo map using rendermap or ultimapper.
Which solution do you use or want to use? The first two are relatively easy to implement, the third one is a bit more complex, but gives you a distance parameter that is not available for rendermap and ultimapper.
BTW:
In addition and sometimes as an alternative, you may also use an external application like the CrazyBump that bakes the ambient occlusion maps based on the normal maps. The advantages are that it’s much faster that rendering AO maps using MR, that allows to quickly create 2-3 versions of AO maps - more blurry and more precise, that make the final effect more realistic. The disadvantage is that you need a normal map and it won’t work for geometry shapes that are not reflected in the normal map.
|
|
|
|
hey ms.
ideally what i’d like is to use the rendermap with the ambient occlusion shader on the object.
i’d like to have a button where i select my object, press a shelf button and it applies the rendermap with the settings i like.
512x512
assigned to desktop
things like that.
|
|
|
|
[quote=mypeople;20538]hey ms.
ideally what i’d like is to use the rendermap with the ambient occlusion shader on the object.
i’d like to have a button where i select my object, press a shelf button and it applies the rendermap with the settings i like.
512x512
assigned to desktop
things like that.
[quote=mypeople;20538]ideally what i’d like is to use the rendermap with the ambient occlusion shader on the object.
Just to clarify: you wan’t to use an OA shader from the material’s render tree or you want’ to use the rendermap’s AO generator (surface type) ? Those are two different things.
The easiest way to learn how to automatize things in XSI is to do something and look at results in the message log.
1) Add the rendermap property
2) Set the options you need.
3) Copy message log to the text editor and adapt it to your needs.
This way you don’t have to learn the object model nor the scripting. At least at the beginning.
An example message log output would be like:
AddProp("RenderMap", "", "", null, null); SetValue("cube.RenderMap.resolutionx", "512", null); SetValue("cube.RenderMap.imagefilepath", "C:\\Documents and Settings\\mslaf\\Desktop\\RenderMap.pic", null); SetValue("cube.RenderMap.imageformat", "tga", null); SetValue("cube.RenderMap.attribute", 2, null); SetValue("cube.RenderMap.occsamples", 150, null); SetValue("cube.RenderMap.occspread", 1.5, null); RegenerateMaps("cube.RenderMap", null); DeleteObj("cube.RenderMap");
now, with a little SDK help you can transform this into a more universal script:
/*
Rendering parameters:
*/
var nResolution = 128;
var strPath= "C:\\Documents and Settings\\";
var strFormat = "tga";
/*
Process input objects:
*/
var oProperty;
var oRendermaps = new ActiveXObject( "XSI.Collection" );
var strName = "RendermapAO";
for( var i=0; i < Selection.Count; i++ ) {
var oObject = Selection( i );
/*
Add Rendermap property:
*/
var oProperties = AddProp("RenderMap", oObject , null, strName, null);
oProperties = oProperties( 1 );
var oProperty = oProperties( 0 )
/*
Set property parameters:
*/
var strPath = oObject.Name + "." + oProperty.Name;
var strFilename = strPath + oObject.Name + "." + strFormat;
SetValue( strPath + ".resolutionx", nResolution, null);
SetValue( strPath + ".imagefilepath", strFilename , null);
SetValue( strPath + ".imageformat", strFormat, null);
SetValue( strPath + ".attribute", 2, null);
SetValue( strPath + ".occsamples", 150, null);
SetValue( strPath + ".occspread", 1.5, null);
/*
Add property to rendering queue:
*/
oRendermaps.Add( oProperty ); }
/*
Generate textures and remove rendermap properties:
*/
LogMessage( oRendermaps );
if ( oRendermaps.Count > 0 ) {
RegenerateMaps( oRendermaps );
DeleteObj( oRendermaps ); }
...that can be assigned to the ‘scripted button’ in the UI.
|
|
|
|
hey mslaf.
i really really appreciate you doing all that work. i’m not a programmer, but i have a few friends here who are. i think i’m goin gto show them what you did today and see if they can quickly walk me through it.
i tried your script btw, i get this error...it would be so nice to just have a button i press where it assigns a rendermap to something with the settings i like. i’d like to do this for several other things too. really comes in handy the shelf buttons. thanks again
‘ ERROR : Expected statement - [line 1]
‘ ERROR : (Microsoft VBScript compilation error)
‘ ERROR : >[1] /*
‘ ERROR : [2] Rendering parameters:
‘ ERROR : [3] */
‘ ERROR : [4] (null)
‘ ERROR : Expected statement
|
|
|
|
It’s an example. Switch to the to JScript scripting language, select a polymesh and try again.
|
|
|
|
I am interested to know more about hooking up the ambient occlusion shaders to the diffuse channel of the shader. It sounds like a very interesting idea, and would like to explore what kind of possibilites i can get out of it.
So, i did what you said.
1. Made a lambert
2. go to nodes/illumination/ambient occlusion.
3. Hooked up this to the diffuse channel.
4. Fire up rendermap only baking the albeado
Tho all i get is black with shades of white. Opposed to predominant white with shades of black. Am i doing something wrong? Also how do i go about tweaking the ao shader to get best results?
|
|
|
|
[quote=raul;21436]Tho all i get is black with shades of white. Opposed to predominant white with shades of black. Am i doing something wrong? Also how do i go about tweaking the ao shader to get best results.......
Did you setup the UVs?
From my experience, as I was playing with the RM in the past, it sometimes has problems in correctly handling the overlapping UVs. For unknown reason, the pixels are not rendered. It’s not a common problem, just may happen.
This is an example setup:

Default object view (OGL)

Material with a texture and an AO shader rendered as albedo:

Material with an AO shader rendered as ambient occlusion:

Material with an AO shader rendered using ultimapper as albedo - with the same mesh as a reference:

Material with a texture and an AO shader rendered using ultimapper as albedo - with the same mesh as a reference:

|
|
|
|
Thank you for taking the time to answer. Tho i had already found the solution to my problem right after the first time i posted.
The problem didn’t have anything to do with the uvs. What was happening was that i had this really messed up ligthing set up in my scene. Which is what i used to bake my light maps, using the render map. I could not just use the ultimapper because i was afraid it wasn’t going to take into account what other objects were around casting ao into themselves or others. In a nutshell, Render Map prolly got overwhelmed when trying to bake the ao map due to the number or ligths, and faces inverted… That is my conclusion. Either way, maps were not coming out right.
Let me describe my project a bit better here. This is a game level, all modeled in xsi. It will be used in the quest3d engine. So we wanted to do most of the work inside of xsi. Since we don’t have the time to learn quest3d. Light maps, ao maps, were all done in xsi.
In case people are curious here are some guidelines
1. AO maps don’t rely on lighting, so u do not need the same lights that were used to bake the light map. DELETE THOSE LIGHTS. And use a directional light instead.
2.Delete everything but the objects that you want to render ao maps to. Doesn’t hurt to get rid of the extra junk
3.Strip off all materials! Unless there is a specific thing that you are doing with them. Whatever you do, don’t delete the scene material. Sometimes, it comes back to haunt your butt!
Setting up the ao shader
1. Create a constant Shader. Name it “aoShader” or whatever
2. From the illumination nodes, grab a “ambient occlusion” node. Connect this node to the color input of the constant shader.
3. Make sure that in the settings of the “ambient occlusion” node, that “maximun distance” is at least set to 1. 0 will give you nothing but darkness.

“Y the hell are we setting up a shader again?” Because we want to use render map to bake out the color that is being cast on the object. In this case, the object is being shaded by ambient occlusion.
For more info on render map, just check out the help docs. Let me just say that Render map is an incredible amazing tool! It can do a lot more than it says it can. lol.
On your render map settings, you DON’T want to set it up to ambient occlusion. You want to set it to albaedo (color) as that is what we need to bake.
Rendering these maps should only take a few seconds. Rather than minutes, sometimes even hours! And its because its using the ao shader.
Here is the scene in xsi, being shaded with the ao shader

And here it is in real time. with ligth maps, diffuse and ao maps.

|
|
|
|
Thank you for taking the time to answer. Tho i had already found the solution to my problem right after the first time i posted.
The problem didn’t have anything to do with the uvs. What was happening was that i had this really messed up ligthing set up in my scene. Which is what i used to bake my light maps, using the render map. I could not just use the ultimapper because i was afraid it wasn’t going to take into account what other objects were around casting ao into themselves or others. In a nutshell, Render Map prolly got overwhelmed when trying to bake the ao map due to the number or ligths, and faces inverted… That is my conclusion. Either way, maps were not coming out right.
Let me describe my project a bit better here. This is a game level, all modeled in xsi. It will be used in the quest3d engine. So we wanted to do most of the work inside of xsi. Since we don’t have the time to learn quest3d. Light maps, ao maps, were all done in xsi.
In case people are curious here are some guidelines
1. AO maps don’t rely on lighting, so u do not need the same lights that were used to bake the light map. DELETE THOSE LIGHTS. And use a directional light instead.
2.Delete everything but the objects that you want to render ao maps to. Doesn’t hurt to get rid of the extra junk
3.Strip off all materials! Unless there is a specific thing that you are doing with them. Whatever you do, don’t delete the scene material. Sometimes, it comes back to haunt your butt!
Setting up the ao shader
1. Create a constant Shader. Name it “aoShader” or whatever
2. From the illumination nodes, grab a “ambient occlusion” node. Connect this node to the color input of the constant shader.
3. Make sure that in the settings of the “ambient occlusion” node, that “maximun distance” is at least set to 1. 0 will give you nothing but darkness.

“Y the hell are we setting up a shader again?” Because we want to use render map to bake out the color that is being cast on the object. In this case, the object is being shaded by ambient occlusion.
For more info on render map, just check out the help docs. Let me just say that Render map is an incredible amazing tool! It can do a lot more than it says it can. lol.
On your render map settings, you DON’T want to set it up to ambient occlusion. You want to set it to albaedo (color) as that is what we need to bake.
Rendering these maps should only take a few seconds. Rather than minutes, sometimes even hours! And its because its using the ao shader.
Here is the scene in xsi, being shaded with the ao shader

And here it is in real time. with ligth maps, diffuse and ao maps.

|
|
|
|
This is my personal opinion, the AO is one of these ‘cool effects’ - commonly used in games - that are very unrealistic. To make it more realistic the typical black color should be replaced to something else: rust, dirt etc.
If you process the generated images in PS, you probably want to have the AO map without the diffuse channel. This way you’ll be able to use it as a mask for another image making the final effect more realistic.
If you don’t use the PS, the same can be done in XSI, by connecting a kind of ‘dirt’ texture to AO shader’s dark port. This is an additional benefit, besides the distance parameter of using the render tree’s shader instead of rendermap’s generator.
|
|
|
|