tag:blogger.com,1999:blog-35320919904258790.post5399197408537256442..comments2017-08-29T12:06:20.306-07:00Comments on Mikkelsen and 3D Graphics: So finally a no tangents bump demo is up!Morten S. Mikkelsenhttp://www.blogger.com/profile/11647723969880785609noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-35320919904258790.post-12130239284185414992017-06-17T21:29:45.883-07:002017-06-17T21:29:45.883-07:00Hey,
Any chance we can get the source code?
drop b...Hey,<br />Any chance we can get the source code?<br />drop box links seem broken.<br />May be github?Stefan Dyulgerovhttps://www.blogger.com/profile/04224414322512779615noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-78226027824033131242013-02-02T14:15:25.528-08:002013-02-02T14:15:25.528-08:00Thank you very much! Hopefully I can find out what...Thank you very much! Hopefully I can find out what I'm doing wrong :)Oguz Meteerhttps://www.blogger.com/profile/07657692868606669010noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-26584723367994301262013-02-02T13:04:55.953-08:002013-02-02T13:04:55.953-08:00Hi Oguz,
I apologize for the server being down bu...Hi Oguz,<br /><br />I apologize for the server being down but until it's back up<br />you can use the following for source:<br /><br />https://dl.dropbox.com/u/55891920/bump_demo/bumpdemo_src.zip<br /><br />and if you just want the binary you can use<br /><br />https://dl.dropbox.com/u/55891920/bump_demo/bumpdemo_bin.zip<br /><br />Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-76405423095813556052013-02-02T12:35:35.995-08:002013-02-02T12:35:35.995-08:00Mr. Mikkelsen, could you please re-upload the sour...Mr. Mikkelsen, could you please re-upload the source code? I've been meaning to implement your technique, but for some reason I cannot get it to work correctly and I've accidentally delete your source zip file :(Oguz Meteerhttps://www.blogger.com/profile/07657692868606669010noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-78387465472643904512012-10-05T14:17:13.630-07:002012-10-05T14:17:13.630-07:00Have you every looked into doing tessellation on t...Have you every looked into doing tessellation on the Xbox360 in XNA using Npatches?<br /><br />Basically the technique uses Npatches which seem to be allowed in XNA:<br />http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.vertexelementmethod(v=xnagamestudio.31).aspx<br />LookUp - This constant is supported only by the programmable pipeline on N-patch data, if N-patches are enabled.<br /><br />http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.vertexelementusage(v=xnagamestudio.40).aspx<br />TessellateFactor<br /><br />I've been looking for folks with more experience than me to help figure it out. I've found an old ATI sample project that had tessellation and npatches working as an example on DX10. I am now working on porting it to XNA and need some help. I purchased a ati radeon 3000x card which is basically what the xbox has in it. The ati sample works on the computer and tessellation looks great.Chad Maconhttps://www.blogger.com/profile/08330653022258508653noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-7622131819231516472012-03-03T01:24:24.677-08:002012-03-03T01:24:24.677-08:00Amazing info. Great job. I really appreciate your ...Amazing info. 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-21965770648230569622012-01-23T16:08:02.696-08:002012-01-23T16:08:02.696-08:00Thanks for the kind words :)
And that's a nea...Thanks for the kind words :)<br /><br />And that's a neat trick you're suggesting I'll have to give it a shot here and see if I get a reduction in instruction count as well.<br /><br />As for magic scales you are correct in the sense that we now have a bump scale we can adjust on the run-time part. Of course in regards to the offline part artists have always had a scale to adjust when converting height maps to normal maps so in regards to range utilization nothing has changed in this regard.<br /><br />As for derivative maps baked using xNormal the demo shows how to compute the inverse scale of what xNormal used to produce the baked normal map. The most recent version of the demo has a third example http://mmikkelsen3d.blogspot.com/2012/01/how-to-do-more-generic-derivative-map.html which shows how to maintain scale invariance even when using UV scales and offsets.<br />Scale invariance is of course a feature we are used to when using traditional normal mapping. Anyway, I agree that it's both a freedom and an added complexity to the whole thing.<br /><br />You are probably familiar with all of this but I thought I'd point it out just in case.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-27501759107876762032012-01-23T15:25:45.625-08:002012-01-23T15:25:45.625-08:00I think this is pretty inspiring work. It is seldo...I think this is pretty inspiring work. It is seldom I read a paper that gives mean entirely new perspective on a topic I thought I already knew. That it also leads to a practical solution is even better :)<br /><br />I have experimented with derivative maps at work, and it works as advertised, with the small caveat that you now have another magic parameter (the maximum derivative) to tweak. I was a little worried that the new distribution of representable directions would require more precision, but it seems, with a bit of tweaking, you can get reasonable results even with dxt5 (green+alpha) encoding.<br /><br />Not having to worry about generating tangent space vectors, which is especially nice for dynamic objects, makes this feel like a much more elegant solution. The linearity of the maps is a particularly nice added bonus, especially for us, as we do a lot of normal map blending.<br /><br />That the derivative map of the blend of two heightmaps is the same as the blend of their derivative maps gives it all a nice physical interpretation - it just feels natural, whereas blending normal maps does not! You are left with either blending the normals directly (yuck) or essentially transforming them to derivatives (divide by z), blending and then transforming them back (yuck^2). This gets perticularly ackward if the normals are not from the same tangent space. With derivative maps this is all simple and elegant.<br /><br />Implementing this I also noticed what seems to be a small optimization opportunity. It seems the following expressions in the transformation from derivatives to normal can be simplified slightly:<br /><br />float3 vGrad = sign(fDet) * ( dHdxy.x * R1 + dHdxy.y * R2 );<br />return normalize( abs(fDet)*surf_norm - vGrad);<br /><br />As we end up with normalizing the result, we can freely multiply (abs(fDet)*surf_norm - vGrad) with any scalar, as long as it's positive. If we multiply the expression with abs(fDet), use the identities abs(fDet)^2=fDet^2 and sign(fDet)abs(fDet)=fDet and rearrange the terms we end up with:<br /><br />float3 vGrad = ( dHdxy.x * R1 + dHdxy.y * R2 );<br />return normalize( fDet*(fDet*surf_norm - vGrad));<br /><br />Although it is the same number of muls and adds, we now got rid of the abs and the sign. abs is essentially free, but sign is not. This of course depends on the platform, but I can't really see it being worse. In terms of d3d9 shader assembly it seems to be a saving of 3 instructions.<br /><br />But I guess in many cases you know that fDet is always of the same sign (when dot(face_normal, vertex_normal) is always of the same sign). In this case, this is not really relevant, and you can omit the outermost multiplication with fDet as well.<br /><br />Keep doing cool stuff! :)stubbehttps://www.blogger.com/profile/10023036392065207458noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-52884609168015828262011-12-21T07:12:05.962-08:002011-12-21T07:12:05.962-08:00>Is there any operation to do in postprocess af...>Is there any operation to do in postprocess after the mix, like normalize for normal map<br /><br />Yes I mean like lerp. And no there's nothing you have to do after mixing/lerping derivatives to normalize. You can mix as you please with impunity. Once you're done you just use the final derivative. <br /><br />You can mix these height derivatives as long as they are given w.r.t. the same domain. So for instance mixing in photoshop works. You can do the same thing in a shader but here you can even mix when they are not given w.r.t. the same domain space as you see in the triplanar bump shader. All 3 height derivatives are obtained and are then obtained w.r.t. screen-space and then are finally mixed here. The final height derivative is then just inserted into the usual normal perturbation code. Hope that clears it up. This is a strong advantage to this technique that it's so extremely flexible when it comes to combining derivative signals.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-65042420019269430962011-12-21T05:42:57.386-08:002011-12-21T05:42:57.386-08:00Thank you for all the advices.
> you can mix f...Thank you for all the advices.<br /><br />> you can mix freely between multiple derivative maps<br /><br />by mix, you mean "lerp" ? Is there any operation to do in postprocess after the mix, like normalize for normal map ?<br /><br />CheersSébastien Lagardehttps://www.blogger.com/profile/11170507314218400784noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-41405793590146412152011-12-19T17:55:53.048-08:002011-12-19T17:55:53.048-08:00In the reduce intensity case I meant (128,128,0) o...In the reduce intensity case I meant (128,128,0) of course unless you did a ctrl+i on it in which case it becomes (128,128,255) that you want to mix with.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-75396352362219772532011-12-19T17:16:25.592-08:002011-12-19T17:16:25.592-08:00Sorry here I am posting again :) I just wanted to ...Sorry here I am posting again :) I just wanted to say also as you see in the demo in many cases you can even get very reasonable results even by using a BC4 height map instead of a BC5 derivative map. The BC5 derivative map is same size as a normal map but a BC4 height map is half the size. So this is another motivation for height maps. The height map that's in the demo is one that I reversed from the derivative map using my own commandline tool but of course if the artist actually works with height maps this would not be needed.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-3792695992265622882011-12-19T17:00:46.613-08:002011-12-19T17:00:46.613-08:00Actually, tweaking derivative maps is probably sli...Actually, tweaking derivative maps is probably slightly easier because the blue channel has no impact on results. you can mix freely between multiple derivative maps. If you want to reduce intensity then simply mix the derivative map with another map that's (128,128,128)Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-76559185226742886772011-12-19T16:57:21.788-08:002011-12-19T16:57:21.788-08:00To you David just wanted to say thank for the feed...To you David just wanted to say thank for the feedback and if you ever get your hands on some screen shots using this with your stuff I'd love for you to show them :) Thanks.<br /><br />As for you Sebastien thank you to you too.<br />I do have several things to say actually. First of all tweaking a derivative map is no harder then tweaking a normal map from an artists point of view. About the same. If he wants a more familiar look he can do ctrl+i in photoshop on all 3 channels and it'll look a lot like a normal map though in reality blue channel is completely unused. Also yes the method definitely works with skinning.<br /><br />If the artist is looking for ways that are more intuitive to interface with his bump map then another approach which I am personally a huge fan of is working on floating point height maps during the authoring stage. You can export these from zbrush (or multi-res bake in Blender). Other options are of course painting bump maps using Blender where you can see the lit result interactively:<br /><br />http://cgcookie.com/blender/2011/10/18/using-the-texture-paint-layer-add-on/<br />http://vimeo.com/21186170<br /><br />On the code/tools side you could simply convert to a derivative map at the last minute but still allow the artist to work on a floating point height map until the end.<br /><br />If not then using ctrl+i should still let him get away with quite a lot of how he's used to tweaking normal maps.Morten S. Mikkelsenhttps://www.blogger.com/profile/11647723969880785609noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-58759951579616336642011-12-19T16:11:29.883-08:002011-12-19T16:11:29.883-08:00Once again, nice work!
I discuss derivative map w...Once again, nice work!<br /><br />I discuss derivative map with a character artist which tell me how to tweak the derivative map once generated by xnormal ?<br /><br />Do you have any advice for him ? Actually, the artist generate normal map with xnormal then tweak it under crazybump or even photoshop. What could be a good workflow for derivative map ?<br /><br />And as a side question, is the technic supporting skinned character (But I am sure it should :) ) ?<br /><br />Thank you for sharing your great work.Sébastien Lagardehttps://www.blogger.com/profile/11170507314218400784noreply@blogger.comtag:blogger.com,1999:blog-35320919904258790.post-60007909609961332532011-12-17T02:56:18.408-08:002011-12-17T02:56:18.408-08:00Very nice work :-) I've been watching your blo...Very nice work :-) I've been watching your blog for a while and do hope to test out your technique at some point. I develop a voxel terrain library (http://www.volumesoffun.com/wordpress/?page_id=8), and the terrain can be editied at runtime which basically means no precomputed UVs or tangent spaces. My users have been using triplanar texturing for a while and it seems like your technique could be a nice addition.<br /><br />DavidDavid Williamshttps://www.blogger.com/profile/06257515866652280748noreply@blogger.com