MJW

Members
  • Content Count

    1,983
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by MJW

  1. Even through the aliased/antialiased-selection control can be set when the Magic Wand tool is active, I don't believe it affects the selection. The Magic Wand selection is jaggy either way. To test my assumption, I did the following: I created an Elliptical Selection with antialiasing enabled, then filled it. The result was nicely antialiased. I drew an antialiased, filled ellipse Shape, then selected it with the Magic Wand, with antialiasing enabled. I added a new layer, then filled the selection in that layer. The result was completely jaggy.
  2. Before this weekend, I'll post some suggested replacement code. I'd like to add a routine, called from the setup code, to precompute some values, so they don't need to recomputed per-pixel. The basic change is to save the division of alpha to the end. The way it's currently done is really imprecise.
  3. @welshblue discovered a bug in the way Shape3D computes alpha when antialiasing completely opaque areas. Though all the subpixels have A=255, the resulting alpha is 254. The AA is done in three places: one for each primitive type. The code in each section is identical except for the calls to low-level primitive-rendering routines. Here is the cylinder code, with the variables renamed for clarity: I'm pretty sure @Ego Eram Reputo and I could modify the AA code to work correctly, assuming EER is willing.
  4. @Ego Eram Reputo was able to restore the xml feature. Perhaps he could fix the AA bug. I think I can take a pretty good guess about the basic cause. Shape3D uses the usual supersampling AA method, which requires summing the alphas, then dividing by the number of per-pixel samples. I expect that the division (which may be integer division) truncates or rounds down incorrectly. One integer-division method that works properly is to double the alpha sum (by left shifting), add the number of per-pixel samples, then divide by twice the number of per-pixel samples. That amounts to adding 0.5, to round in the usual fashion. // Compute the (rounded) averages. int twiceA = a << 1; b = ((b << 1) + a) / twiceA; g = ((g << 1) + a) / twiceA; r = ((r << 1) + a) / twiceA; a = (twiceA + ssSamples) / ssTwiceSamples; return ColorBgra.FromBgra((byte)b, (byte)g, (byte)r, (byte)a); If Shape3D uses floating-point, the fix is probably just to add 0.5 before converting back to integers. (I added the technical details for Ego Eram Reputo, though he most likely already knows them as well as I do.)
  5. I finally got it to fail, and now I think I know why. When it didn't work, the alpha of the most opaque object pixels produced by Shape3D was 254. It happened after I increased Shape3D's AA to the maximum of 5. I don't know, though, that that was the cause or just a coincidence. EDIT: I seems to be related to Shape3D's antialiasing. If I turn it off, or set the level to 1, the alphas are 255. If I set it to 2 or greater, the alphas are 254. I should add that the Object Rounder always looks for completely opaque pixels to help determine the starting edge of the object on each row of pixels. This has to do with its (not especially successful) attempt to determine the start and end of the edge to better-than-pixel precision.
  6. One thing that might be worth trying is to get one of the times Object Rounder doesn't work, then use the Color Picker to check the opacity of the background, and the center of the object, to see if the background pixels are entirely transparent, and the object contains completely opaque pixels.
  7. That's weird. It doesn't do that for me. My best guess is that the background is almost but not entirely transparent after the shape is drawn (like the alpha is 1), and that AA's Assistant clears it. if you have Red ochre's Alpha Threshold, try using that instead of AA's Assistant, and see if that fixes the problem. If it does, the question is still, why isn't the background fully transparent? If it doesn't fix it, I'll have to look into it some more. EDIT: More likely, the shape isn't entirely opaque. Perhaps for some reason the original image on which Shape3D is run is nearly, but not completely, opaque. EDIT 2: Perhaps Shape3D's Transparency control is checked. I tried to tell in the video, but couldn't.
  8. Yes, i did. I was surprised it only got my vote; but considering every entry was worth voting for, I suppose people preferred the more traditional hats.
  9. Congratulations to @welshblue, @Pixey, and @lynxster4 for their suburb entries! Sorry I didn't submit anything, but I was pretty sure I couldn't come close to the quality of the already-submitted hats. (I really liked Pixey's bear-skin hat. Very imaginative choice, and the fur was so well done.) Thanks to Pixey for hosting!
  10. The following two equirectangular maps may be useful for those interested in experimenting with the equirectangular shading modes: They both represent a (more or less) point-source directional light, similar to the Texture Shader's normal directional light source. The second map is the first map after applying the Equirectangular Diffuse Transform. The first map can be used to produce the specular lighting, using the Reflection Map (Equirectangular) shading mode, the second can be used to produce the diffuse lighting, using the Gradient Map (Equirectangular) shading mode. I think starting with this simple lighting situation will give a better idea of how the equirectangular shading modes work.
  11. No, there should be no need to adjust the texture height. My reply to Pixie is that the "standard" way to use the equirectangular mapping modes is to use all ambient light, with no directional light. The directional lighting comes from the light sources in the equirectangular maps. The specular (reflection) component comes from the original equirectangular map, using the TS's Reflection Map (Equirectangular) mode, while the directional component (and also some ambient component) comes from the diffuse-transformed map, using the Gradient Map (Equirectangular) mode. The lighting brightness can be adjusted either by changing the brightness of the ambient light when shading, or by shading with the light at maximum brightness, and adjusting the layer Opacity (assuming the layer blending mode is Additive. I generally prefer the second method, which is more flexible. One bit of advice is to always double check that the TS shading mode is the correct one for the type of shading being done: Reflection Map for the reflections, and Gradient Map for the diffuse lighting. Switching between them can be confusing -- at least to me. I swear, when I was experimenting to make the example, I did it wrong more times than I did it right.
  12. I wish I could offer you hope in that regard, since such a feature would be useful, but unfortunately making a version that supports editing sufficient to edit out a tripod, would be a vastly complex task.
  13. Amazing! And the method of producing the threads by tilting the screw and applying the Texture Rounder is so clever!
  14. I take no responsibility for what you do with them (and encourage you to use them for good, not evil), but I find pyrochild's Liquefy and Grid Warp useful for warping images. Also, TechnoRobbo's FreeWarp.
  15. A method not mentioned, that I find works well, is to use (with slight variations) Yellowman's Styrofoam method.
  16. There is such a plugin: Red ochre's Alpha Threshold. It's in his plugin pack.
  17. I probably should do that, and maybe I will.
  18. Thanks, dipstick. Can Blender produce diffuse shading based on an environment map (like Texture Shader's Gradient Map mode, shown in the third layer of my exampe), or only reflections (like Texture Shader's Reflection Map mode). I'm not quite clear from the images. (I probably should download Blender, myself.)
  19. Not a silly question at all. Yes, the Ambient should be 255, 255, 255, and the Directional light should be 0, 0, 0. The lighting in the ER map substitutes for the directional light. The reason for using the maximum is that increasing brightness afterword causes a loss of precision in the colors, while decreasing brightness doesn't. So it's usually best to start with as bright of an image as possible, without overflowing. The way things work, shading with fully bright ambient light and no directional light should never result in overflow. For the method I suggested in the example, the layer's Opacity is used to adjust its brightness in the combined image. This assumes the layer has the Additive blend mode, as in the example.
  20. I'd be very interested in any details about Blender's equirectangular diffuse shading. I know very little about Blender, but I was under the impression it uses cube maps for the actual shading instead of working directly from equirectangular maps..
  21. Equirectangular Diffuse Transform DLL: Equirectangular Diffuse Transform.zip The user interface: Summary: The Texture Shader has a mapping mode called Reflection Map (Equirectangular) which allows a panoramic image stored as an equirectangular (ER) map to be reflected onto a height map. Equirectangular Diffuse Transform provides a method by which the panoramic image can also be used to apply diffuse lighting consistent with the same image. The basic method is to use the original panoramic image to produce the reflection, then use the same image transformed with Equirectangular Diffuse Transform to produce the diffuse lighting, using the Texture Shader's Gradient Map (Equirectangular) mapping mode. The offset and rotation of the Texture Shader's clipboard image should remain the same for the two steps, and normally the light source should be Ambient, without Directional light. The Help menu description: ==================== Equirectangular Diffuse Transform transforms an equirectangular environment map into an equirectangular diffuse map that can be used to apply diffuse lighting to a height map. The effect uses the first five bands of spherical harmonics to approximate convolution with a clamped cosine function covering a hemisphere. The resulting diffuse map map can be used by the Texture Shader effect, with the Clipboard Image Mapping Method set to Gradient Map (Equirectangular). Typically, the Directional Light Intensity should be set to zero, and the Ambient Light Color adjusted to determine the light intensity. The width of an equirectangular map is normally twice the height, but any image will be treated as though it covers the entire sphere. The controls are: Pre-Scale Brightness to Maximum Range: When enabled, the brightness of the diffuse map is automatically adjusted so that the the maximum color is as bright as possible without overflowing. This provides the largest brightness range when shading. When disabled, if Expansion Gamma equals Compression Gamma Reciprocal, the color of a constant-color map is unchanged when transformed; if Expansion Gamma does not equal Compression Gamma Reciprocal, a constant-white map is unchanged when transformed. Brightness: Adjusts the brightness of the diffuse map. Brightness values greater than 1.0 should generally not be used when Pre-Scale Brightness to Maximum Range is enabled, since they will result in color overflow, and therefore clamping. Expansion Gamma: The exponent to which the color components are raised before being transformed. When equal to Compression Gamma Reciprocal, this can be used to compensate for gamma compression. Gamma is typically around 2.2. When used with Compression Gamma Reciprocal set to 1.0, it provides a contrast adjustment for the pre-transformed map; increasing the upper-end contrast when greater than 1.0, and decreasing the upper-end contrast when less than 1.0. This can be useful for emphasizing the lights in the map over the background colors. Compression Gamma Reciprocal: The reciprocal of the exponent to which the color components of the diffuse map are raised. Link Expansion and Compression Gammas: When enabled, Expansion Gamma will always match Compression Gamma Reciprocal. ==================== Example: Original equirectangular map: Transformed map (with gamma of 1.0): Shading example: Shading details: Additional comments: Though I think theoretically using a gamma of 2.2 makes sense, the example above uses a gamma of 1.0. Until recently, I began to doubt the gamma control was very useful, except as a contrast adjustment; but now I'm beginning to think using a gamma of 2.2 might be better. The plugin was originally inspired a a series of articles called Spherical Harmonics and applications in real time graphics. If you compare my transformed image to the article's, you'll see they are different. Part of the difference is that by default I scale the brightness to make the image as bright a possible, without overflowing. There are, however, other differences, and I don't know why. However, I've done many tests that pretty much convince me that my result is correct. The tests include writing a plugin that (very slowly) does a full convolution with a clamped cosine function. Though the algorithm was completely different, the results were almost identical. I wrote a fairly detailed comment about the differences on the article's website, which was flagged as spam by the blankety-blank spam filter. Unfortunately, the article is quite old, so the author hasn't responded to my earlier comments. The ER map used for shading should generally represent light sources, not colored areas. If, for instance, the ER map has a large expanse of grass, the diffuse shading will be very green, even though the grass would actually emit, through reflection, only a limited amount of green light onto an object. In some cases, it would be desirable to adjust the map's contrast to emphasize the lights over other areas. (This can be done by setting the expansion gamma to a larger value than the compression reciprocal.) It may also be useful to decrease the map's color saturation, to reduce the effect when shading colored surfaces. To keep my example simple and direct, and avoid confusing detours, I didn't make any post-shading modifications to the diffuse-shaded layer. However, in most cases I would try adjusting the brightness, contrast, saturation, and such to achieve the best result. On the off chance another programmer wants to use my transform code for some other purpose (such as computing the spherical harmonic coefficients) , as with all my PDN code, I'd be happy to provide it.
  22. Perhaps you could create Scalable Vector Graphics files, then use the plugin to render in in PDN. SVG files are XML based, so they can be created with a text editor. Also, read BoltBait's How to make custom shapes for paint.net.
  23. @welshblue, I would love to have you make a video on the Texture Shader, or any of my other plugins. I keep meaning to make tuts or that kind of thing, but never get around to it. @dipstick, I was able to produce a reasonable facsimile of the right-hand star by drawing a filled star with the Shape tool, then using the plugin currently called EdgeShaderMJW, followed by several iterations of the Texture Smoother plugin to smooth it out. I think I may know how to produce a better star, but I'll need to experiment later. (Producing a revised, released version of Red ochre's and my Edge Shader is my next programming project.)
  24. Hope you had a great birthday, Red ochre!
  25. Congratulations to @welshblue, @lynxster4, and @Pixey for their superb entries! They were so impressively realistic, while at the same time, visually appealing. Thanks to Pixey for hosting. Thanks for the kind words about my entry, welshblue. I rather liked it, myself, though it was probably a bit too low key.