It is currently Sun May 05, 2024 10:49 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 17 posts ] 
Author Message
 Post subject: Is a Dark2Height Script Possible?
PostPosted: Mon Jul 29, 2013 11:35 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
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


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Tue Jul 30, 2013 12:54 am  (#2) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Alan I took your black image
Image
and inverted the color
Image
is this an easier way to do it (it would work viseversa)

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Tue Jul 30, 2013 9:13 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
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


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Tue Jul 30, 2013 10:46 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
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

Attachment:
File comment: xcf file with layers.
Dark2HeightTrails.xcf [1.14 MiB]
Downloaded 143 times


Pegli


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Sun Dec 29, 2013 5:02 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
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


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Mon Dec 30, 2013 2:16 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
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>

_________________
Image
Fantasy Cartography and Mapping by RobA


Last edited by RobA on Wed Jan 01, 2014 2:48 pm, edited 1 time in total.

Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Mon Dec 30, 2013 4:59 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
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


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Mon Dec 30, 2013 8:10 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
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


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Tue Dec 31, 2013 9:02 am  (#9) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
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>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Tue Dec 31, 2013 1:47 pm  (#10) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
Nice one, RobA!

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

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Tue Dec 31, 2013 1:51 pm  (#11) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
I really like that look PegLeg44.

_________________
Image


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Wed Jan 01, 2014 2:51 pm  (#12) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
OK - Here is the update - Happy New Year!

Attachment:
offsetvalueheight.scm [3.58 KiB]
Downloaded 174 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>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Wed Jan 01, 2014 7:44 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12520
Pretty cool script Rob; with an existing 3D depth map, it makes this animation possible. :)


Attachments:
6009.gif
6009.gif [ 291.7 KiB | Viewed 1311 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Wed Jan 01, 2014 8:47 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
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


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Wed Jan 01, 2014 9:32 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Looks really good Pegleg. :)
Thanks for sharing the filter Rob.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Thu Jan 02, 2014 5:46 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 591
Would you, please, explain us how the script works? I'm lost.

_________________
Image


Top
 Post subject: Re: Is a Dark2Height Script Possible?
PostPosted: Thu Jan 02, 2014 5:51 am  (#17) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
Way cool PegLeg44

_________________
Image


Top
Post new topic Reply to topic  [ 17 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Looking for Script Coder to make Script of my VHS effect

2

No new posts Attachment(s) A liitle Start Help with a Script-Fu Script

3

No new posts Attachment(s) Cannot run test script-fu script via console

7

No new posts Attachment(s) Script-fu

6

No new posts Attachment(s) Rotate Hue Script

74



* Login  



Powered by phpBB3 © phpBB Group