Archive for the ‘Scripts’ Category

Dotnet+Maxscript+GDI

I have been learning and using dot-net in 3ds max a lot recently. I think its time i show some of my learnings in Dot-net GDI . Here is an example of using a dot-net label as progress bar with GDI. I tried to replicate the look of pre-max9 polygon counter as asked in tech-artist.org forum(here).

(
global _dupPolyCounter
try (destroyDialog _dupPolyCounter) catch()

rollout _dupPolyCounter "Duplicate Polycounter" width:250
(
	local _min = 100,_max =200
	group "Progress Test"
	(
		label _bdgt "Budget:" pos:[20,25]
		spinner spn_max "" pos:[65,25] range:[100,1000,_max] width:55 type:#integer
		label _crnt "Current:" pos:[140,25]
		spinner spn_val "" pos:[185,25] range:[1,spn_max.value,_min] width:55 type:#integer
		dotnetcontrol lbl "label" height:10 width:200 pos:[25,50]
	)
	local acolor = dotnetclass "system.drawing.color"
	
	mapped fn dispose gdiobj =
		(
			gdiobj.Dispose
		)
	on lbl Paint args do
	(
		local margin = 2
		graphics = args.graphics
		width = ((lbl.clientRectangle.width)/40)
		_val = ((float(_min)/_max)*40)
		X = lbl.clientRectangle.X+margin
		Y = lbl.clientRectangle.Y+margin
		for i = 1 to _val do
		(			
			rect = dotnetobject "System.Drawing.Rectangle" X Y (width-1) (lbl.clientRectangle.Height-2*margin)
			_col = acolor.green
			if i > 35  then _col = acolor.red else (if i>27 then _col = acolor.yellow else _col = acolor.green)
			foreBrush=dotnetobject "System.Drawing.SolidBrush" _col
			graphics.FillRectangle foreBrush rect
			X += width
			dispose #(foreBrush)
		)
	)
	on spn_val changed val do
	(
		_min = val
		lbl.invalidate()
	)
	on spn_max changed val do
	(
		_max = val
		spn_val.range = [1,spn_max.value,_min]
		lbl.invalidate()
	)
 	on _dupPolyCounter open do
	(
		lbl.backColor = lbl.backColor.Black
	) 
)

createDialog _dupPolyCounter
)

I hope to post more snippets in future..

Self-Promotional Plug Alert!

The NormalMap Widget Script that i had created has been added to polycount wiki. Thanks EricChadwick for adding it. I have also added some decent images to the post.

Read it here – http://wiki.polycount.com/wiki/Normal_map#Pre-Created_Templates

Scripts release(Select Non-Planar and Broken Wall Creator)..

Lately i have got some request for the Broken Wall Creator script, so finally got time to make it releasable. It has got some bugs so please bare with it and comment here if found any. Use only the top view to create the broken wall because of some bugs.
Someone on Tech-Artist.org wanted a script to select non planar faces. I had a script that was written a while back so thought of releasing it as well.
Please download the scripts from
Broken Wall Creator
Select Non-Planar Faces

Installation Instructions for Select Non-Planar Faces
————————-
* Drag and Drop Select_NPR.mzp in to 3dsMax viewport.
* From the Customize User Interface menu option you can now assign Select_NPR to a Toolbar. The command is located in the “Akira Scripts” Category.

NormalMap Widget for 3ds Max

Been busy learning to create forms using dotnet in maxscript. Earlier today stumble across Steev “kobra” Kelly’s tutorial for easily creating normal map details in 3ds max and use photoshop to add it to a base map. So thought of writing a script for quick normal map renders based on the tutorial.

Steps for usage:
1. Run the Script :D. Find it in Customize User Interface->Toolsbar->Catogery->Akira’s Scripts-> NormalWidget
[singlepic id=17 w=128 h=96 float=]
2. Select the Highpoly and hit setup.
[singlepic id=18 w=128 h=96 float=]
3. Scale the highpoly to fit the template plane.
[singlepic id=19 w=128 h=96 float=]
4. Hit render and save the image.
[singlepic id=20 w=128 h=96 float=]
5. Use it to add details in the base map. Idle to create a library of normal maps for using across objects like nuts,bolts,cracks,etc.

[singlepic id=21 w=128 h=96 float=]

6.Enjoy.

Hopefully will include render size options in the next update. Suggestion are welcome.

DOWNLOAD:
NormalMapWidget
NormalMapWidget(Mirror Link)

MentalRay Utility Gamma Adder..

This script was written for a friend who had a scene with 150 textures and wanted to add Utility Gamma & Gain(MI) for every diffuse texture. Thought this might be useful for MentalRay users out there.

Features:
– Adds Mental ray Gamma and gain utility to the diffuse map channel, only if a bitmap texture exists.
– Currently adds only for Arch and Design,Standard Material and Multi Material in the diffuse map channel.

Download Link:
http://www.scriptspot.com/3ds-max/mentalray-utility-gamma-adder

Broken Wall Generator..

Here is a little maxscript inspired from Gunnar Radeloff’s demo reel(here). It generates a broken wall from an interactively drawn curve or a existing shape. Options to control wall width, no. of columns, brick width, height and length. Will be adding more features in future.

NeoAxis Map Exporter Tutorial

Hello again,

I have made a video tutorial on how to use the map exporter that i have written for 3ds Max to NeoAxis. This is my first tutorial so bare with me……..

Thanks for watch……

Download High Quality video Tutorial

Download

Neo Axis Map Exporter for 3ds Max.

I started doing some R&D on NeoAxis engine sometime ago. I was having problem setting up level in side the editor so wrote a script to export the map file and Highmaterial file. I use ogremax exporter for exporting all the meshes in the scene.
This is my first script posted here. Many more to come….

Current Features:
— Exports all the Material in the scene to highmaterial file
— Exports static geometry object’s PRS to Map file

Expected Features in future:
— Layer support and export lights
— Full Highmaterial support(currently only diffuse and lightmap are exported)

Instructions :

1. In case your materials are not named properly, give the material name and press Rename Material
2. Specify Mesh reference folder i.e the folder in which u place ur mesh files e.g Maps\Test\StaticGeometry\ or Models\Temp\
3. Press .. for selecting the folder to export highmaterials.
4. Export the Map and enjoy..

Note:

1. Instanced objects should have the same name.
2. Lightmap should be baked to glossiness target slot with UV channel no 2
3. Meshes and the textures should be placed in the folder specified in Mesh Ref.

Download Link:
NeoAxis Map Exporter – 3ds Max 2009 & 2008
NeoAxis Map Exporter – 3ds Max 9

Return top