PDA

View Full Version : Contour map gray resolution



santhony94107
06-13-2007, 05:30 PM
For the last 16 years I've been re-writing for Windows a vector drawing program that I originally wrote for the Amiga (called ArtExpression). One of the features is a "blend" function that blends shapes, fill colors, line colors, etc. Using this blend function I have been creating contour maps for carving archtop guitar tops and backs (actually only half at one time because of the limited width of the machine).

My question is, is the depth of the cut based on values between 0 (Black) and 255 (white), or based on the RGB value of the color. If the latter, this could result in 768 sort-of gray levels rather than just 256. Like (128, 128, 128) would be a medium gray and (129, 128, 128) would be slightly "redder" and lighter, (129, 129, 128) again lighter, etc.

I'm trying to eliminate or reduce the "stair stepping" in the illustrations below:

http://www.santhony.com/ggrms/top-right-stairstepping.jpg

This carving was based on this bmp file imported into designer:

http://www.santhony.com/ggrms/TopLeft256_4.bmp

benluz
06-13-2007, 05:38 PM
For the last 16 years I've been re-writing for Windows a vector drawing program that I originally wrote for the Amiga (called ArtExpression). One of the features is a "blend" function that blends shapes, fill colors, line colors, etc. Using this blend function I have been creating contour maps for carving archtop guitar tops and backs (actually only half at one time because of the limited width of the machine).

My question is, is the depth of the cut based on values between 0 (Black) and 255 (white), or based on the RGB value of the color. If the latter, this could result in 768 sort-of gray levels rather than just 256. Like (128, 128, 128) would be a medium gray and (129, 128, 128) would be slightly "redder" and lighter, (129, 129, 128) again lighter, etc.

I'm trying to eliminate or reduce the "stair stepping" in the illustrations below:

http://www.santhony.com/ggrms/top-right-stairstepping.jpg

This carving was based on this bmp file imported into designer:

http://www.santhony.com/ggrms/TopLeft256_4.bmp

do you have a scanner it has the ptn editor and you can see the gradient in the editor and it does not have the lines that you can see in your bmp file.The gradient is a smooth transition and carves the same way,yours is just reproducing the stepped effect that is visible in the bmp.
Ben

santhony94107
06-13-2007, 05:46 PM
I did not quite understand what you were saying about the scanner???

What I was asking was if the depth of the cut is limited to 256 steps, or if I alter the software I have written to produce 768 steps, would the carving be smoother?

benluz
06-13-2007, 05:58 PM
In the Scanner editor, we can see the grayscale gradient as you are showing in your BMP image,and you were asking about the stepping effect.I was just saying when viewing.... say a vectorart ptn the gradient has a very smooth transition where in your bmp you can see the stepping effect in the file ,so of course it would carve with a stepped effect.I would think the 768 step would be smoother.I guess what I'm trying to say ,is if the eye can see the stepping as I see in the bmp then the machine will pick it up as well.When we carve a curved surface that is designed by vector art or from designer, the curve is smooth ,I'm not sure what software they use to create their patterns ,but they are very crisp and clean and the grayscale gradients have no visible step lines.i hope this helps.
Ben

santhony94107
06-13-2007, 06:03 PM
Thanks Ben. I'll try creating a 768 step bitmap and see if that smooths things out some. I don't have the probe scanner or the editor, so I can't really see what you mean.

benluz
06-13-2007, 06:06 PM
Here is a section of a rifle stock scan in png format you can open it with most graphics program or use paint.net which is a free download, just do a search on google.In this scan you can get an idea of the gradient you need to get a smooth surface.
Ben


the center of this scan is maybe 3/4" deep where the rifle barrel sets into the forearm portion of the stock.This should give you an idea of what you need.Let me know how it works out
good luck !

benluz
06-13-2007, 06:17 PM
I just caught the Amiga part of your post ...that was commodores hi-end machine back in the day ...I think ? I still have my commodore 64 and my pong game...lol Now I'm showing my age !
Ben

liquidguitars
06-13-2007, 09:45 PM
For the last 16 years I've been re-writing for Windows a vector drawing program that I originally wrote for the Amiga (called ArtExpression).

Denise and Paula are in my thoughts....

LG

pastime106
06-13-2007, 10:07 PM
In photoshop PS2 there is a tool called "blur tool" I copied your file to my hard drive and then played with it for a little while. I was able to to remove some of the stepping (on the screen view anyway) Might help, might not. To be honest the stepping that was left over in the original looks a lot easier to get rid of then the old caliper and pray method I have used in the past.

Regards,
Tom

Jon Jantz
06-13-2007, 10:20 PM
Was gonna suggest the Gaussion blur as well. I use that to effectively remove a lot of the steps that occur with some of my Coreldraw creations also...

liquidguitars
06-14-2007, 12:27 AM
I think it's better to change the image map file from index to RGB and then inport into designer as a 24 bit after bluring.

LG

santhony94107
06-25-2007, 03:13 PM
I use PaintShop Pro (have used it since version 1) which has a "blur" function as well. I used blur->color averaging and almost all the steps disappeared. The remaining ones were so inconsequential that they sanded out very easily.

Thanks for all the suggestions.

Scott Anthony

Gman_Ind
06-25-2007, 03:28 PM
The designer does use the 256 heights, I believe more shades will just result in a smoother transition, If he can export up to 1024 shades it should be very smooth even thought designer is using 256 of the colors. and without secondary work. IMHO

liquidguitars
06-25-2007, 04:43 PM
This is my feeling two, designer works way better in 24 bit
Some early software did not like 24 bit images for bump mapping as it was more than needed, Designer can read color 0
In an 8 bit image but also reads 32 alpha, thus will remove the background square without manually raising or lowering the z value.

LG

cycollins
06-29-2007, 08:07 PM
...but there may be a way to ameliorate the stair-stepping effect. BTW I'm an Amiga user of old myself, so that makes us part of an arcane brotherhood. Years ago at Electronic Arts, I worked on the 3DO game platform (also developed by Jay Miner of Amiga fame). For obscure reasons, I needed a way of smoothly interpolating 16 shades of gray across a quad (256X256), with one 4-bit value at each corner. I won't go into all the details of how it worked, but the key idea was to use a noise function to distribute the values, so that it appeared to be smoothly interpolated. I don't mean to be negative, but I don't think the blurring filter will help you very much, unless you're not already making good use of the 256-value space (i.e. normalizing your height-field from 0-255). Your source image is already smooth. Bluring will only change your contours and ultimately the whole thing will only be re-sampled at 8-bits per pixel anyway. Here's one alternative: when you create your height-map from your theoretical contours, create it as a 2D array of 32-bit unsigned values. I'm sure 16-bit values would be sufficient but just for good measure try 32-bit first. Write this image out in a format that allows 32-bit grays (I think TIFF can support this, PGM does but be careful of endian-ness and D3D texture formats are easy to write and support 32-bit grays). Then read this into Photoshop (which recognizes the above formats - can't say about Paint Shop Pro - one of my favorite apps but I haven't used it in years, since I toil for Adobe now). You should see a nice smooth image - no stair stepping. Now use the "Image" menu and under "Mode" you will see an option to reduce the bit-depth of your gray-scale image. Choose 8-bit and you will be presented with a dialog, giving you options for what kind of dithering you want to use produce an 8-bit image. It doesn't matter too much which one you choose, so you should experiment, but initially, you should just try the default which is "Exposure and Gamma" with default values. You will probably see no appreciable difference in your image, but if you zoom in very far, you will see noisy combinations of 8-bit gray-scale values, making up the surface of your guitar-back. You can now save this object as an 8-bit grayscale BMP file. Your aliasing is still there, but its influence is spread out stocastically over the surface of your object. When you go to carve the object, that noise will be lost in the grain of the wood and other small inaccuracies that creep into these kinds of physical processes. When you sand the object, it will be gone forever. I've included a processed version of your gutar-back image with this post, so you can see the quality of the output (I actually just stepped up the sample size on your example, did a "surface blur" and then followed the above procedure to get the final version). It has some artifacts due to the way I made it, but the gross stair-stepping is gone, while the image remains 8-bit. You can download the example from (I can't get the attachment thing to work)

http://www.woodenyou.com/cycollins/guitar_back2.bmp

I hope this works for you (because actually I have this problem too - I just thought of this technique on-the-fly and I'm interested in trying it out as well). If you have any questions, you can PM me and we can talk.

Best of luck,
Cycollins

liquidguitars
06-29-2007, 08:44 PM
I got to meet Jay Miner of Amiga fame and shake his hand. He was getting on up in age and in a wheel chair.

It’s one of my proud moments of computers. I wonder if he had an idea
how his game con changed the world.

Still not sure about designer only using 256 as designer handles and blends the PTN so well.. mesh or Voxel...

stocastically is my new cool word for the day!
LG

Reset
06-29-2007, 09:44 PM
...but there may be a way to ameliorate the stair-stepping effect. BTW I'm an Amiga user of old myself, so that makes us part of an arcane brotherhood. Years ago at Electronic Arts, I worked on the 3DO game platform (also developed by Jay Miner of Amiga fame). For obscure reasons, I needed a way of smoothly interpolating 16 shades of gray across a quad (256X256), with one 4-bit value at each corner. I won't go into all the details of how it worked, but the key idea was to use a noise function to distribute the values, so that it appeared to be smoothly interpolated. I don't mean to be negative, but I don't think the blurring filter will help you very much, unless you're not already making good use of the 256-value space (i.e. normalizing your height-field from 0-255). Your source image is already smooth. Bluring will only change your contours and ultimately the whole thing will only be re-sampled at 8-bits per pixel anyway. Here's one alternative: when you create your height-map from your theoretical contours, create it as a 2D array of 32-bit unsigned values. I'm sure 16-bit values would be sufficient but just for good measure try 32-bit first. Write this image out in a format that allows 32-bit grays (I think TIFF can support this, PGM does but be careful of endian-ness and D3D texture formats are easy to write and support 32-bit grays). Then read this into Photoshop (which recognizes the above formats - can't say about Paint Shop Pro - one of my favorite apps but I haven't used it in years, since I toil for Adobe now). You should see a nice smooth image - no stair stepping. Now use the "Image" menu and under "Mode" you will see an option to reduce the bit-depth of your gray-scale image. Choose 8-bit and you will be presented with a dialog, giving you options for what kind of dithering you want to use produce an 8-bit image. It doesn't matter too much which one you choose, so you should experiment, but initially, you should just try the default which is "Exposure and Gamma" with default values. You will probably see no appreciable difference in your image, but if you zoom in very far, you will see noisy combinations of 8-bit gray-scale values, making up the surface of your guitar-back. You can now save this object as an 8-bit grayscale BMP file. Your aliasing is still there, but its influence is spread out stocastically over the surface of your object. When you go to carve the object, that noise will be lost in the grain of the wood and other small inaccuracies that creep into these kinds of physical processes. When you sand the object, it will be gone forever. I've included a processed version of your gutar-back image with this post, so you can see the quality of the output (I actually just stepped up the sample size on your example, did a "surface blur" and then followed the above procedure to get the final version). It has some artifacts due to the way I made it, but the gross stair-stepping is gone, while the image remains 8-bit. You can download the example from (I can't get the attachment thing to work)

http://www.woodenyou.com/cycollins/guitar_back2.bmp

I hope this works for you (because actually I have this problem too - I just thought of this technique on-the-fly and I'm interested in trying it out as well). If you have any questions, you can PM me and we can talk.

Best of luck,
Cycollins

What'd he say? lol :D

Kenm810
06-30-2007, 05:21 AM
In short, -- He knows more about computers and graphics then I ever will. http://www.carvewright.com/forum/images/smilies/icon_razz.gif

mtylerfl
06-30-2007, 12:23 PM
Hello Cycollins,

Could you clarify a few things?...there are a few terms that I've not heard of before...

1) "Here's one alternative: when you create your height-map from your theoretical contours, create it as a 2D array of 32-bit unsigned values."
How does one do that? I'm not familiar with the term and/or function of "unsigned values".

2) "...already making good use of the 256-value space (i.e. normalizing your height-field from 0-255)"
Could you explain how a typical user normalizes the height-field in popular graphics software programs such as CorelPaint, PhotoImpact, PhotoShop.

3) "Write this image out in a format that allows 32-bit grays (I think TIFF can support this, PGM does but be careful of endian-ness and D3D texture formats are easy to write and support 32-bit grays).
I'm not familiar with the term "write this image out" - do you mean convert the image data in some fashion, or use a "Save As" to save the file in a .tif format while specifying options for that save? Also not familiar with the term "endian-ness"

Thanks in advance for your help.

liquidguitars
06-30-2007, 12:47 PM
create it as a 2D array of 32-bit unsigned values. I'm sure 16-bit values would be sufficient but just for good measure try 32-bit first.

mtylerfl,

Buy create I think he is saying "render" as to centered around 8,24 and 32 bit depth 3D rendering programs. Color space is still inportant to 2D. regarding the guitar image, I was able to change santhony94107 8 bit arch top image and smooth in 24 bit removing the stair stepping in photshop, typ a 10 min job, BTW I find the scaner software can help out my images a bit 2.



LG

cycollins
06-30-2007, 01:20 PM
I wasn't trying to be obtuse. Usually, I try to tailor my answers to the asker. The originator of this thread was santhony94107, who identified himself as a programmer, working on a rewrite of an old Amiga application. I was using short-hand for someone who was in the midst of a problem space that I know pretty well.

The idea is simple - make your patterns, using the highest precision (bit-depth) possible, then use a good image processing application like Photoshop to scale back down to 8-bit grayscale (the format used by the CW machine). Photoshop will use a collection of the mid-tone grays at every level in a noisy, probability-based pattern to simulate the grays that are missing between "steps" of the 8-bit gray-scale color space. This noisy stuff will have at least the superficial effect of breaking up the stair-stepping phenomenon, which nerdy folks like me call aliasing. ("noise" to geeks like me means "randomness", not ugly sound.)

The tricky bit is getting the data into Photoshop if it didn't originate there (which in the case of santhony, it didn't). Santhony's data was generated by a program he was writing, so he needs to write it out in a file format that Photoshop can read in, without dropping it down to eight-bit grayscale. Grayscale images with more than eight bits of precision are a relatively recent development, and there are only a few file formats that have any way of expressing them - that's why all the talk about TIFF and DX texture formats, etc. I was trying to suggest some easy file formats I knew about that he could use in writing out his data, because .bmp (the format he had his example pattern in) won't do it. TIFF, PGM and a few others will. The other stuff about "endianness" was just geeky heads-up about the pit-falls of trading binary data between computers with different microprocessors.

While I was writing all of that however, I realized I should be doing the same thing for the figural art projects I'm doing, at least when they're bigger than a candle-stick.

Cycollins

DocWheeler
06-30-2007, 01:28 PM
Cy,
You don't have to appologize, it made me feel good that I actually understood about 10% of what you were saying:)

mtylerfl
06-30-2007, 02:04 PM
Hello Cy,

No apology necessary of course, as you were directly responding to a fellow programmer with terms especially suited to the topic at hand in your original post.

Thank you for your excellent explanation. Your most recent post used terminology that even I understand!

Thanks again -

santhony94107
07-19-2007, 05:53 PM
Thanks Cy for the info and suggestions. My machine has been on a round-trip to Texas for a couple of weeks, and I haven't visited the forum for quite awhile. The last pair of back pieces I carved for a new guitar order (a tenor archtop, my 30th instrument) worked out really nicely just by blurring the stair-stepped image that I had originally used. It required very little sanding to eliminate any traces of the carving process.

By the way, Collins Guitars are really, really nice. Do you use the CarveWright for backs and tops too, or for parts like the tailpieces?

KHP
10-02-2007, 02:29 AM
When importing from Illustrator to Photoshop using a high DPI setting (600dpi at least) will make the gradients VERY smooth, no more need to use blur. I am using 1200dpi at the moment which takes a long time but gives very smooth contours indeed.