Create isometric mosaic rasters with height value from the pixels grayscale value.
Hehehe, looking at this code now I realize how much I have learned over the past year and a half since I wrote it. This was my second attempt at scripting with Sg. Well, maybe I haven't gotten THAT far but I do see some stuff that could be significantly improved.
Perhaps I should rewrite the whole thing as the options are very obscure as to how the work. Could be fun...
Well, to answer your question, just change (should be on line 94, I think)
hVal = color.gray * heightVal;
into
hVal = (1 - color.gray) * heightVal;
That should do the trick. It really does make the whole thing look a lot better. Wonder why I didn't make this default...?
Yep, i should rewrite the whole thing too:
Add following Line:
variationVal: { type: 'number', label: 'Variation Value', },
var items = {
scanInput: { type: 'number', label: 'Square Value', },
heightVal: { type: 'number', label: 'Staple Height', units: 'point' },
widthVal: { type: 'number', label: 'Staple Width', units: 'point' },
here -->
render: { type: 'button', value: 'Render',
- -------------------------------------------------------------------------------------
Change following Line:
initRaster(values.scanInput, values.heightVal, values.widthVal);}
in:
initRaster(values.variationVal, values.scanInput, values.heightVal, values.widthVal);}
- -------------------------------------------------------------------------------------
Change following Line:
function initRaster(scanInput, heightVal, widthVal) {
in:
function initRaster(variationVal, scanInput, heightVal, widthVal) {
- -------------------------------------------------------------------------------------
Change following Line:
hVal = color.gray * heightVal;
in:
if(variationVal <= 0) {
hVal = color.gray * heightVal;
} else {
hVal = (variationVal - color.gray) * heightVal;
};
- -------------------------------------------------------------------------------------
finished. ;)
Now you can change variation as you want. Negative values changed in 0, and this is the default of programmers version.
Number 1 in variation is "Håkan Lundgren's" last version of script.
feel free, and thank you