Skip to content

Instantly share code, notes, and snippets.

@esemwy
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save esemwy/48e75096d75b2118f031 to your computer and use it in GitHub Desktop.

Select an option

Save esemwy/48e75096d75b2118f031 to your computer and use it in GitHub Desktop.
Set IOR of Iray Surface
// DAZ Studio version 4.8.0.55 filetype DAZ Script
materials = {
"Acetone": {
"start": 1.36
},
"Acrylic glass": {
"start": 1.49,
"stop": 1.492
},
"Actinolite": {
"start": 1.618
},
"Agalmatoite": {
"start": 1.55
},
"Agate": {
"start": 1.544,
"stop": 1.553
},
"Agate, Moss": {
"start": 1.54
},
"Air": {
"start": 1.0
},
"Alcohol": {
"start": 1.329
},
"Alcohol, Ethyl (grain)": {
"start": 1.36
},
"Alcohol, Methyl (wood)": {
"start": 1.329
},
"Alexandrite": {
"start": 1.746,
"stop": 1.755
},
"Almandine": {
"start": 1.75,
"stop": 1.83
},
"Aluminum": {
"start": 1.244
},
"Aluminum Chloride": {
"start": 2.7
},
"Aluminum Oxide": {
"start": 1.665
},
"Amber": {
"start": 1.539,
"stop": 1.546
},
"Amblygonite": {
"start": 1.611
},
"Amethyst": {
"start": 1.532,
"stop": 1.554
},
"Ammolite": {
"start": 1.52,
"stop": 1.68
},
"Amorphous Selenium": {
"start": 2.92
},
"Anatase": {
"start": 2.49
},
"Andalusite": {
"start": 1.629,
"stop": 1.65
},
"Anhydrite": {
"start": 1.571
},
"Apatite": {
"start": 1.42,
"stop": 1.632
},
"Apophyllite": {
"start": 1.536
},
"Aquamarine": {
"start": 1.567,
"stop": 1.59
},
"Aragonite": {
"start": 1.53
},
"Argon": {
"start": 1.0
},
"Argonite": {
"start": 1.53
},
"Asphalt": {
"start": 1.635
},
"Augelite": {
"start": 1.574
},
"Axenite": {
"start": 1.674,
"stop": 1.704
},
"Axinite": {
"start": 1.675
},
"Azurite": {
"start": 1.73
},
"Barite": {
"start": 1.636
},
"Barytocalcite": {
"start": 1.684
},
"Beer": {
"start": 1.345
},
"Benitoite": {
"start": 1.757
},
"Benzene": {
"start": 1.501
},
"Beryl": {
"start": 1.57,
"stop": 1.6
},
"Beryl, Red": {
"start": 1.57,
"stop": 1.598
},
"Beryllonite": {
"start": 1.553
},
"Borax": {
"start": 1.446
},
"Brazilianite": {
"start": 1.603
},
"Bromine (liquid)": {
"start": 1.661
},
"Bronze": {
"start": 1.18
},
"Brownite": {
"start": 1.567
},
"Calcite": {
"start": 1.486
},
"Calspar": {
"start": 1.486,
"stop": 1.66
},
"Cancrinite": {
"start": 1.491
},
"Carbon Disulfide": {
"start": 1.628,
"stop": 1.63
},
"Carbon Tetrachloride": {
"start": 1.46
},
"Carbon dioxide": {
"start": 1.0
},
"Carbonated Beverages": {
"start": 1.34,
"stop": 1.356
},
"Cassiterite": {
"start": 1.997
},
"Celestite": {
"start": 1.622
},
"Cerussite": {
"start": 1.804
},
"Ceylanite": {
"start": 1.77
},
"Chalcedony": {
"start": 1.544,
"stop": 1.553
},
"Chalk": {
"start": 1.51
},
"Chalybite": {
"start": 1.63
},
"Chlorine (gas)": {
"start": 1.001
},
"Chlorine (liquid)": {
"start": 1.385
},
"Chrome Green": {
"start": 2.4
},
"Chrome Red": {
"start": 2.42
},
"Chrome Tourmaline": {
"start": 1.61,
"stop": 1.64
},
"Chrome Yellow": {
"start": 2.31
},
"Chromium": {
"start": 2.97
},
"Chromium Oxide": {
"start": 2.705
},
"Chrysoberyl": {
"start": 1.745
},
"Chrysocolla": {
"start": 1.5
},
"Chrysoprase": {
"start": 1.534
},
"Cinnabar (Mercury sulfide)": {
"start": 3.02
},
"Citrine": {
"start": 1.532,
"stop": 1.554
},
"Cleaner (all purpose - orange)": {
"start": 1.293
},
"Clinohumite": {
"start": 1.625,
"stop": 1.675
},
"Clinozoisite": {
"start": 1.724
},
"Cobalt Blue": {
"start": 1.74
},
"Cobalt Green": {
"start": 1.97
},
"Cobalt Violet": {
"start": 1.71
},
"Colemanite": {
"start": 1.586
},
"Copper": {
"start": 1.1,
"stop": 2.43
},
"Copper Oxide": {
"start": 2.705
},
"Coral": {
"start": 1.486,
"stop": 1.658
},
"Cordierite": {
"start": 1.54
},
"Corundum": {
"start": 1.766
},
"Cranberry Juice (25%)": {
"start": 1.351
},
"Crocoite": {
"start": 2.31
},
"Cromite": {
"start": 2.16
},
"Crown Glass": {
"start": 1.52
},
"Crown glass (impure)": {
"start": 1.485,
"stop": 1.755
},
"Crown glass (pure)": {
"start": 1.5,
"stop": 1.54
},
"Cryolite": {
"start": 1.338
},
"Crysoberyl, Catseye": {
"start": 1.746,
"stop": 1.755
},
"Crystal": {
"start": 2.0
},
"Cubic zirconia": {
"start": 2.15,
"stop": 2.18
},
"Cuprite": {
"start": 2.85
},
"Danburite": {
"start": 1.627,
"stop": 1.641
},
"Diamond": {
"start": 2.418
},
"Diopside": {
"start": 1.68
},
"Dolomite": {
"start": 1.503
},
"Dumortierite": {
"start": 1.686
},
"Ebonite": {
"start": 1.66
},
"Ekanite": {
"start": 1.6
},
"Elaeolite": {
"start": 1.532
},
"Emerald": {
"start": 1.56,
"stop": 1.605
},
"Emerald Catseye": {
"start": 1.56,
"stop": 1.605
},
"Emerald, Synth flux": {
"start": 1.561
},
"Emerald, Synth hydro": {
"start": 1.568
},
"Enstatite": {
"start": 1.663
},
"Epidote": {
"start": 1.733
},
"Ethanol": {
"start": 1.36
},
"Ethyl Alcohol": {
"start": 1.36
},
"Euclase": {
"start": 1.652
},
"Eye, Aqueous humor": {
"start": 1.33
},
"Eye, Cornea": {
"start": 1.38
},
"Eye, Lens": {
"start": 1.41
},
"Eye, Vitreous humor": {
"start": 1.34
},
"Fabulite": {
"start": 2.409
},
"Feldspar, Adventurine": {
"start": 1.532
},
"Feldspar, Albite": {
"start": 1.525
},
"Feldspar, Amazonite": {
"start": 1.525
},
"Feldspar, Labradorite": {
"start": 1.565
},
"Feldspar, Microcline": {
"start": 1.525
},
"Feldspar, Oligoclase": {
"start": 1.539
},
"Feldspar, Orthoclase": {
"start": 1.525
},
"Flint glass (impure)": {
"start": 1.523,
"stop": 1.925
},
"Flint glass (pure)": {
"start": 1.6,
"stop": 1.62
},
"Flourite": {
"start": 1.433
},
"Fluoride": {
"start": 1.56
},
"Fluorite": {
"start": 1.434
},
"Formica": {
"start": 1.47
},
"Fused Quartz": {
"start": 1.46
},
"Gallium(III) arsenide": {
"start": 3.927
},
"Gallium(III) phosphide": {
"start": 3.5
},
"Garnet, Almandine": {
"start": 1.76
},
"Garnet, Almandite": {
"start": 1.79
},
"Garnet, Andradite": {
"start": 1.82
},
"Garnet, Demantiod": {
"start": 1.88,
"stop": 1.9
},
"Garnet, Grossular": {
"start": 1.72,
"stop": 1.8
},
"Garnet, Hessonite": {
"start": 1.745
},
"Garnet, Mandarin": {
"start": 1.79,
"stop": 1.8
},
"Garnet, Pyrope": {
"start": 1.73,
"stop": 1.76
},
"Garnet, Rhodolite": {
"start": 1.74,
"stop": 1.77
},
"Garnet, Spessartite": {
"start": 1.81
},
"Garnet, Tsavorite": {
"start": 1.739,
"stop": 1.744
},
"Garnet, Uvarovite": {
"start": 1.74,
"stop": 1.87
},
"Gaylussite": {
"start": 1.517
},
"Glass": {
"start": 1.5
},
"Glass, Albite": {
"start": 1.489
},
"Glass, Arsenic Trisulfide": {
"start": 2.04
},
"Glass, Crown": {
"start": 1.52
},
"Glass, Crown, Zinc": {
"start": 1.517
},
"Glass, Flint, 29% lead": {
"start": 1.569
},
"Glass, Flint, 55% lead": {
"start": 1.669
},
"Glass, Flint, 71% lead": {
"start": 1.805
},
"Glass, Flint, Dense": {
"start": 1.66
},
"Glass, Flint, Heaviest": {
"start": 1.89
},
"Glass, Flint, Heavy": {
"start": 1.655
},
"Glass, Flint, Lanthanum": {
"start": 1.8
},
"Glass, Flint, Light": {
"start": 1.58
},
"Glass, Flint, Medium": {
"start": 1.627
},
"Glass, Fused Silica": {
"start": 1.459
},
"Glass, Pyrex": {
"start": 1.474
},
"Glycerine": {
"start": 1.473
},
"Glycerol": {
"start": 1.473
},
"Gold": {
"start": 0.47
},
"Gypsium": {
"start": 1.519
},
"Hambergite": {
"start": 1.559
},
"Hauyn": {
"start": 1.49,
"stop": 1.505
},
"Hauynite": {
"start": 1.502
},
"Heaviest Flint Glass": {
"start": 1.89
},
"Heavy Flint Glass": {
"start": 1.65
},
"Helium": {
"start": 1.0
},
"Hematite": {
"start": 2.94
},
"Hemimorphite": {
"start": 1.614
},
"Hiddenite": {
"start": 1.655
},
"Honey, 13% water content": {
"start": 1.504
},
"Honey, 17% water content": {
"start": 1.494
},
"Honey, 21% water content": {
"start": 1.484
},
"Howlite": {
"start": 1.586
},
"Hydrogen (gas)": {
"start": 1.0
},
"Hydrogen (liquid)": {
"start": 1.097
},
"Hypersthene": {
"start": 1.67
},
"Ice": {
"start": 1.309
},
"Idocrase": {
"start": 1.713
},
"Iodine Crystal": {
"start": 3.34
},
"Iolite": {
"start": 1.522,
"stop": 1.578
},
"Iron": {
"start": 2.95
},
"Ivory": {
"start": 1.54
},
"Jade, Jadeite": {
"start": 1.64,
"stop": 1.667
},
"Jade, Nephrite": {
"start": 1.6,
"stop": 1.641
},
"Jadeite": {
"start": 1.665
},
"Jasper": {
"start": 1.54
},
"Jet": {
"start": 1.66
},
"Kornerupine": {
"start": 1.665
},
"Kunzite": {
"start": 1.66,
"stop": 1.676
},
"Kyanite": {
"start": 1.715
},
"Labradorite": {
"start": 1.56,
"stop": 1.572
},
"Lapis Gem": {
"start": 1.5
},
"Lapis Lazuli": {
"start": 1.5,
"stop": 1.55
},
"Lazulite": {
"start": 1.615
},
"Lead": {
"start": 2.01
},
"Lead Nitrate": {
"start": 1.782
},
"Leucite": {
"start": 1.509
},
"Light Flint Glass": {
"start": 1.575
},
"Liquid Carbon Dioxide": {
"start": 1.2
},
"Liquid Water (20deg C)": {
"start": 1.333
},
"Lucite": {
"start": 1.495
},
"Magnesite": {
"start": 1.515
},
"Malachite": {
"start": 1.655
},
"Meerschaum": {
"start": 1.53
},
"Mercury (liquid)": {
"start": 1.62
},
"Methanol": {
"start": 1.329
},
"Milk": {
"start": 1.35
},
"Moissanite": {
"start": 2.65,
"stop": 2.69
},
"Moldavite": {
"start": 1.5
},
"Moonstone": {
"start": 1.518,
"stop": 1.526
},
"Moonstone, Adularia": {
"start": 1.525
},
"Moonstone, Albite": {
"start": 1.535
},
"Morganite": {
"start": 1.585,
"stop": 1.594
},
"Mylar": {
"start": 1.65
},
"Natrolite": {
"start": 1.48
},
"Nephrite": {
"start": 1.6
},
"Nickel": {
"start": 1.08
},
"Nitrogen (gas)": {
"start": 1.0
},
"Nitrogen (liq)": {
"start": 1.205
},
"Nylon": {
"start": 1.53
},
"Obsidian": {
"start": 1.489,
"stop": 1.5
},
"Oil of Wintergreen": {
"start": 1.536
},
"Oil, Clove": {
"start": 1.535
},
"Oil, Lemon": {
"start": 1.481
},
"Oil, Neroli": {
"start": 1.482
},
"Oil, Orange": {
"start": 1.473
},
"Oil, Safflower": {
"start": 1.466
},
"Oil, vegetable (50deg C)": {
"start": 1.47
},
"Olivine": {
"start": 1.67
},
"Onyx": {
"start": 1.486
},
"Onyx Marble": {
"start": 1.486
},
"Opal": {
"start": 1.45
},
"Opal, Black": {
"start": 1.44,
"stop": 1.46
},
"Opal, Fire": {
"start": 1.43,
"stop": 1.46
},
"Opal, White": {
"start": 1.44,
"stop": 1.46
},
"Oregon Sunstone": {
"start": 1.56,
"stop": 1.572
},
"Oxygen (gas)": {
"start": 1.0
},
"Oxygen (liquid)": {
"start": 1.221
},
"PET": {
"start": 1.575
},
"PETg": {
"start": 1.57
},
"PMMA": {
"start": 1.489,
"stop": 1.49
},
"Padparadja": {
"start": 1.76,
"stop": 1.773
},
"Painite": {
"start": 1.787
},
"Pearl": {
"start": 1.53,
"stop": 1.69
},
"Periclase": {
"start": 1.74
},
"Peristerite": {
"start": 1.525
},
"Petalite": {
"start": 1.502
},
"Phenakite": {
"start": 1.65
},
"Phosgenite": {
"start": 2.117
},
"Plastic": {
"start": 1.46
},
"Platinum": {
"start": 2.33
},
"Plexiglas": {
"start": 1.5
},
"Polycarbonate": {
"start": 1.584
},
"Polystyrene": {
"start": 1.55
},
"Prase": {
"start": 1.54
},
"Prasiolite": {
"start": 1.54
},
"Prehnite": {
"start": 1.61
},
"Proustite": {
"start": 2.79
},
"Purpurite": {
"start": 1.84
},
"Pyrite": {
"start": 1.81
},
"Pyrope": {
"start": 1.74
},
"Quartz": {
"start": 1.544,
"stop": 1.644
},
"Quartz, Fused": {
"start": 1.458
},
"Rhodizite": {
"start": 1.69
},
"Rhodochrisite": {
"start": 1.6
},
"Rhodonite": {
"start": 1.735
},
"Rock salt": {
"start": 1.516,
"stop": 1.544
},
"Rubber, Natural": {
"start": 1.519
},
"Ruby": {
"start": 1.757,
"stop": 1.779
},
"Rum, White": {
"start": 1.361
},
"Rutile": {
"start": 2.62
},
"Salt (NaCl)": {
"start": 1.544
},
"Sanidine": {
"start": 1.522
},
"Sapphire": {
"start": 1.757,
"stop": 1.779
},
"Sapphire, Star": {
"start": 1.76,
"stop": 1.773
},
"Scapolite": {
"start": 1.54
},
"Scapolite, Yellow": {
"start": 1.555
},
"Scheelite": {
"start": 1.92
},
"Selenium, Amorphous": {
"start": 2.92
},
"Serpentine": {
"start": 1.56
},
"Shampoo": {
"start": 1.362
},
"Shell": {
"start": 1.53
},
"Shower gell": {
"start": 1.51
},
"Silicon": {
"start": 4.01,
"stop": 4.24
},
"Sillimanite": {
"start": 1.658
},
"Silver": {
"start": 0.18,
"stop": 1.35
},
"Sinhalite": {
"start": 1.699
},
"Smaragdite": {
"start": 1.608
},
"Smithsonite": {
"start": 1.621
},
"Sodalite": {
"start": 1.483
},
"Sodium Chloride": {
"start": 1.544,
"stop": 1.644
},
"Spessarite": {
"start": 1.79,
"stop": 1.81
},
"Sphalerite": {
"start": 2.368
},
"Sphene": {
"start": 1.885
},
"Spinel": {
"start": 1.712,
"stop": 1.717
},
"Spinel, Blue": {
"start": 1.712,
"stop": 1.747
},
"Spinel, Red": {
"start": 1.708,
"stop": 1.735
},
"Spodumene": {
"start": 1.65
},
"Star Ruby": {
"start": 1.76,
"stop": 1.773
},
"Staurolite": {
"start": 1.739
},
"Steatite": {
"start": 1.539
},
"Steel": {
"start": 2.5
},
"Stichtite": {
"start": 1.52
},
"Strontium Titanate": {
"start": 2.41
},
"Styrene": {
"start": 1.519
},
"Styrofoam": {
"start": 1.595
},
"Sugar Solution 30%": {
"start": 1.38
},
"Sugar Solution 80%": {
"start": 1.49
},
"Sulphur": {
"start": 1.96
},
"Synthetic Spinel": {
"start": 1.73
},
"Taaffeite": {
"start": 1.72
},
"Tantalite": {
"start": 2.24
},
"Tanzanite": {
"start": 1.692,
"stop": 1.7
},
"Teflon": {
"start": 1.35,
"stop": 1.38
},
"Thomsonite": {
"start": 1.53
},
"Tiger eye": {
"start": 1.544
},
"Tin Iodide": {
"start": 2.106
},
"Titanium": {
"start": 2.16
},
"Topaz": {
"start": 1.607,
"stop": 1.627
},
"Topaz, Blue": {
"start": 1.61
},
"Topaz, Imperial": {
"start": 1.605,
"stop": 1.64
},
"Topaz, Pink": {
"start": 1.62
},
"Topaz, White": {
"start": 1.63
},
"Topaz, Yellow": {
"start": 1.62
},
"Tourmaline": {
"start": 1.603,
"stop": 1.655
},
"Tourmaline, Blue": {
"start": 1.61,
"stop": 1.64
},
"Tourmaline, Catseye": {
"start": 1.61,
"stop": 1.64
},
"Tourmaline, Green": {
"start": 1.61,
"stop": 1.64
},
"Tourmaline, Paraiba": {
"start": 1.61,
"stop": 1.65
},
"Tourmaline, Red": {
"start": 1.61,
"stop": 1.64
},
"Tremolite": {
"start": 1.6
},
"Tugtupite": {
"start": 1.496
},
"Turpentine": {
"start": 1.472
},
"Turquoise": {
"start": 1.61,
"stop": 1.65
},
"Ulexite": {
"start": 1.49
},
"Uvarovite": {
"start": 1.87
},
"Vacuum": {
"start": 1.0
},
"Variscite": {
"start": 1.55
},
"Vivianite": {
"start": 1.58
},
"Vodka": {
"start": 1.363
},
"Wardite": {
"start": 1.59
},
"Water (0deg C)": {
"start": 1.333
},
"Water (100deg C)": {
"start": 1.318
},
"Water (20deg C)": {
"start": 1.333
},
"Water (35deg C)": {
"start": 1.325
},
"Water (gas)": {
"start": 1.0
},
"Water Ice": {
"start": 1.31
},
"Whisky": {
"start": 1.356
},
"Wulfenite": {
"start": 2.3
},
"Zinc Crown Glass": {
"start": 1.517
},
"Zincite": {
"start": 2.01
},
"Zircon": {
"start": 1.777,
"stop": 1.987
},
"Zircon, High": {
"start": 1.96
},
"Zircon, Low": {
"start": 1.8
},
"Zirconia, Cubic": {
"start": 2.173,
"stop": 2.21
}
};
var wDlg = new DzBasicDialog;
wDlg.caption = "My DzBasicDialog";
wDlg.whatsThis = "This is the \"What\'s This?\" text for the dialog.";
// Create a label
var wLbl = new DzLabel( wDlg );
wLbl.text = "This is a DzLabel.";
wLbl.whatsThis = "This is the \"What\'s This?\" text for the label.";
wDlg.addWidget( wLbl );
var wCbFiSu = new DzComboBox( wDlg );
for (var key in materials) {
if (materials.hasOwnProperty(key)) {
wCbFiSu.insertItem(key);
}
}
var current = "";
for (current in materials) {
if (materials.hasOwnProperty(current)) {
break;
}
}
wCbFiSu.currentItem = current;
wDlg.addWidget(wCbFiSu)
// Limit the dialog size to the minimum required size
wDlg.maxWidth = wDlg.minWidth;
wDlg.maxHeight = wDlg.minHeight;
// Launch the dialog and do something depending on the button pressed
if( wDlg.exec() )
{
var i = 0;
for (var k in materials) {
print(i + " " + wCbFiSu.currentItem + " " + k);
if (materials.hasOwnProperty(k)) {
if (i == wCbFiSu.currentItem) {
var o = materials[k];
var b = k;
break;
}
i++;
}
}
var skel = Scene.getPrimarySelection();
if ( skel ) {
if ( skel.inherits( "DzBone" ) ) {
skel = skel.getSkeleton();
}
if ( skel.inherits( "DzNode") ) {
var obj = skel.getObject();
// var shp = obj.getCurrentShape();
var numShapes = obj.getNumShapes();
for ( var i = 0; i < numShapes; i++ ) {
var shp = obj.getShape(i);
var numMats = shp.getNumMaterials();
for ( var i = 0; i < numMats; i++ ) {
var curMat = shp.getMaterial( i );
if ( curMat && curMat.isSelected() ) {
var matName = curMat.getMaterialName();
var ior = curMat.findProperty("Refraction Index");
if (ior) {
var iorVal = ior.getValue();
ior.setValue(o.start);
}
else {
var ior = curMat.findProperty("Index of Refraction");
if (ior) {
var iorVal = ior.getValue();
ior.setValue(o.start);
}
}
}
}
}
}
else if ( skel.inherits( "DzSkeleton" ) ) {
nodelist = [skel];
var nNodes = nodelist.length;
for( var i = 0; i < nNodes; i++ ) {
var obj = nodelist[i].getObject();
var shp = obj.getCurrentShape();
var numMats = shp.getNumMaterials();
for ( var i = 0; i < numMats; i++ ) {
var curMat = shp.getMaterial( i );
if ( curMat && curMat.isSelected() ) {
var matName = curMat.getMaterialName();
if (matName == "Iray Uber") {
var ior = curMat.findProperty("Refraction Index");
if (ior) {
var iorVal = ior.getValue();
ior.setValue(o.start);
}
}
}
}
}
}
}
var message = "";
if (o.hasOwnProperty("stop")) {
message = b + " " + o.start + " " + o.stop;
}
else {
message = b + " " + o.start;
}
MessageBox.information( message, "Information", "&OK" );
}
else
{
MessageBox.information( "Dialog rejected.", "Information", "&OK" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment