Archiv der Kategorie: 3D

Erst mal nur 3Ds Max…

Ändern der Texturtypen

Mit diesem Script lassen sich die Textur-Endungen ändern. Z.B. von tif nach tga. Werden die alten Texturen nicht entfernt „Condense Material Editor“ verwenden.

Download: jb_change_textureExtension

texExtChg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
macroScript ExtensionChange
category:"jb_scripts"
ButtonText:"TexExtensionChange"
Tooltip:"TexExtensionChange" 
(--macro begins
local TexExtensionChange
(
 
	fn GetBitmapTextures theObjects =
	(
		texMaps = #()
		for obj in theObjects do
		(
			join texMaps (getClassInstances bitmapTexture target:obj asTrackViewPick:off)
		)
		makeUniqueArray texMaps
	)
	texMaps = (GetBitmapTextures objects)
 
	fn changeOutExt inExt outExt =
	(
	for texMap in texMaps do (
		objName = getFilenameFile texMap.filename
 
		-- remove the point in string
		inExt = trimleft inExt "."
		outExt = trimleft outExt "."
 
		-- add a point and change the extension
		inex = "."+inExt
		if getFilenameType texMap.filename == inex do texMap.filename = (objName + "." + outExt)
	)
)
)
 
rollout TexExtensionChange "Tex Extension Change" 
(			 
	label lbl1 "Change Texture Extension" pos:[10,6] width:193 height:20
	editText edt1 "from" pos:[11,27] width:90 height:20
	editText edt2 "to" pos:[115,27] width:90 height:20
 
	button btn1 "Change" pos:[219,27] width:130 height:20
	 on btn1 pressed do (
		  with undo on
			(
			changeOutExt edt1.text edt2.text
			)
		)
	button btn2 "Condense Material Editor" pos:[219,54] width:130 height:20
	 on btn2 pressed do (
		  with undo on
			(
				defaultMtlLibFile = MeditUtilities.getDefaultLibraryFile()
				if defaultMtlLibFile != undefined do
					(
						defaultMtlLib = loadTempMaterialLibrary defaultMtlLibFile
						usedMtls = #()
						for i in 1 to meditMaterials.count do
							(
								if MeditUtilities.isMaterialInUse meditMaterials[i] == true do
								append usedMtls meditMaterials[i]
							)
							global _meditMaterialsBeforeReset = #()
							for i in 1 to meditMaterials.count do
								(
									append _meditMaterialsBeforeReset meditMaterials[i]
									if i <= usedMtls.count then
									meditMaterials[i] = usedMtls[i]
									else if i <= defaultMtlLib.count then
									meditMaterials[i] = defaultMtlLib[i]
									else
									meditMaterials[i] = defaultMtlLib[defaultMtlLib.count]
								)
					)				
			)
		)	
	)
	 createDialog TexExtensionChange 356 80
)--macro end

Objekt-Abmessungen in Viewport anzeigen

Mit diesem Script lassen sich die Abmessungen selektierter Objekte anzeigen.
Das Script ist als Button definiert, wenn es per drag&drop in 3Ds Max gezogen wurde ist es zu finden unter Customize User Interface / Kategorie: jb_scripts.

Download: jb_scripts-OBJDimension

jb_objDimension

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
Get Object Dimension from jb_alvarado | 2013 | www.pixelcrusher.de
no Copyright restriction 
use it at your on risk
 
Tested in 3ds Max 2013/2014
 
This Script get the dimension from selection and draw this in the current screen.
For the best use copy it in the scripts folder, then drag and drop it in the 3ds max screen, after that go to:
Customize/Customize User Interface/Toolbars/Category/jb_scripts/Live Dimension in Viewport
and drag this in your Toolbar.
*/
 
macroScript OBJDimension
category:"jb_scripts"
tooltip:"Live Dimension in Viewport"
buttonText:"Dimension"
(
    global GW_displayObjectNames
    on isChecked return ::drawInViewportEnabled
    on execute do (
        if ::drawInViewportEnabled != true and ::drawInViewportEnabled != false do ::drawInViewportEnabled = false
        ::drawInViewportEnabled = not ::drawInViewportEnabled
        if ::drawInViewportEnabled then (            
            unregisterRedrawViewsCallback GW_displayObjectNames
            fn GW_displayObjectNames = (
                    if ( selection.count == 1 ) then (
                        if ( superclassof selection[1] == shape ) then (
                            local shapeLength = " | Shapes Length: " + ( units.formatValue ( curveLength selection[1] ) as string )
                            ) else (
                                local shapeLength = ""
                                )
                                
                        bound = nodeGetBoundingBox selection[1] selection[1].transform
                        dim = ( bound[2] - bound[1] )
 
                        local objX = ( units.formatValue dim.x as string )
                        local objY = ( units.formatValue dim.y as string )
                        local objZ = ( units.formatValue dim.z as string )
                        
                        if selection[1].name.count > 16 then (
                            selName = "[" + ( substring selection[1].name 1 16 ) + ".]"
                            ) else (
                                selName = "[" + selection[1].name + ".]"
                                )
    
                        gw.wText [14,33,0] ("Dimension From " + selName + ":  X: " + objX + " | Y: " + objY + " | Z: " + objZ + shapeLength) color: ( color 229 204 25 )
                        ) else if ( selection.count > 1 ) then (
                            local objMin = selection.min
                            local objMax = selection.max
                            local objX = ( units.formatValue ( objMax.x - objMin.x ) as string )
                            local objY = ( units.formatValue ( objMax.y - objMin.y ) as string )
                            local objZ = ( units.formatValue ( objMax.z - objMin.z ) as string )
                            gw.wText [14,33,0] ("Dimension From Selection:  X: " + objX + " | Y: " + objY + " | Z: " + objZ ) color: ( color 229 204 25 )
                            )
                gw.enlargeUpdateRect #whole
                )
            registerRedrawViewsCallback GW_displayObjectNames
        ) else    (
            shapeLength = undefined
            objMin = undefined
            objMax = undefined
            objX = undefined
            objY = undefined
            objZ = undefined
            unRegisterRedrawViewsCallback GW_displayObjectNames
            forceCompleteRedraw()
            )
        )        
)

Multiple Import

Viele Dateien gleichzeitig importieren zu müssen kann ziemlich mühsam sein. Daher bietet es sich an, das über ein Script zu machen. Da es auch sein kann, dass Objektnamen gleich sind und dadurch der Importvorgang gestoppt wird, kann man zusätzlich noch die Objekte automatisch umbenennen lassen:

1
2
3
4
5
6
7
8
files = getFiles "D:\\Pfad\\zu\\files\\*.ext"
 
for f in files do (
	importFile f #noPrompt
	actionMan.executeAction 0 "40021"  -- Selection: Select All
	for i in selection do i.name = uniquename "filename_"
	clearSelection()
	)

imf_disp konfigurieren

Findet das Tool imf_disp (von NVIDIA/mental images), welches mit dem Renderer mental ray geliefert wird, öfters Verwendung, kann man es recht komfortabel einrichten.
Wenn das Tool als Standard- Viewer diverser Formate eingerichtet ist, erhält man einen Eintrag in der Registry. Z.B. unter:

1
HKEY_CLASSES_ROOT\Applications\imf_disp.exe\shell\open\command\

Dieser Eintrag kann nun erweitern werden:

1
2
"C:\cmdtools\imf_disp.exe" -g 2.2 --width=1280 --height=808 --x_pos=310 --y_pos=120 
--frame_rate=25 --on_image_load=zoom_image "%1"

-g 2.2, gibt den Standard- Gamma an
–width=1280, gibt die Fenstergröße an
–height=808, ist für die Fensterhöhe
–x_pos=310, gibt die Fensterposition in X-Richtung am Bildschirm an
–y_pos=120, gibt die Fensterposition in Y-Richtung am Bildschirm an
–frame_rate=25, definiert die Framerate
–on_image_load=zoom_image, gibt an, dass das Bild auf Fenstergröße gezoom werden soll

Weitere Infos darüber findet man auch unter:
Autodesk Help – imf_disp

.map (Memory mapped Textur) in mental ray

mr Phenomenon zum Laden von .map Texturen:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
min version "3.4.7.5"
max version "3.10.99"
 
 
declare phenomenon
	color "Tex_HQ-Filtering" (
		color texture	"texture",
		scalar			"eccmax",
		scalar			"maxminor",
		scalar			"disc_r",
		boolean			"bilinear",
		boolean			"mirror_x",
		boolean			"mirror_y",
		vector			"repeat",
		vector			"offset",
		integer		"space",
 
	struct "g" {
        scalar  "gamma"        default 1.0, #: min 0  softmax 5.0
        scalar  "gain"         default 1.0, #: min 0  softmax 5.0
        boolean "reverse"      default off
		},
 
	)
 
	shader "coord" "mib_texture_vector" (
		"select"	0,
		"selspace"	0,
		"vertex"	0,
		"project"	2
	)
	shader "remap" "mib_texture_remap" (
		"input"		= "coord",
		"repeat"	= interface "repeat",
		"alt_x"		= interface "mirror_x",
		"alt_y"		= interface "mirror_y",
		"offset"	= interface "offset"
	)
	shader "tex" "mib_texture_filter_lookup" (
		"tex"		= interface "texture",
		"coord"		= "remap",
		"remap"		 "remap",
		"eccmax"	= interface "eccmax",
		"maxminor"	= interface "maxminor",
		"bilinear"	= interface "bilinear",
		"space"	= interface "space",
 
	)
 
	shader "gamma" "mip_gamma_gain" (
		"input"   	= "tex",
        "gamma"  	= interface "g.gamma",       
        "gain"  	= interface "g.gain",        
        "reverse" 	= interface "g.reverse"	
	)
 
 
	root = "gamma"
	apply texture
 
 
		gui "gui_Tex_HQ-Filtering" {
				control "Global" "Global" (
				"uiName" "Tex_HQ-Filtering",
				"category" "Texture" 
				)		
 
		control "eccmax"	"scalar" (
			"uiName" "eccmax",
			"value"	20.0
			)
 
		control "maxminor"	"scalar" (
			"uiName" "maxminor",
			"value"	6.0
			)
 
		control "disc_r"	"scalar" (
			"uiName" "disc_r",
			"value"	0.3
			)	
 
		control "repeat"	"vector" (
			"uiName" "repeat",
			"value"	1.0 1.0 1.0
			)	
		control "space"	"integer" (
			"uiName" "space",
			"value"	1
			)		
 
		control "g" "struct" (
			"uiName" "Gamma Control"
			)
		{
 
		control "gamma"	"scalar" (
			"uiName" "gamma",
			"value"	1.0
			)
 
		control "gain"	"scalar" (
			"uiName" "gain",
			"value"	1.0
			)	
 
		control "reverse"	"boolean" (
			"uiName" "reverse",
			"value"	off
			)
 
		}	
	}
end declare

Pelt Mapping

Pelt Mapping ist ein praktisches Verfahren um auf organischen Objekten Texturkoordinaten zu vergeben. Jedoch eignet es sich auch sehr gut um auf technischen Objekten 2D-Koordinaten zu platzieren. Nachfolgend seht ihr einen Ansatz wie man dabei vorgehen kann.


Pelt Mapping