puma.snyder Posted January 18, 2004 Share Posted January 18, 2004 I have an curve with a (constant) width attribute. It's displaced into a tube shape. So far it works perfectly, but there are some things I don't understand. You can see both "errors" in the attached picture Sometimes the tip of the curve gets tapered althought the width attribute is constant, sometimes not. Why does this happen? Also at the tip the shading looks a bit weird. Near the end there is a sudden loss of luminance. What can I do to prevent this? Thanks again Achim Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted January 18, 2004 Author Share Posted January 18, 2004 And here is my other problem. On the left side is a "real tube" and on the right the displaced curve. Is there a way to get rid of the twisted look when the curve changes its direction? Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted January 18, 2004 Author Share Posted January 18, 2004 here is the file curves.rar Quote Link to comment Share on other sites More sharing options...
Mcronin Posted January 18, 2004 Share Posted January 18, 2004 Appending a Resample SOP to the Curve SOP seems to solve both problems. You have to create a lot of points though. I think the problem is that there aren't enough points to sample to get a nice clean curve. Quote Link to comment Share on other sites More sharing options...
edward Posted January 18, 2004 Share Posted January 18, 2004 You could try reconverting the curve back to NURBS after resampling. Your curve shape will change slightly though. Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted January 20, 2004 Author Share Posted January 20, 2004 thanks a lot, that did solve the problem, but when I change the width attribute to something like "(1-$BBY)*.05" the shading error at the tip reoccurs. Sometimes a large part of the tip becomes invisible. Further resampling does not help in this case. Anything else I could try? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 20, 2004 Share Posted January 20, 2004 Hey Achim, Anything else I could try? I havent looked at the hip, so I could be way off here, but it looks to me like the problem might lie with your shader, and not with how Houdini does RiCurves... Try rendering the ribbon with a constant shader (i.e: just pump some color to Cf) and see what it looks like. If the ribbon doesn't exhibit any transitional artifacts as it thins out, then the problem is that your shader is not taking filtering into account (anti-aliasing). Just a thought... Cheers! Quote Link to comment Share on other sites More sharing options...
puma.snyder Posted January 20, 2004 Author Share Posted January 20, 2004 your right, its must be in the surface shader. When I used supermaterial shop or something else its fine. So I guess its got also nothing to do with the displacement shader. So antialiasing. hmmm, no idea how to do it. the shader I used is : Cf = 1-abs(dot(normalize(N),normalize(I))) Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted January 29, 2004 Share Posted January 29, 2004 So antialiasing. hmmm, no idea how to do it. Hey Achim, Sorry for the delay, but things got a little crazy there for a while. So I looked at the file, and there are a couple of things that were a little strange, but generally, the problems at the thin end of the strands were due to lack of antialiasing on the shader's part. Here are some of the main bits: 1. The strands had a double point (two points on top of each other) at the "thick" end. That's why that end was tapering when it shouldn't have. 2. As Mcronin and Edward suggested, you do need to refine the curves, else the rendered curve won't match up. No need to go crazy, but...yes. I wonder if Mantra uses some other spline (instead of NURB or Bezier) and that's why they don't match (?!?) Anyway; linear (i.e: poly-line, matches just fine as you already know). 3. The idea behind RiCurves (sorry, but it's easier to call them that, than "open-polys-rendered-as-ribbons-aligned-to-camera" ), is to use them when the "tube" is meant to be very "thin" (all things being relative). And given that that's the case, you shouldn't really need to resort to actual displacement to give it shape (i.e. you're never going to get so close as to see inside the "tube"). At those scales then, "shape" is just "light". All you really need to do is shade it "as though" it were a tube. Besides; displacements are much more likely to give you some artifacts (as you already found out in this case). 4. Given these tubes are thin -- not "hair thin", but pretty thin nonetheless -- then we can bump instead of displace, and keep everything inside the surface shader. See the hip for details, but basically, we use the implicit equation for a circle. You know 'x' (== parametric 's'), and you know the radius 'r' (== bound attribute 'width'/2); so all you need is 'y' (the "elevation"), like this: Implicit eqn for circle: x^2 + y^2 = r^2 Solve for y: -> y = sqrt(r^2 - x^2); just plug into it the known values for r and x: r = width*.5; x = s*width - r; Once you know y, you can calculate the "bumped" position Ptube = P+normalize(N)*y. Then the virtual tube's N at Ptube which is Ntube = normalize(dPds)*x + normalize(N)*y. And finally, the new I which is now Itube = Ptube-Eye (instead of its usual P-Eye). All shading depends on P, N, and I, so once we define the virtual tube's Ptube, Ntube, and Itube, we proceed as usual except we use the tube variants for those three globals. 5. Given that all shading (in this case!) depends on P, N, and I; and given that, for our tube, all those were derived from y which itself is a function of x -> y = f(x[,r]) = sqrt(r^2 - x^2), we should choose that function as a first place to start antialiasing. If you think about it, you'll realize that, as the hair gets thinner and thinner, our x starts jumping from +1 to -1 over less and less space, until at the tip, it covers the whole [-1,+1] range instantaneously. There are basically two ways to go about the antialiasing. One is to analyze the function and, if possible, come up with a way to integrate its value over the range being sampled. Not all functions can be analyzed like this -- they are the minority in fact. The other way is to "fade" to some known average value as the filter size gets bigger -- this is the method I use in the file (sorry; too lazy to think about the analytical method , although it *does* exist in this case). OK. this is getting too long. Have a look, and if something makes you go "huh!?!", then ask Cheers. curves_mario.zip 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.