Sg2.9
Mosaic Staple Raster
Recent RSS
Creator:  Håkan Lundgren
Date:  24. March 2010, 17:11

Create isometric mosaic rasters with height value from the pixels grayscale value.

* UPDATE Feb 20, 2012 *
I've rewritten my script and added some new features. Feeling lazy tonight so visit my blog (shameless self-promotion!) for info on how it works. Just make sure you have an image selected before you press the 'Render' button.

Oh, and to avoid confusion; the new script is the one below called Isometric Block Raster.

Re: Re:Mosaic
From:  Tobias A
Date:  30. September 2011, 02:01

If I wanted to reverse the height (black is low, white is high), how would I go about doing that?

Re: Re:Mosaic
Date:  30. September 2011, 16:40

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...?

Re: Re:Mosaic
From:  Tobias A
Date:  3. October 2011, 14:22

Tack, ska testa det.

Re: Re:Mosaic
From:  eltibur0n
Date:  15. November 2011, 11:47

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

Re: Re:Mosaic
Date:  20. February 2012, 23:51

Maybe it's frowned upon but this is just a comment to push this topic into the 'Post List' to let you all know I have re-worked my script and also included some new stuff...

The plague be on me!

Re: Re:Mosaic
From:  Tobias A.
Date:  21. February 2012, 01:34

Fine by me ^_-

Re: Re:Mosaic
From:  Zed
Date:  24. February 2012, 17:00

Me too, and congrats on the new version, looking great!

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19