2.1 Changes:
- Now properly includes alpha masks from Xoliul, 3point shaders and standard material into the Alpha and all other passes
- Hides the World Axis icon from the viewport (max 2008 and higher only)
- Added directory selection and filename in the UI
- Saves settings to ini file and loads them the next time the script opens
Save High Resolution Viewport Captures Passes:
Alpha: Saves alphas from the viewport to the alpha channel of the baseimage
Color: Assigns random colors to all objects and saves the separate pass
SSAO: Saves a separate Screen Space Ambient Occlusion Pass
Wire : Saves a separate Wire Pass
Z-Depth: Control the Zdepth range and save it as a separate pass (first increase the end untill all is visible and then tweak the begin parameter)
Color, SSAO, Wire, z-depth: save a separate image or avi file to the same directory as the basefile (filename_passname.ext)
Alpha : includes an alphamask in the viewportcapture alpha channel or saves out a separate avi file for the animation.
Tested in 3ds max 9, 2010 , 2011, 2012 (DIRECT3D)
Install:
Drag Grabviewport2.mcr into your viewport or go to maxscript ->Run Script.
Now go to Customize->Customize User Interface.
Toolbars->Category->Grabviewport2 and drag the Grabviewport button into your UI or bind a key to it.
Special thanks to : Borislav Petrov (MaxScript reference), Kostadin Kotev (miauu )
for the Alpha Masking technique ![:) :)](https://polycount.com/plugins/emojiextender/emoji/twitter/smile.png)
![passes.png](http://leslievdb.com/scripts/passes.png)
Replies
i just noticed that the OA pass isn't doing what it should do when i tested it here at work so i'll try to fix that lateron
download and try it now!!
I got to test it some more today and i found some bugs that i'll have to fix tonight, if you already downloaded the script make sure to update it when i post the update
Thank you for the credit and for the script.
EDIT: nvm, should've read the first post. XD
on a different note, howcome rendering an animation cannot be exported as a .tga sequence anymore?
and 1 other thing: howcome the aspect ratio is no longer locked? by that i mean, before, i could go into expert mode to maximize the amount of viewport i am initially capturing from, and now if i do that the image gets stretched.
tnx guys
miauu: no thank you for getting me scripting again :P, i added some version checks . Since the AO pass uses the viewportshading i disabled it if the maxversion is lower than 2010. I also tried the pastebitmap function btw but it requires a bmp with an alpha channel and that would mean i have to do setpixel operations any way so i left it out.
Oniram: both issues should be fixed
Pedro: added one above
-The videopasses get saved properly now too
-If you open another scene with the script opened it won't screw up the materials anymore
I'm still a bit confused with the AO saving, on my max versions @ home it does this properly but on my max 2011 @ work it doesn't . But on my colleques max @ work it does it the right way too so i'm not sure whats the deal. Do some of you get wrong AO results out of the script?
There is little error in GetOriginalState function.
fn GetOriginalState =
(
--print "Creating Original State"
m_originalwidth = gw.getWinSizeX()
m_originalheight= gw.getWinSizeY()
if (((maxVersion())[1] / 1000) > 11) then
(
m_originalbgcolor = GetUIColor 41
m_bviewcube = ViewCubeOps.Visibility
m_bviewportshadingstate = m_viewportshading.ActivateViewportShading
m_bviewportshadows = m_viewportshading.ShadowsActive
m_viewportAO = m_viewportshading.AmbientOcclusionMode
)
sceneStateMgr.CaptureAllParts "GrabViewportOriginalState"
for obj in objects do
(
if classof(obj.material) == DirectX_9_Shader then
(
append m_tempmats obj.material
)
)
)
You get the original background color only if the max version is 2010 or up, and in the SetOriginalState I get the error "Unable to convert: undefined to type Point3"on line:
SetUIColor 41 m_originalbgcolor
You know the reason for the error.
And one suggestion - hidding the view cube work in max2009. You can put the code that do that out of the max version check.
Best Regards!
tnx for checking , i updated the link again
edit: oh and now i updated the viewcube so it doesn't show in 2009 but still is ignored when the version is lower then 2009 since it didn't have a viewcube yet
I see that you don't read my suggestion. Edditing my post and your post are in 10:30 so, I will quoted myself
Max is extremely unreliable with every action you try to perform, realtime materials just fail at random , maps getting previewed on wrong models etc... Max 2011 for example loaded the materials properly after a scenestate load but max 2010 and max2012 didn't so i had to implement a "copy" of all dxmaterials before switching states and reassigning them afterwards.
or the viewport ui hiding requires me too first minimize and then maximize views for it to update 0_p.
Anyway as much as murphy's law lurks in every action i still love you max
Oniram: yeah i was thinking of how i could do this
one way would be to create a gradient material , apply it to all objects in the scene, then apply a uvwmap to all of the objects, align the gizmo to the camera and fit it. You get a nice fake z-depth out of that.
The limitations to this are
-Animation would be refitted every frame so the range of the gradient would change
- it's only depth in one axis, so if an object is lower it would still be as bright
ideas are always welcome
Edit nvm i found a cheaper and effective way to do this (bottom post)
i'm going to implement this and give the option to set the range before capturing so you can visually tweak it to your liking
CHECK FIRST POST FOR NEW UPDATE
Z-DEPTH ADDED
for future updates i'm planning on having the option to make the script automatically load the screenshots and all passes into photoshop with the right blending modes etc...
and maybe also the option to tweak the SSAO setting like you do with the zdepth now
other suggestions are always welcome
I could add the option to save separate passes like diffuse, spec, gloss but i wonder at what point you can still call it realtime for model presentation. For bloom i usually use xoliuls post shaders for example (which reminds me now that i don't turn them off when capturing the passes so i'll need to fix that too).
compositing the SSAO afterwards for example in my book isn't cheating since max doesn't scale this properly when you try to capture it
then again i'm not the realtime police either , people can use the script for whatever purpose
haha yeah that's a featured i really wanted to have in there right away ^^
Racer:
yeah it isn't that hard from what i've read but i was wondering what i would do when users do select multiple passes
have the script wait and ask the user to paste it each step with a continue button for the next step or only have the base screenshot copied to the clipboard
or i could have the option to paste it into the currently opened photoshop document. It all depends on what you want to do with it
is probably the most elegant solution imo.
I'm using Max 2009, and whenever I try starting the Script, it sends up an error alongside the Script with the message:
-- Unknown property: "visibility" in undefined
It also higlights the following part:
if (((maxVersion())[1] / 1000) > 10) then
m_bviewcube = ViewCubeOps.Visibility
if (((maxVersion())[1] / 1000) > 11) then
(
I'm assuming I need the Viewport Cube open to work? Because I have it disabled, so I'm curious as if that is the issue.
Thanks, I used 3DS Clean from Perna and crew, which moved those files away, so that explains it.
Also, I assume Z-Depth and SSAO aren't going to be in Max 2009, correct?
oh and since more people will be using the 3ds clean script i added an extra check so it won't crash any more. If you want to you can remove the file again and update the script
Much appreciated, although I'm curious, I never knew Max 2010+ could (inside the viewport shadings) do a Z-Depth pass, how is that possible if you don't mind me asking (is there a setting option to enable it?).
dustin: yeah that's totally true, i wasn't judging either just thinking out loud of what the script should be for.
Ace-Angel: It doesn't , i'm faking it with an omni light linked to the camera. But for that i need smooth viewportshading.
megalmn: tnx, yeah i know it isn't the fastest but it does the trick. Perhaps i could speed it up at some places so i'll also look into that
2.1 Changes:
- Now properly includes alpha masks from Xoliul, 3point shaders and standard material into the Alpha and all other passes
- Hides the World Axis icon from the viewport (max 2008 and higher only)
- Added directory selection and filename in the UI
- Saves settings to ini file and loads them the next time the script opens
no photoshop stuff yet but i wanted it doing what it's supposed to do first
Had a slight issue, accidently clicked on the undefined button to destination of images and clicked off of it, and then it came up with undefined string error. It wouldn't let me go back and define the folder for some reason.
Just re-ran the script and made sure I entered the correct destination the first time around though...
script is updated so if that happens it will save to the sceneassets/images folder instead untill you set it properly
It seems to be something non version specific and it's always something else that seems to go wrong. Are other people having trouble? Here at home i tested with 4 versions of max and they work without any trouble.
For example, does the alpha show correctly ? do you get to see white objects while it is capturing that state or do they turn black ?
Would be great if people could test this for me and tell me the right issue (check the example image in the first post of what the passes would look like ) + what max version and bit version they are using
tnx
also i have a camera thats tilted a bit on an axis, and when i use the script it resets the camera tilt before grabbing the image.
I'll check that camera bug. It probably still creates a new one instead of using the existing camera
EDIT: Also, have to mention, the Animation is a no-go, it keeps on deleting the final animation and replacing my 1 min render with a 4 second black screen. I would say a direct render of the image files is a better solution since I need to pop in my Max scene every few minutes to make sure I copy or stop manually the capture before it's finishes.
Ace: i'm going to take a look at that this weekend! added to the list tnx