Had a quick look at this and it's definitely a lot easier to use. There appears to be a slight problem with the shading though.
The attached image uses a black and white level of 0 and 1 respectively, so it should be shaded from white to nothing (underlying grey). Instead, it appears that there is a sharp cut off half way between the black and white levels. I'll have a closer look on the weekend while I'm brushing up my maths for animating populations linked to camera position/orientation... icky geometry ;) At least the angles are working correctly, so you're pretty close.
It probably has to do with checking/unchecking the clamp white/clamp black boxes in the color adjust node at the output. Also note that altitude and slope constraints are added at the next step (same as you did it, I just don't include the final distribution shader in the face mask).
Also note that the effect of the black level and white level is much more pronounced, since it affects the whole 360 degree circle, instead of just one quadrant.
I was thinking along similar lines but using a circular gradient image with a curves adjustment (or just an increase in gamma) as a displacement function. It's very hard to judge the effect of the edge of the mask on a normal terrain. Got a bit side tracked so I haven't had a close look at your setup yet.
I fixed a problem with mine, but it's worth persisting with this as it makes selecting the angle of the face possible. Mine is more simplified, with only 4 direction options... and I exclude flat surfaces. If you're going to include flat surfaces it may help to leave them out until the end so that you can exactly see which parts of the terrain the functions are actually including.
Most of my population masking is going to be linked to the camera for animations so the math will be a little easier in that it will involve calculating the angle between two coordinates. One will be an fov mask, similar to the mask generated by a through camera mask, but extending back to the camera position (and a wee bit wider than the camera's fov). I've used an image map successfuly for this but it doesn't allow for changing fov.
The circular masks I use are derived from camera distance (both spherical and non-spherical) but I'm sure people will find a use for a similar mask that they can place around a specific object (as one example) without having to add another camera.
You can nest conditional nodes nodes... something like this: http://forums.planetside.co.uk/index.php?topic=1493.msg15004#msg15004 (http://forums.planetside.co.uk/index.php?topic=1493.msg15004#msg15004)
It's getting close. I ran a few tests on my "bump" map (included in the zip from my current version). The face range works really nicely. I think you'll find TG works with radians rather than degrees. All you need is to divide the input by 2Pi. I added this in but there still seems to be a small error in there. Try using face range settings of black = 0.499 and white = 0.5, and check out the results for 0,90,180 and 270°. Below are the first few images I tested (default face range).
I just fixed another glitch that we both had regarding flat surfaces. It didn't make sense that my mask was showing flat surfaces, even though they were apparently in the correct direction. This was because my reference "bump" was placed at the origin.
When the surfaces are flat the Y vector = 1 (and X,Z = 0) and the resulting colour of the mask is the angular vector of the position from the origin, not the vector of the normal in the XZ plane.
I added a condition setting the scalar to 0 if Y = 1 which fixed this in mine. If you move the bump away from the origin with you setup you get the same thing.
Re flat surface - that's just how I check. I don't check for Y = 1, but I check sqrt(x^2 + Z^2) ; when that equals zero it's flat.
Re rads - crap. Figures. I really need to get some test terrain going before I muck with it more. How did you do yours?
You can use mine.
It's just a small image map (radial fill with curves adjustment) fed into the function of a displacement shader.
Cool - thanks. I'll play with this for a bit and see if I can debug it.
Wholly friggin function nodes, Birdman!
Nice work! 8)
Looks like you've got it ;D
It would be nice if the colour adjust had inputs for the black and white points. You could then set up more useable inputs for the width of the mask.
From a usability point, in the absence of "macros", you might want to produce a simplified layout with three rows.... input, processing and output (but keep the other version for reference). This combined with grouping seems to be a reasonably functional interim. The full node layout is only really needed for redesigning... and of course people can do it for themselves ;)
Happy to be of service.
BB - Oh, that's nice! (I'd keep the 'Flat Terrain Value' pulled out into the input row, though.) I was wondering how to make the layout a little less of a hog in the node view. Macros would be sweet; I'd even settle for the ability to minimize a group. :)
Another final modification would be to change 'Direction Input' to 'Direction Control'.
And I must mention that these services are available to hire on a contract basis. If any of you have an idea for a cool shader but don't know how to implement it drop me a line. I can't promise I'd know how either, but I'd be willing to take a look at the problem. (I'm a bit of a rookie with the program, I'm afraid, but a little applied mathematics can go a long way.)
Quote from: Harvey Birdman on May 21, 2007, 11:02:42 pm
And I must mention that these services are available to hire on a contract basis. If any of you have an idea for a cool shader but don't know how to implement it drop me a line. ...</shameless plug>
Do you have a bird image we can use as a mask on a search light? ;)
There you go. Let's see; a dodo? No, that was flightless...
Still, the profile is probably about right...
|Well I'm working on a functional fov mask for animations... if I run into trouble I'll light the beacon|
PS. You might want to add the final version of the file to the first post in this thread.
;D ;D ;D
That's pretty good! Seriously, I just posted a private message for you with my email address. Drop me a line.
Quote from: Harvey Birdman on May 20, 2007, 03:59:26 pm
Hey, this reminds me - if any Planetside people read this... doing this bit of function node programming makes the lack of boolean operators and constants painfully apparent. A boolean conditional node would be handy, too - have it switch a scalar output between two scalar inputs, dependent on the condition of a third boolean input.
I don't know if Jo was reading this, but a few days ago he added 3 new Boolean functions: Conditional Boolean scalar, Boolean NOT scalar, and Scalar to Boolean scalar (with an optional threshold input). They'll be in the next update.