tag:blogger.com,1999:blog-35320919904258790.post3031781516982524577..comments2022-09-09T08:49:43.386-07:00Comments on Mikkelsen and 3D Graphics: Derivative MapsMorten S. Mikkelsenhttp://www.blogger.com/profile/11647723969880785609noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-35320919904258790.post-31138330782863308382020-04-26T09:30:46.901-07:002020-04-26T09:30:46.901-07:00This comment has been removed by a blog administrator.sobiahttps://www.blogger.com/profile/02092265766543644503noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-78921676473434692232014-01-23T23:04:48.201-08:002014-01-23T23:04:48.201-08:00This comment has been removed by a blog administrator.Anonymoushttps://www.blogger.com/profile/00349471659668066523noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-51387914835506204852013-04-12T14:05:35.827-07:002013-04-12T14:05:35.827-07:00With jbit.net down, is makedudv available at anoth...With jbit.net down, is makedudv available at another location?Gomihttps://www.blogger.com/profile/10393728287882444829noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-91467696874674903022012-03-03T01:23:30.861-08:002012-03-03T01:23:30.861-08:00Great job. I really appreciate your work. It is ve...Great job. I really appreciate your work. It is very helpful for <a href="http://total3dworld.blogspot.com" rel="nofollow">3d graphic</a>. Keep it up.Sara davisonhttps://www.blogger.com/profile/02881216993140602975noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-86294964935308398462011-08-19T15:25:43.140-07:002011-08-19T15:25:43.140-07:00More comparisons which show differences during tex...More comparisons which show differences during texture magnification.<br /><br />http://jbit.net/~sparky/blender_deriv/compare/<br /><br />These test shots were a kind donation by Sean Olson of the Blender community.<br /><br />At moderate scales such as shown in deriv_moddist_glsl.png you can't really tell the diff between height mapped and derivative mapped but during texture magnification you start to see the difference. The rend_*.png files were made using Blender's renderer but the glsl_*.png files were made using rendering on the gpu.<br /><br />As you see the faceted appearance is gone when using derivative maps.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-4103286816546844632011-08-17T17:22:47.874-07:002011-08-17T17:22:47.874-07:00Hey Josh,
You were asking for some pictures/demo....Hey Josh,<br /><br />You were asking for some pictures/demo.<br /><br />I uploaded a screen shot of this working in blender --> http://jbit.net/~sparky/makedudv/blender_support/scr_shot.png<br /><br />The one on the left is using listing 2 (ie. a height map) and the one on the right is using a derivative map (the code here in the blog).<br /><br />I made a patch for blender that people can try if they want which is available here --> <br />http://jbit.net/~sparky/makedudv/blender_support/deriv_mm.patch<br /><br />Finally, I made a free tool "makedudv" which can convert height maps into derivative maps incl. support for exr and hdr.<br /><br />http://jbit.net/~sparky/makedudv/Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-11954489885326070432011-08-03T17:05:58.421-07:002011-08-03T17:05:58.421-07:00What you'll see here though is that it does no...What you'll see here though is that it does not matter what kind of local extension you have of the heights function to the 3D neighborhood. Any extension to a local open volume will work with equations 2 and 4. Perhaps not much of a surprise. And as I explained the other take-away is that any parametrization that leads to the same surface and the same distribution of heights can be used to produce the surface gradient (eq. 3) and thus Blinn's perturbed normal in eq. 4. <br /><br />The surface gradient is also useful for other things. For instance if you have some scalar function across your surface s(p) and you need ddx(s) then if you can produce the surface gradient of s then you can get ddx(s) by doing:<br /><br />ddx(s) = dot(ddx(surf_pos), surf_grad(s))<br /><br />and similar for ddy. Another nice thing is that ddx(surf_pos) and ddy(surf_pos) can be computed analytically so these properties could come in handy in some fancy compute shader that needs to determine ddx(s) and ddx(t) and so on to sample with filtering/mip mapping enabled.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-86135259317291538932011-08-03T16:13:24.564-07:002011-08-03T16:13:24.564-07:00Yeah, Brian's construction essentially project...Yeah, Brian's construction essentially projects the surface functions and surface gradients into new 3D functions defined in the local 3D neighborhood of the surface. I'd expect the math to work out the same.Marc Olanohttps://www.blogger.com/profile/14615940297129658864noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-44837257520317611522011-08-02T12:38:16.977-07:002011-08-02T12:38:16.977-07:00I think I am beginning to understand your question...I think I am beginning to understand your question. Here is how I like to think of the surface gradient of a scalar field over a surface.<br /><br />I think of it as, locally, using an arbitrary rotation that transforms the surface such that the tangent plane ends up in the XY-plane. Here we evaluate the derivatives of the height function in the x and y direction (dH/dx, dH/dy, 0). This 3 component vector is then rotated back out.<br /><br />Of course another way to think of it is simply as given in eq. 2 where it's the regular gradient projected into the tangent plane.<br /><br />Anyway, not sure if this brings us much closer to answering your question :) Imo this route just leads us to what we already know which is we can use any parametrization that we like.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-61533356597106603702011-08-02T12:27:07.467-07:002011-08-02T12:27:07.467-07:00Just caught this part in your post "Since dot...Just caught this part in your post "Since dot(N,grad(h)) was defined to be zero".<br /><br />So yes you are definitely aware of the distinction I was pointing out :)Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-60910174539558074242011-08-02T12:10:18.555-07:002011-08-02T12:10:18.555-07:00You probably realize this already but just in case...You probably realize this already but just in case I thought I'd point out that in the paper I show that Ken's perturbation normalize(N - grad(h)) is actually not entirely correct. You can see the visual difference in figure 2. The correct equation which is 100% identical to Blinn's perturbed normal is using the surface gradient<br />normalize(N - surfgrad(h)). This formulation is entirely general. It does not matter if the height h is defined on a volume or a domain.<br /><br />If h is defined over a volume then the surfgrad(h) is given by eq. 2 and if defined over a 2D domain (parametrized) then by eq. 3<br />A super cool thing about eq. 3 is that it doesn't matter which parametrization you use. Any handy one you have will lead to the same surface gradient (since there is only one).<br /><br />So assuming this was all clear let me try and understand what you mean by tangent space independent. The surface gradient is obviously confined to the tangent plane (a 3 component vector). And it does not depend on the underlying parametrization that is used. So I am not 100% sure what you mean. Perhaps you could clarify?<br /><br />Cheers though :)<br /><br />Morten.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-67638703782092313232011-08-02T11:29:02.305-07:002011-08-02T11:29:02.305-07:00Reminds me of my favorite alternate derivation for...Reminds me of my favorite alternate derivation for bump mapping, which I originally heard from Brian Cabral. Given some point Q on the surface, Construct a local implicit representation of the surface f(P)=0 for P in a local 3D neighborhood of Q such that grad(f)=N and |grad(f)| = |N| = 1. Also, construct a local volumetric representation for the height field h(P) such that dot(grad(h),grad(f))=0, basically the height field extended perpendicular to the surface. Then a surface displaced by h in the normal direction is f(P)-h(P)=0. The normal to that surface is normalize(grad(f)-grad(h)). You can approximate it by evaluating at Q, in which case you get normalize(N-grad(h)). Since dot(N,grad(h)) was defined to be zero, you can deconstruct grad(h) into directional derivatives in the tangent directions, which works out to regular bump mapping. But the step just before that looks a lot like your listing 3. <br /><br />I wonder then if you could construct a tangent-space independent vGrad for any surface height field. You only need to know it on the surface, so could store it in a texture. Sort of the derivative map analog of a normal map. Also, if you did that, would it work out to essentially an object-space normal map, or would it have other advantages?Marc Olanohttps://www.blogger.com/profile/14615940297129658864noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-31420856640731595852011-08-01T11:43:10.086-07:002011-08-01T11:43:10.086-07:00I thought I would just make it clear that the deri...I thought I would just make it clear that the derivative maps I recommend here are not acquired using the (-nx/nz, -ny/nz) trick though that is of course possible. Instead I would bake out single channel 32 bit height maps and then calculate the derivative numerically as a 2D filter (off-line). This way we do not get unwanted hard edges in the lighting between faces which are adjacent at the surface but not in the unwrap (which gives tangent space splits). The reason we do not get unwanted hard edges as you often do with normal mapping is because no transformation was involved in obtaining the derivatives which is why I don't recommend (-nx/nz, -ny/nz).<br />The technique also trivially works with mirrored models since the parameter domain is the screen.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-55453673590330534912011-07-28T11:31:26.851-07:002011-07-28T11:31:26.851-07:00I must admit most of my focus has been on D3D11 co...I must admit most of my focus has been on D3D11 compliant hardware among other reasons because of requirements on filtering standards having been raized going from d3d10 to d3d11.<br /><br />My experiments using derivative maps were done using BC5 and BC6 (and not DXT5) but in my experience there is no loss in quality over normal mapping.<br /><br />Whether you're using listing 2 or derivative maps or even supporting both the sweet thing is of course that this works on all types of geometry (incl. tessellation) and there are no pregenerated spaces and no visible tangent space splits.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-79419419223131117982011-07-28T09:57:43.565-07:002011-07-28T09:57:43.565-07:00Interesting modification on an old idea. You'v...Interesting modification on an old idea. You've piqued my curiosity. <br /><br />Any chance you could post some an image/video/demo of your results? Also, now that there are two channels of data, have you looked at compression of said data? Will it suffer artifacts if used with DXT5 compression like standard normal maps?<br /><br />Thanks for the intriguing post. ;)<br /><br />PS. The last two lines could be dot products.Anonymousnoreply@blogger.com