Getting an image map shader to work

Started by yesmine, March 13, 2014, 04:37:21 PM

Previous topic - Next topic

yesmine

I'm trying to understand how to get an image map shader to mask part of a terrain. I have read the Wiki and I did look through the forum for examples...I tried one tgd sample I found but it crashed Terragen :(.  But to explain:

I have a DEM terrain covered with its own image overlay. I created an image with transparency (tried tif and png), with a black area intended to mask out an area to be filled with other things. The mask is the exact size of the terrain, both oriented from lower left corner. Essentially, I have a mostly transparent image mask with a small black area near the middle blending slightly into the transparency.

I opened the settings of the image overlay node (the image covering the DEM) and at the bottom checked 'mask by shader' and selected 'Image map shader' and then inserted the image with the transparency and masked area. I think that's correct, and it generated the node plugged into the "Mask Shader" node of the image map (overlay) shader.  But all that happens is the entire terrain turns grey--no color image overlay. I even put a red circle in the middle of the black area so I'd at least see the red and know it's there...but nothing shows. From the Wiki on "Image Shader Effects", I'd have expected that checking to us Alpha as Transparency would drop everything around it, but even checking "use alpha/transparency for direct blending" does nothing. It just shows all grey (no red spot then either.)

I'd appreciate knowing what I'm doing wrong. Or, if someone has a sample file that shows some clever use of image maps to mask parts of a scene, I'd love to play with one to see just how it's done (I learn better if I can take something apart and put it back together...ug.)
Thanks...

jo

Hi,

I think if you're using an image with alpha in an image map shader as a mask shader you would need to check "Alpha as colour" and not check "Use alpha/transparency for direct blending". This is because the mask shader input is expecting colour data to control the masking.

Regards,

Jo

yesmine

#2
Hi Jo,
Thanks for the suggestion., and though checking 'alpha as colour' didn't do the trick with what I was working on, it got me thinking and helped resolved what the problems were. Basically, the image shader mask was not doing what I thought it should be doing when hooked to the node for the 'overlay image', and it couldn't have. I realize now that the mask shader must be hooked into something that it actually can mask (e.g. like a procedural grass node), the point being that it wasn't going to work the way I was testing it. Also, the red dot I'd put in would not have shown up anyway since the image was being treated as a mask for alpha transparency and not image/color.  And, I had the transparency reversed for what I needed, meaning that I needed to have the part I wanted to be visible. That was all due to my lack of understanding, obviously.

But what I've found with my mistakes has shown me a number of nice possibilities. When I was checking for the red dot, I happened to add a cyan square and yellowish triangle. When I finally plugged it as a mask into a procedural grass shader and tried checking "Alpha as opacity"..I finally had the grass all around the properly masked area I wanted, but I could also see square of grass where the cyan square was, a fainter triangle where the yellow triangle was, and a hint of darkening where the red circle was. Ah...that brings up nice possibilities for varying densities or shades.
Also, when I checked "Use alpha/transparency for direct blending, this created a nice strip of the procedural grass around the border of the area I wanted masked out (see attached image). It showed the grass only around the edge where it feathers from solid to fully transparent, like a nice grass pathway around an open area, with the same square, triangle, faint circle inside the field (I do note that on close-up inspection the inner edge seems to blend quite nicely but the outside is a little jagged, so it might need some tweaks to make both sides smooth).

Still, realizing that an area with an edge that feathers to transparency can create these varying effect by simply selecting different options under the "image map shader -> effects" tab is excellent. At least I now have some ideas that might lead to ways to generate paths across any kind of terrain..and even vary densities using colors in the mask layer.
Thanks...