Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Is a Dark2Height Script Possible?

Mon Jul 29, 2013 11:35 pm

I've been trying to figure out a way to duplicate the Light2Height script manually in a way that might be able to be done as a script. One of these samples below is an actual light to height script and the other is my manual method. If you look very close they are both the exact same even the pixelation lines that are created.

Image

Basically what Light2Height does is duplicate the image in layers and offset them incrimentally accourding to the dialog input. And then the layers are masked incrimentally from top to bottom.

I have duplicated the results but I use a white background and dark pixels creating the shape to be transformed. In other words I have done it in a Dark to Height type of a fassion.

Here's how I did it:

1. Take the image (One canvas layer with white background) and duplicate it.
2. Offset the Duplicated layer.
3. Continued this proccess 16 more times.

4.Then on the top layer stack I did an [Add Layer Mask] using [Greyscale copy of layer].
5. Then inverted the layer mask.
6. Then I applied a [Threshold] filter on the mask using the iterations from high to low. The top layer in the stack was 240, and then the rest on down the stack were, 224, 208, 192, 176, 160, 144, 128, 112, 96, 80, 64, 48, 32.

I think that all these operations may be able to work as a script if anybody wants to try it. soulgoode did a script similar to this one for me called Height-Bevel. It works really good.

This process would be good as a script if there was a way to calculate the iterations and use the numbers on the amount of layers, and the threshold. Also being able to determine the direction of offset would make it better than Light2Height.

Alan

Re: Is a Dark2Height Script Possible?

Tue Jul 30, 2013 12:54 am

Alan I took your black image
Image
and inverted the color
Image
is this an easier way to do it (it would work viseversa)

Re: Is a Dark2Height Script Possible?

Tue Jul 30, 2013 9:13 am

Hi Graechan

I have my gimp set up with a shortcut to invert the layer. I simply press [I]. I think this would work as a new script if someone wanted to try it. I have found a problem with what I had said in my first post and noticed that it would need a little more code to duplicate the original.

I was thinking when I went to bed last night that the Light2Height script also makes a kind of trailing band of pixels behind the high contrast areas of the image. If you were to use the Light 2 Height on an image that has a hard white line for example it would give you a trailing bevel so to speak in the final image like this:

Image

I think this could be achieved by not only dropping the bottom out using the masks on each of the generated layers but you would also have to plateau the tops of each canvas layer by putting the same number incriments in the input and output fields of the level dialog box like this:

Image

And to make this trailing bevel appear even in the unmasked areas of the various images the layers would have to be set to darken only mode.

pegli

Re: Is a Dark2Height Script Possible?

Tue Jul 30, 2013 10:46 am

I have attached an xcf layered file to this post. This is what it looks like:

Image

I've created 16 plateau layers with masks. Plateaus were created using levels with identical input and output levels. Also the layers have maskes to drop out the outside or bottoms. I found that a [Darken Only Mode] doesn't have to be applied to the layers. Normal mode works. Here is a list of the levels and threashold for the masks per 16 layers:

Levels on Canvas - Threashold on Masks
1. 0- 240
2. 16- 224
3. 32- 208
4. 48- 192
5. 64- 176
6. 80- 160
7. 96- 144
8. 112- 128
9. 128- 112
10. 144- 96
11. 160- 80
12. 176- 64
13. 192- 48
14. 208- 32
15. 224- 16
16. 240- 0

Dark2HeightTrails.xcf
xcf file with layers.
(1.14 MiB) Downloaded 144 times


Pegli

Re: Is a Dark2Height Script Possible?

Sun Dec 29, 2013 5:02 pm

Here's what Light2Height does.

Image

It makes a layer copy, offsets it and incrementally chops off the top and the bottom as many times as is specified in the dialog box. So if you think about the lightness of the pixel as height and you chop it up and move each slice over this is whats happening with the image. Offsetting in different directions would be cool.

Image

I think the bottom could be chopped off by making a mask with the image, using threshold on it, and inverting it. I think it's scriptable.

Pegleg

Re: Is a Dark2Height Script Possible?

Mon Dec 30, 2013 2:16 pm

Hey PegLeg!

I'm still not 100% sure what the plugin does (as I don't have it) but based on the examples, I'm hoping the attached might be what you are looking for...

Attachment deleted - see later post for new version

It shows up under Filters->Distorts->Heightfield Offset by Value

Using a value of x=0 and y=-62 I got results similar to your attached example.

-Rob A>

Re: Is a Dark2Height Script Possible?

Mon Dec 30, 2013 4:59 pm

RobA wrote:Hey PegLeg!

I'm still not 100% sure what the plugin does (as I don't have it) but based on the examples, I'm hoping the attached might be what you are looking for...

It shows up under Filters->Distorts->Heightfield Offset by Value

Using a value of x=0 and y=-62 I got results similar to your attached example.

-Rob A>


Wow works just as good as the Light2Height script but its multi-directional. This is AWSOME!

Thanks RobA

Image

I wish it was doing its work on dark pixels instead of light but all I have to do is invert the colors before using it.

I can see using this a lot. I wish I could make scripts, but it would take me two years or more to learn the basics and I'm more interested in other things.

Pegleg

Re: Is a Dark2Height Script Possible?

Mon Dec 30, 2013 8:10 pm

I found that the image I use the script on has to contain all the colors of the spectrum from white to black. If it doesn't have white then the result is just a white screen. So sometimes I need to use the [Color] [Auto] [Stretch Contrast].

This image was white text on black with a little airbrushing with black on the white letters before running the script. Since the script nudges the whiter areas a little more you can get weird effects on things.

Image

Pegleg

Re: Is a Dark2Height Script Possible?

Tue Dec 31, 2013 9:02 am

PegLeg44 wrote:I found that the image I use the script on has to contain all the colors of the spectrum from white to black. If it doesn't have white then the result is just a white screen. So sometimes I need to use the [Color] [Auto] [Stretch Contrast].
Pegleg


I realized that last night as I was lying in bed!

I've already thought of the fix and will add a toggle to make it work inverted.

-RobA>

Re: Is a Dark2Height Script Possible?

Tue Dec 31, 2013 1:47 pm

Nice one, RobA!

When complete, I'd like to put this on up on GIMP Scripts, if that's ok.

Re: Is a Dark2Height Script Possible?

Tue Dec 31, 2013 1:51 pm

I really like that look PegLeg44.

Re: Is a Dark2Height Script Possible?

Wed Jan 01, 2014 2:51 pm

OK - Here is the update - Happy New Year!

offsetvalueheight.scm
(3.58 KiB) Downloaded 176 times


I also fixed a commented out line that was leaving the temp images around taking up memory...

@Tux - No problem to put it on Gimp Scripts.

-Rob A>

Re: Is a Dark2Height Script Possible?

Wed Jan 01, 2014 7:44 pm

Pretty cool script Rob; with an existing 3D depth map, it makes this animation possible. :)

Re: Is a Dark2Height Script Possible?

Wed Jan 01, 2014 8:47 pm

I used the script and it works great. Being able to invert the results are really nice. I was looking at the text of the script and it's amazing that such a small amount of script can do this. It's like a different realm of scripting. I don't understand any of it.

I plan on using this script to generate side perspectives of my height map images that I make. I'll use the script then use the Emboss filter then change the size of the width or height and colorize it like below.

Image

Image

Pegleg

Re: Is a Dark2Height Script Possible?

Wed Jan 01, 2014 9:32 pm

Looks really good Pegleg. :)
Thanks for sharing the filter Rob.

Re: Is a Dark2Height Script Possible?

Thu Jan 02, 2014 5:46 am

Would you, please, explain us how the script works? I'm lost.

Re: Is a Dark2Height Script Possible?

Thu Jan 02, 2014 5:51 am

Way cool PegLeg44
Post a reply