Jump to content

How to make a realistic Golf Ball.


MJW
 Share

Recommended Posts

This tutorial is available as a PDF. Click here to View or Download.

 

This tutorial shows how to render a golf ball similar to my Object of the Fortnight entry.

 

As usual, I didn't write down the steps when I made my OOTF entry, so I can't reproduce it exactly. Also, the method used in the tutorial to produce the dimple HM is completely changed from the original method, and I believe, better. First, because I think the dimples are better looking; second, because the method allows more variations, such as different dimple sizes and different smoothing; and third, because it produces a tiled height map that can be used at any size, for any sized object.

 

Another difference is that in this tutorial I only shade the ball with a single light. In my entry I slightly shaded the ball two more times with light from different directions in order to add some detail in the shadows, which otherwise were just gray, with no visible dimples. One light was from almost straight above (I needed to justify the position of the drop shadow somehow!), the other from almost straight below (like reflected light from a table). This can be done simply by duplicating the golf ball height map in other layers, using the Texture Shader to shade with the Directional light in a different position (and no Ambient light), then combining the layers using the Add blending mode.

 

There are other differences between the tutorial version and my OOTF entry because I always apply "post-processing" image adjustments to my OOTF entries, such as tweaking the brightness and contrast, sharpening, and similar things that seem outside the scope of this tutorial. And, of course, the OOTF entry has a drop shadow, which was produced by blurring and adjusting the transparency of a black ellipse.

 

Here is the image the tutorial will generate:

 

Golf-Ball-Demo-Shaded.png

 

 

 

THE TUTORIAL

 

(The blue text is explanatory and can be ignored if the only goal is to produce the image. Perhaps it would be best to follow the procedure exactly first, then read the blue comments to understand the reasoning behind it.)

 

Plugins used: Texture Shader, Texture Merger, Texture Scaler, Texture Smoother.

 

I used the same basic method I described in my Texture Merger comments, just with a different texture map: dimples instead of a grid. Pixey made an excellent video showing the basic procedure in an easy-to-follow manner.

 

The tutorial requires a sphere height map. This is a 512x512 sphere height map that I've used a million times. There's no reason to generate one from scratch -- just use this one:

 

Sphere_Transp_BGRA.png

 

There are three phases to creating the golf ball image: making the dimple height map, making the golf ball height map, and shading the golf ball height map. The last two phases rely on the results of the previous phases. I suggest saving the dimple height map and the golf ball height map, though it isn't necessary. If you save them, you can close Paint.NET and resume the next phase later. That might be less intimidating than trying to complete the entire tutorial in one session. The results at the end of each phase can be compared to my version.

 

Because the plugins used have so many controls, I generally list only the controls that aren't at their default settings. However, I list controls which should be returned to their default settings if they were at a non-default setting in the previous step.

 

I put all the copy-to-clipboard steps in bold text, since it's very important but easy to forget.

 

MAKING THE DIMPLE HEIGHT MAP

 

Create a new image with the dimensions with a width of 362 and a height of 209.

The image will be white. Invert the color to make it black.

 

Why such an unusual size? I want the width of the canvas to be the square root of three times the height. It turns out that 362/209 is an excellent approximation of the square root of three, with better than five-place accuracy. The error will be a small fraction of a pixel. If you need a larger, more precise map, 989/571 is an even better approximation.


Copy the sphere height map to the clipboard.

 

Run the  Texture Merger with the listed controls changed from their defaults:

  • Clipboard Image Size: 0.42
  • Height Merge Method: Maximum
  • Clipboard Height Offset: -0.5
  • Antialias: Checked

 

Let me explain the goal. I want to do two things: Reduce the size of the spherical height map relative to the canvas, and reduce the slope at the boundary. This accomplishes both at once. The sphere (really, half-sphere) is moved away from the eye-point. The section of the sphere that goes below zero is clamped to zero, which in the height map is black. Therefore, all except the cap that remains above zero disappears:

Sphere-Offset-Illustration.png

As for the slope, the slope is very large at the boundary of a half sphere. That doesn't work especially well for a golf ball dimple. Even when the height is scaled down, the profile is not ideal. The slope at the edge of the spherical cap is much smaller, producing a better dimple shape.

 

Run the Texture Scaler plugin with the default settings.

 

I believe it's best to have this height map scaled to the full range, which is what the Texture Scaler with the default settings does. One advantage is that if the method for producing the dimple HM is modified, scaling it to the same height will result in fewer changes to the later steps. Another advantage is that the Texture Merger's Clipboard Height Curvature control works better when applied to height maps that cover most or all of the full height range.

 

Now there's a single dimple in the center of the canvas, surrounded by black. The next steps will make it into a height map that when tiled will have the dimples arranged as the centers of a hexagonal grid.

 

Copy the image to the clipboard.

 

Run the  Texture Merger.

  • Clipboard Image: Tiled
  • Clipboard Image Size: 1.0 (restored to default)
  • Clipboard Image Offset: 0.5, 0.5
  • Height Merge Method: Maximum (unchanged)
  • Clipboard Height Offset: 0.0 (restored to default)
  • Antialias: Checked (unchanged)

 

The result should look like this:

 

Dimple-Hex-Unsmoothed-Pattern.png

 

When used with the Tiled image mode of the Texture Merger, this will produce the desired hexagonal dimple pattern. However the edges of the dimples will be too sharp for a golf ball. They need to be rounded and smoothed. The smoothing is done withe the Texture Smoother, but care must be taken to avoid smoothing near the edge of the canvas, which will not yield the desired result. The solution is to temporarily increase the image size, so the region of interest is away from the canvas edge.

 

Copy the new image to the clipboard.

 

Run the Canvas Size command.

  • Height: 562
  • Width: 409
  • Anchor: Middle

 

The exact size doesn't really matter, but it must be large enough that the area that will be in the final dimple HM is away from the edge of the canvas, and an even amount must be added to the height and width so that the middle area remains centered, and not off by a pixel. A hundred pixels on each side works well.

 

Run the  Texture Merger.

  • Clipboard Image: Tiled
  • Clipboard Image Offset: 0, 0 (restored to default)
  • Height Merge Method: Clipboard (No Displacement)
  • Antialias: Checked (unchanged)

 

This will produce an expanded version of the dimple map which should look like this:

 

Dimple-Hex-Unsmoothed-Expanded-Pattern.p

 

Run the Texture Smoother.

  • Set the Repetitions to 100 (maximum value)
  • Click the Smooth Texture button twice.
  • Click OK to exit

 

Next, the height map will be restored to its original size.

 

Run the Canvas Size command.

  • Height: 362
  • Width: 209
  • Anchor: Middle

 

The result should look like this:

 

Dimple-Hex-Pattern.png

 

MAKING THE GOLF BALL HEIGHT MAP

 

Copy the sphere height map to the clipboard and paste as a new image which will become the golf ball height map.

 

Run the Canvas Size command.

  • Height: 600
  • Width: 600
  • Anchor: Middle

 

Copy the dimple HM (height map) to the clipboard.

 

Run the  Texture Merger on the sphere HM.

  • Clipboard Image: Tiled
  • Clipboard Image Size: 0.1340
  • Clipboard Image Offset: -0.025, 0.1
  • Clipboard Image Rotation: 18
  • Clipboard Image Mapping Method: Surface Offset 1
  • Merged Height Scale: 255
  • Height Merge Method: Subtract
  • Scale Clipboard Heights by Clipboard Image Size: Checked (don't neglect to check this one)
  • Clipboard Height Scale: 0.1
  • Clipboard Height Offset: 0.15
  • Antialias: Checked

 

The Clipboard Image Offset and Clipboard Image Rotation move the position of the dimples. They can be set to whatever looks good.  I set them here to approximately match  my original OOTF entry.

 

You may want to enable Shading while setting the controls, to better understand what's going on. You can use the Texture Shader settings from below. Make sure to disable shading before exiting the Texture Merger!

 

The reason for the Clipboard Height Offset is to produce a profile that includes the dimples. The areas of the textured sphere that are beyond the back plane are clamped to zero, and must be made transparent. To do so . . .

 

Run the Texture Scaler plugin with the following changed settings:

  • Pre-Scale Heights to Entire Range: Unchecked (this keeps the sphere height scaling unchanged)
  • Feather Far Pixels: Checked (this makes all the black pixels transparent)

 

The final height map should look like this:

Golf-Ball-Demo-HM.png

SHADING THE GOLF BALL HEIGHT MAP

 

Copy the following image to the clipboard (or create your your own logo for a different brand):

Calloway-text.png

(The logo size is 411x340.)

 

The text image was produced by essentially tracing an actual logo with curves, then filling with the Paint Bucket. Not elegant, but the best way I could come up with. Fortunately, the repeated letters saved me some work.

 

I suggest it might be a good idea to use the Hue/Saturation adjustment to slightly increase the lightness of the logo. I kind of think the black text is a bit too harsh, and that a very dark gray -- almost but not quite black -- might look better.

 

Run the Texture Shader with the following non-default settings:

  • Image: Clamped
  • Clipboard Image Size: 0.64
  • Clipboard Image Mapping Method: Surface Offset 1
  • Mapping Displacement: 0.015
  • Texture Height Scale: 255
  • Ambient Light Color: 80, 80, 80
  • Directional Light Color: 240, 240, 240
  • Directional Light Direction (Use Outer Ring to Reverse): 0, -120, 32
  • Specularity: 0.35
  • Specular Concentration (Exponent): 55.0
  • Antialias: Checked

 

The Mapping Displacement is only to distort the text a bit to conform to the dimples. If the logo were larger, so it occupied a considerable portion of the ball, it would need to be distorted to appear to be on a sphere. Because of the dimples, setting the Mapping Displacement to 1.0 would not work at all (I suggest trying it to see what I mean). What to do? The solution is to pre-distort the logo by first mapping it onto a smooth sphere with the Texture Shader, but using only ambient lighting. The logo will be distorted, but there will be no shading. The distorted logo can then be mapped onto the golf ball HM using to a low Mapping Displacement setting to make it conform to the dimples.

 

The shaded golf ball should look like the image shown at the beginning of this post.

Golf-Ball-Demo-Shaded.png

 

You might want to run AA's Assistant or BoltBait's Feather in order to smooth the edge of the golf ball.

 

There are, of course, many variations that can be made. For instance, the depth of the dimples can be increased or lessened by changing the Clipboard Height Scale or Clipboard Height Curvature in the Texture Merger; the size of the dimples in the original dimple HM can be made larger or smaller; the edges of the dimples can be made sharper or smoother by changing the amount of smoothing with the Texture Smoother.

  • Like 1
  • Upvote 2
  • You're a Smart Cookie! 2
  • Hooray 1
Link to comment
Share on other sites

Thank you very much @MJW for doing this tutorial 🥇 I just know that you will have excelled at Math at school.  The way you make the smaller height map, before you make it bigger, is very clever.

 

To those who attempt this tutorial, please don't panic when, half way through the tutorial, you get a page full of pretty height map balls 🤣 this IS supposed to happen and all will become logical when you continue on 😁

 

Ball-2.png

  • Like 2
  • Upvote 1

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

2 hours ago, Pixey said:

I just know that you will have excelled at Math at school.

 

Not to brag, but I have a master's degree in math (okay, that is bragging).

 

Your image looks great, except I think you forgot to set the the Clipboard Image Size to 0.64 in the shading step, resulting the the logo being a bit too large. Thank you for going through the (many) steps. I planned to do that very soon, but hadn't gotten around to. (Actually, I went through all the steps quite a few times in adjusting the control settings for the tutorial. The thing I hadn't yet done is to go through the written instructions, following them exactly, instead of partially relying on what I remembered.)

Link to comment
Share on other sites

27 minutes ago, Red ochre said:

I like the 'trick' of increasing the canvas size to allow the texture smoother to work correctly.

 

Thanks! Your comment inspired me to add an image of the expanded dimple map to the tutorial. (I tend to be a bit stingy with images, I think.)

Link to comment
Share on other sites

  • Pixey changed the title to How to make a realistic Golf Ball.
13 hours ago, MJW said:

I think you forgot to set the the Clipboard Image Size to 0.64 in the shading step, resulting the the logo being a bit too large.

 

 I did have it set to 0.64.  I discovered that when I copied your logo from the tutorial, it was sized 642 x 531.  So I decreased that to 448 x 371 and then, using the same size 0.64, I got a smaller logo :)  I've changed it in the original post.

 

I just knew you were a whizz at math 😁

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

6 hours ago, Pixey said:

I discovered that when I copied your logo from the tutorial, it was sized 642 x 531.

 

Hmm. I don't know how you got a wrong-sized logo; the original is 411x340. I wonder if it's due to some setting in your computer. If I use Copy Image and paste it as an image into PDN I get the correct size. I added a parenthetical note to the tutorial listing the size so that people can check to make sure it's correct.

Link to comment
Share on other sites

1 hour ago, MJW said:

Hmm. I don't know how you got a wrong-sized logo;

 

I think I know why 🧐 what I'd done is copy and paste your whole tutorial into Word, and I'd copied it from there.  Now that I tried copying it directly from the tutorial, it shows up as 411 x 340 🙄

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

54 minutes ago, Manc said:

Sorry mate, tried it.

You've lost me.😄

 

If you just go through one step at a time, doing exactly what the instructions say, you should be able to get the proper result. It should be quite a mechanical process if you ignore the blue explanatory comments: run the specified command, setting the controls to the specified values.

 

I'm always happy to answer questions about any confusing steps. And I'll update the tutorial if something needs clarification.

Link to comment
Share on other sites

10 minutes ago, Manc said:

I don't understand 'Color clearer, make transparent'

 

@Manc- don't begin the tutorial at the top of the page.  Start doing the tutorial under THE MAIN TUTORIAL.

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

15 minutes ago, Pixey said:

@Manc- don't begin the tutorial at the top of the page.  Start doing the tutorial under THE MAIN TUTORIAL.

 

I think maybe I'll remove that section at the top. It's not really detailed enough to be useful.

 

EDIT: Done. Sorry about the confusion it caused.

Link to comment
Share on other sites

This is the removed section, just in case I need it for some reason.

 

THE ORIGINAL DIMPLE MAP

 

The original dimple map was made on an 800x600 canvas, as follows. I describe the general approach, even though it's not the one used for the tutorial,  because it may be useful in other situations.

 

Hexagonal Grid

  • Size: 23
  • Brush Width: 32
  • Antialias: Checked

 

Color Clearer

  • Color to Make Transparent: Black

 

I then alternately applied the Edge Expander to increase the dot size and AA's Assistant to smooth them. Once I had sufficiently large and round dots, I ran Texture Object Rounder to make the dots into small spheres, followed by Texture Scaler to increase their height range. I then blended into a black background layer and smoothed the result with the Texture Smoother.

 

This is the original dimple height map I used:

 

Dimple-HM.png

This is actually a pretty good method, though care must be taken that all the dots input into the Texture Object Rounder are separate, and not invisibly connected by low opacity pixels. Running Red ochre's Alphathreshold can help prevent this, and I believe I used it just before running the Texture Object Rounder.

 

(It probably would have been better to start with a larger canvas and increase the size of the hexagons a bit. This would decrease the possibility of the final dots being slightly connected since there could be more distance between dots.)

  • Upvote 2
Link to comment
Share on other sites

5 hours ago, Manc said:

Hi @MJW Can't seem to get the hang of it. Will give it a miss for now.

Think old age is catching up with me.🙃

 

I hope you'll try it again soon. My suggestion is, just relax. Follow each step carefully, one by one, setting the controls to the specified values. The controls are all listed in their order within the menus, so that should make it a little easier. Do as @AndrewDavid suggests: at the end of each step, confirm your image matches mine. If it doesn't, Undo the steps since it last matched, and try them again. If it still doesn't match, tell me where you're having the problem and I'll be happy to see if I can figure out what's wrong, and perhaps modify the tutorial to make it clearer.

 

I am, sad to say, even older than you, so that's no excuse!

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Don't panic - it's supposed to look like that. 

 

To continue, save that image as a .png and call it 'dimple height map' to a folder.


Open paint.net again and make a fresh layer with the bigger height map, found by going to Effects > Height Map > Render Sphere Height Map.

Then continue with the tutorial from ....

 

MAKING THE GOLF BALL HEIGHT MAP

 

 

Run the Canvas Size command.

  • Height: 600
  • Width: 600
  • Anchor: Middle

 

Copy the dimple HM (height map) to the clipboard.  (this is the one you saved to .png)

 

and continue with the tutorial.

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

  • Pixey featured this topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...