BrianKitts Posted February 25, 2010 Share Posted February 25, 2010 (edited) I've gotten a couple questions about texture baking.... I just made it out from under a deadline and hope to post the full process soon, but for now I wanted to post the maxscripts that are a huge helper in the process. The following scripts assume that you are following the texture baking process outlined in the spot3d tutorial located here: http://www.spot3d.com/vray/help/150SP1/tutorials_baking_part1.htm The tutorial guides you to create shelled materials that places your newly created map in the self illumination slot of a shelled material's "baked material" slot. Problem is when taking the model into a real-time engine or Autodesk Design Review, you need to have simple standard materials with your baked material in the diffuse slot. There's two different ways to handle baked materials at this point based on what you are going to do with your scene. Script1 is if you are switching to scanline rendering and want to retain the map in the self illumination slot of a standard material. A common use for this would be to quickly render out an animation in 3dsmax using your baked materials. This can bring your frame times down from 30mins with Vray to about 15 seconds in scanline with a very similar quality level. Technically you could just render animations from the shelled materials, however you will notice that simplifying your materials will reduce your file size and for me I just like to have the scene clean and simple. for o in geometry do ( if classof o.material == Shell_Material then ( --reference original material m = o.material --create new material and set parameters newmat = StandardMaterial name: m.name newMat.diffuse = m.bakedMaterial.diffuse newMat.selfIllumMap = m.bakedMaterial.selfIllumMap newMat.useSelfIllumColor = on --replace old material with new material / turn on viewport map o.material = newMat showtexturemap o.material o.material.selfillummap on ) ) credit to Afshin Karimi, this script is based from his vraymaterial converter script http://www.scriptspot.com/3ds-max/scripts/vray-material-to-standard-material Script2 This script is intended to be run after script1 and will transfer your map out of the self-illumination slot into diffuse slot of a standard material. This would be the step required to take your model into a realtime engine, or export to DWF for viewing with Autodesk Design Review. for o in geometry do ( if o.material.selfIllumMap != undefined then ( --reference original material o.material.diffusemap = o.material.selfIllumMap o.material.selfIllumMap = undefined --showtexturemap o.material o.material.diffuseMap on ) ) Note: the last line in each script turns on the visibility of your maps in the viewport. This is a personal preference and can be omitted. Edited February 25, 2010 by BrianKitts Link to comment Share on other sites More sharing options...
cupsster Posted February 25, 2010 Share Posted February 25, 2010 Thank You Brian for this useful code snippet... Link to comment Share on other sites More sharing options...
hockley91 Posted February 25, 2010 Share Posted February 25, 2010 Excellent Brian! Very much appreciated and thank you for sharing! Link to comment Share on other sites More sharing options...
hockley91 Posted February 25, 2010 Share Posted February 25, 2010 Brian, two things are happening. The first script ran fine, but the second script did not. It's giving me this error: --unknown property: "selfillumMap" in undefined So, I manually changed one of the textures to diffuse and then I imported that .dwf into Design review and the texture maps are not UVW aligned properly. See attached photos Link to comment Share on other sites More sharing options...
BrianKitts Posted February 25, 2010 Author Share Posted February 25, 2010 check the maxscript listener, and see if it gives you a hint as to what object is causing the error. Not sure what to suggest on the mapping error as I've never had any problems with mapping when crossing over to ADR..... normally the only problem I hit is too many faces and having to go back and further optimize geometry. Link to comment Share on other sites More sharing options...
quizzy Posted February 25, 2010 Share Posted February 25, 2010 you need to make sure the dwf format supports multiple UV channels. if not try a different export format like fbx. Link to comment Share on other sites More sharing options...
hockley91 Posted February 25, 2010 Share Posted February 25, 2010 Well, I'm stumped. I tried it again this time from scratch. I did some simple boxes and grouped them all together and mapped them, and then texture baked. I applied the two scripts and brought it into Design Review and it looks fine. The UVW mapping is correct also. So, I don't know what the deal is with the other existing model I was working with. Link to comment Share on other sites More sharing options...
Koper Posted February 26, 2010 Share Posted February 26, 2010 Marking this thread as IMPORTANT Thanx BK Link to comment Share on other sites More sharing options...
jinsley Posted February 26, 2010 Share Posted February 26, 2010 I think I am doing the process slightly different... maybe because I am using mental ray? When I bake out the textures I set the full map to go to the diffuse slot, the shell material to be shown in both the render and viewport and then just export the dwf when it is done... seems to work. Here is a screen grab from the patient room I am doing for a proposal at the moment. It is a test with low res maps and not finished yet... I will post some final screens from the finished model next week and the dwf if people are interested. Link to comment Share on other sites More sharing options...
hockley91 Posted March 8, 2010 Share Posted March 8, 2010 Jinsley, looks good so far! Link to comment Share on other sites More sharing options...
jinsley Posted March 8, 2010 Share Posted March 8, 2010 Jinsley, looks good so far! THX! here is a still render from the final room... when the proposal and presentation is done, I will post the full dwf... with size limits on the dwf, what is the best way to do this? Link to comment Share on other sites More sharing options...
hockley91 Posted June 14, 2010 Share Posted June 14, 2010 Jinsley, That still render looks really good also! How did that final DWF turn out? I've had some pretty large DWF files. I did a fully baked Residence Hall exterior and site. It's around 32 mb, but originally it was around 60 mb. I had to reduce texture sizes. If they are too large...say over 2,000 pixels width, then the DWF exporter kinda of compresses them automatically and strange results can occur... Link to comment Share on other sites More sharing options...
jinsley Posted June 14, 2010 Share Posted June 14, 2010 The final turned out great... wasn't the fastest to load, but everyone was very happy with it. I think the final was around 15mb... I never noticed whether the maps were being compressed... I noticed that the dwf displays differently depending on the machine and video card though... the same model on 3 computers can look very different as far as the textures go. I would love to do a full site. Definitely have that planned for down the road... that would be a killer presentation. Link to comment Share on other sites More sharing options...
hockley91 Posted August 5, 2010 Share Posted August 5, 2010 I'm having so much trouble converting a shelled material to a standard material. When I texture bake, the shell material is leaving the "original material" and the "baked material". I tried the conversion scripts and can't get the shell material to transfer over to the standard. I modified the script so it changes them all to standard, but the textures are not present. It all goes to default materials colors. The original and baked texture maps are both diffuse, but it won't transfer the baked diffuse over the standard diffuse. Any ideas? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now