Jump to content
How to Install Plugins ×

Texture Shader


MJW

Recommended Posts

Looks interesting (downloading) - thanks!
Plenty of well annotated code to read through - thanks for that too. ;)

 

ps.

I think it would be useful to state the SubmenuName (Distort) and Pdn version compatibility (Pdn 4 only)?

 

pps.

Work well! ;)
 

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

I get an error while trying to compile for PdN 3.5.11. Seems the old CodeLab can't recognize the "Tuple" type or something like that. Would there be a way around this problem?

Link to comment
Share on other sites

I've downloaded/installed this yesterday and played around a little.

However, I'm sad to say that… I don't get it.

Could somebody please give me a hint about how to use this? I mean, should it be used on the layer with your text? Or above it? Underneath it?

I've figured out that you need to copy your image/texture on the clipboard but I can't get any of these cool result. At best I got the outline of my text with the clipboard image as a background :( Any tip would be appreciated!

Link to comment
Share on other sites

Maximilian: I'll try to come up with an alternative for you for the light position using the X-Y control.

 

AgentGoodspeed, open the following image in PDN. Then open any other image and copy it into the clipboard (using ctrl-C). Now go to the MJW image and run Texture Shader. The clipboard image should appear mapped onto the MJW image. You may have to adjust the size of the clipboard image with Image Scale. Adjust the directional light position so the light doesn't come from straight ahead for a more effective image. Set the Image Source to White, and the MJW wil be shaded, with no image.

 

Remember that to a plugin there's only one layer: the current active layer. That's where the texture should be. The only other image is the one in the clipboard. From your description, you may need to do several things. First, as I mentioned, move the light from dead center to upward and off to the side. Second, adjust the texture height. Then try different Mapping Modes. The Reflection modes are the most dramatic, but they're kind of picky, since the reflections may be of the outside transparent pixels. Adjust the Texture Height Scale, Texture Displacement Scale, and Image Scale to deal with that. Tiling will get rid of random remaining transparent pixels. The Faux Reflection and Re-reflection modes won't produce transparent pixels when tiling is used. Antialiasing very often improves reflected images.

 

Adjust the Specularity controls. To me, specularity is the secret sauce to producing cool images.

 

For variety, add a small amount (around 15) of black-and-white (Saturation 0) Noise, followed by a small (Radius 1 to 3) Gaussian Blur. That will make a rough texture. Or use a Motion Blur instead of a Gaussian.

 

Most of the light will probably be Directional, but don't be afraid to add a bit of Ambient Light to fill in the shadows. Using a slightly yellowish Directional Light and a slightly bluish Ambient Light can sometimes give a nice effect.

 

MJWReflection-Texture.png

Link to comment
Share on other sites

 Maximilian: Try this. Replace the UI variable line for the directional light with:

Pair<double, double> Amount14 = Pair.Create(0.0,0.0); // Directional Light Direction

 

Then replace GetDirectionalLightDirection (near the end of the code) with:


// Get the direction the directional light is pointing.
float lX, lY, lZ;
void GetDirectionalLightDirection(Pair<double, double> dir)
{
    double x = -dir.First, y = -dir.Second;
    if ((x == 0.0) && (y == 0.0))
    {
        lX = lY = 0.0f;
        lZ = 1.0f;
    }
    else
    {
        // Map the square into a circle by dividing by the distance to the nearest side.
        // In an abundance of caution, very slightly scale down the transformed x and y to avoid the
        // possibility of round-off error causing the square root of a negative number in the z calculation.
        double absX = Math.Abs(x), absY = Math.Abs(y);
        double distScale = 0.999999 * Math.Sqrt(Math.Max(absX, absY) / (absX + absY));
        x *= distScale; y *= distScale;

        // Now the x and y coordinates are within a unit circle.
        // Get the z coordinate from the unit sphere.
        lX = (float)x; lY = (float)y;
        lZ = (float)Math.Sqrt(1.0 - x * x - y * y);
    }
}

I tested it, and it seems to work fine. The control won't be quire as intuitive as the original version, but since you can look at the light in the actual image, it should be serviceable. (Actually, while the control on the left is less intuitive, I prefer the slider controls to the 3D Roll Control equivalents.)

Edited by MJW
  • Upvote 1
Link to comment
Share on other sites

Some advice for blurring text. If you want rounded text, just applying the blur will likely produce text edges that won't be crisp enough. Instead (starting with white text on a black background),  first apply a few pixel-width blur. Then select the black area with the Magic Wand. Use Global mode and zero Tolerance so only the absolute black is selected. Invert the selection so the text is selected. Now apply a larger blur. I think that it perhaps works better to consecutively apply several smaller blurs to produce the larger blur. Once the text is sufficiently blurred, Deselect and perhaps apply another blur of a few pixels to smooth the edge transition.

 

Gaussian blur is the standard blur, but other blurs also work well. Applying a 45° Motion Blur followed by a 135° (-45°) Motion Blur seem to produce a good effect.

Link to comment
Share on other sites

Really nice pieces by everyone. Liking everything seen so far! JC_clap.gif

 

I'll be posting a couple of my quick tests later today, but in the meantime I wanted to add to this thread my thanks for the tailor-made alternative source code, comments, and suggestions :) and also the 3.5.11 version of the plugin I compiled, should anyone else want it.

Texture Shader 1.0 for PdN 3.5.11.zip

  • Like 1
  • Upvote 2
Link to comment
Share on other sites

MJW, that makes a lot of sense. Thanks!

I guess my problem was that I was working only with text on an otherwise empty layer. But using an entire image really showed me what I was missing. So now I'm off to experiment :)

Link to comment
Share on other sites

Photo carved on a concrete surface:

 

Naty-carved-on-concrete-with-Texture-Sha

 

My avatar eagle sketched on a concrete surface with black chalk, or something like that (original eagle is a pencil sketch scanned and edited with PdN):

 

My-sketch-1-of-eagle-spirit-w-black-chal

 

My avatar eagle carved on concrete (same concrete texture as above):

 

My-sketch-1-of-eagle-spirit-carved-on-co

Edited by Maximilian
  • Like 1
  • Upvote 7
Link to comment
Share on other sites

  • 2 weeks later...

MJW! Thanks for the beautiful plugin. 

 

My final product:

 

zhrevgdt.png

  • Upvote 4

Live as if you were to die tomorrow. Learn as if you were to live forever.

Gandhi

 

mae3426x.png

Link to comment
Share on other sites

  • 7 months later...

Thank you, Pixey! I am, I immodestly admit, quite fond of the Texture Shader, and am always pleased to see more people using it, in spite of its somewhat intimidating number of controls.

Link to comment
Share on other sites

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.

×
×
  • Create New...