Forum: Poser - OFFICIAL


Subject: OT? -- Poser insulted at 3DBuzz, I decided not to let it pass

operaguy opened this issue on May 14, 2007 ยท 242 posts


bagginsbill posted Thu, 17 May 2007 at 1:57 PM

I believe what you asked for is how to chamfer or fillet the edge, right?

Most people handle it in the geometry. But I can do it in the shader.

The chamfer is really easy and I won't bother explaining it.

The fillet is harder, but simple in matmatic.

What we want to do is puff out the face so that the edges are round when joined. So each face needs to have a displacement at the edge that precisely implements a 45 degree arc of a circle. Assuming you're dealing with a square and not a rectangle, this is pretty easy. The rectangular case can be handled with just a bit more math, but I won't bother explaining that.

Here's how its done.

Letting x and y be my UV coordinates:

x = U
y = V

The distance (in UV space) to the nearest edge is:

e = Min(Min(x, 1-x), Min(y, 1-y))

Let k represent the desired width of the fillet on one face, expressed in UV space. So for example, if I want a 1% fillet:

k = .01

Now I need to scale e into the coordinate space of a circle with radius sqrt(2). To do this, I scale and flip the edge distance like this:

ex = 1 - Clamp(1 / k * e)

That is essentially my x coordinate for my fillet circle.

Now to compute my corresponding y coordinate:

ey = sqrt(2 - ex * ex) - 1

And now all I have to do is convert that to inches for displacement. A Poser square or box is 10.32 inches on a side. If it is scaled, I need to take that into account. In my demonstration I'm using boxes scaled to 400% so:

scale = 4

Finally the desired displacement is given simply by:

surface.Displacement = scale * 10.32 * k * ey

Done.

I'll post a render showing this next.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)