<div dir="ltr"><div>Hi,<br></div><div><br></div><div class="gmail_quote"><div dir="ltr">On Fri, Jul 20, 2018 at 6:01 PM Geraldine Chua <<a href="mailto:chua.gsk@gmail.com">chua.gsk@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">There appears to be a bug where VDB textures are rendered with artifacts and solid shadows, but only if a volume mesh is created. I have attempted to debug the issue but cannot figure out the reason so far. In addition to this, generating a mesh takes a considerable amount of time compared to built-in smoke. A simple fix to these issues would be disabling volume mesh construction for VDB grids, but it would be nice to figure out the cause of this bug. Here is a comparison image of a VDB texture of an imported bunny_cloud:<br><br>Without volume mesh: <a href="https://i.imgur.com/ispyeGF.png" target="_blank">https://i.imgur.com/ispyeGF.png</a><br>With volume mesh: <a href="https://i.imgur.com/6hbJUYp.png" target="_blank">https://i.imgur.com/6hbJUYp.png</a></div></blockquote><div><br></div><div>I'm not sure what the cause could be. Did you try setting all the Light Paths values and volume max steps to the maximum? You can visualize the volume mesh by adding a surface shader.</div><div><br></div><div>It's not clear to me why generating the mesh should take so much time, is it really slower with a comparable grid resolution? If we are loading directly from the VDB file to sparse grids in Cycles, we should be able to build the volume mesh quicker since we don't even need to look at the individual voxels to see which ones are empty, we can just check if there is a sparse tile or not.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><b>Volume Motion Blur</b><br><br>With reference to the Stephen's previous work on volume motion blur (<a href="https://github.com/tangent-animation/blender278/pull/103" target="_blank">https://github.com/tangent-animation/blender278/pull/103</a>), I wrote a minor patch with promising results. I am uploading the diff instead of committing since it's pretty hacky and there may be more efficient ways of going about implementing it (<a href="https://developer.blender.org/P755" target="_blank">https://developer.blender.org/P755</a>).<br><br>This patch uses the Eulerian motion blur algorithm (Eulerian Motion Blur, 2007, Doyub Kim and Hyeong-Seok Ko, <a href="https://doyub.com/research/2007/emb/emb.pdf" target="_blank">https://doyub.com/research/2007/emb/emb.pdf</a>) since the Blender smoke simulator readily provides velocity data. I had difficulties figuring out how to work the sampling into the current kernel structure, so right now the advected points are calculated right before the voxel is interpolated. The point is advected 3 times (may be made customizable by the user) across the shutter speed and the densities are then averaged. Motion blur for the smoke can be enabled by checking the Motion Blur checkbox in the Render tab.<br></div></blockquote><div><br></div><div>I think the place of the code is ok, it's easiest to do it just in time to ensure we don't do it when shader evaluation doesn't need it. We can cache the velocity lookup in ShaderData so it is performed only once if multiple volume reads are done.</div><div><br></div><div>It's not clear to me why there is a <span style="font-family:monospace,monospace"><span class="gmail-gi">kernel_data.cam.motion_samples</span></span> (= 3) used here. If I understand the paper correctly, formula (7) requires two volume lookups to compute the velocity, and then there is a third volume lookup to get the requested attribute itself.</div><div><br></div><div>Request and export of the velocity grid should be disabled if the Blender object has motion blur disabled. This is done by checking if mesh->motion_steps > 0.<br></div><div><br></div><div>In principle the volume bounds also need padding to account for the motion blur, but if the velocity is not too big it's difficult to notice the difference so we could ignore that for now.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Quick example of a high vorticity smoke, with 3 samples, 0.5 shutter speed, centered on frame, and the default shutter curve:<br><br>Without motion blur: <a href="https://i.imgur.com/YvYN6Gu.png" target="_blank">https://i.imgur.com/YvYN6Gu.png</a><br>With motion blur: <a href="https://i.imgur.com/A4nBLWv.png" target="_blank">https://i.imgur.com/A4nBLWv.png</a><br></div></blockquote><div><br></div><div>Looks good so far.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><b>To-dos next week</b><br><br>Unless there are any major issues or recommended changes for any of the previous tasks, the only things left to do are cleanup and review. Brecht has given me his previous work on implementing a native Volume primtive in Blender, which I will review and see if I can work on.<br></div></blockquote><div><br></div><div>The most important thing is to finish what's there now, and fix any bugs and issues. I'll do a code review of the branch soon.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><b>Questions</b><br><ul><li>Is there a better way to implement OpenVDB import interface compared to how it currently is?</li></ul></div></blockquote><div>Not sure off hand, will look into it for the code review.<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><ul><li>Should I provide an option for the users to choose storage options for volume texture? (Currently defaults to sparse grid) If yes, where would I put it?</li></ul></div></blockquote><div>I think we can always use sparse grids, if it's significantly slower in some cases we can look at how to optimize it.<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><ul><li>Any comments on the motion blur patch?</li></ul></div></blockquote><div><span class="gmail-gi">See above.</span></div><div><span class="gmail-gi"><br></span></div><div><span class="gmail-gi">Regards,</span></div><div><span class="gmail-gi">Brecht.<br></span></div></div></div>