Jump to: Board index » General » Fusion

How to depth mask 3d particle system with render elements?

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

How to depth mask 3d particle system with render elements?

PostWed Sep 20, 2017 12:13 pm

Wondering if someone could help me with my workflow?

I am working on an animation (moving cameras) and rendering from 3DS Max Vray - I've created a 3D particle system in fusion and in terms of parallax & DOF it looks pretty decent. I am using cameras that I imported from Max.

Currently I've used several animated rectangle shapes to mask the dust once it has been rendered by the render3D node, and it looks pretty decent, but ultimately I wish to somehow use Z depth or some fusion goodness to automate the masking and make the solution more accurate.

For example in some areas I can see the small (far) particles that should be behind objects.

I have used the deep compositing in Nuke - but I've not seen something similar in Fusion.

Note: I'm a noob with Fusion...
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline
User avatar

Adelson Munhoz

  • Posts: 271
  • Joined: Thu Mar 05, 2015 5:44 pm

Re: How to depth mask 3d particle system with render element

PostWed Sep 20, 2017 3:08 pm

Not sure if it will work for you, but Fusion has a Volume Mask Tool:

Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

Re: How to depth mask 3d particle system with render element

PostThu Sep 21, 2017 5:28 am

Nice - thanks for that - just added the appropriate render elements - will give this a try.
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

Re: How to depth mask 3d particle system with render element

PostThu Sep 21, 2017 10:25 pm

Not sure this can do what I need.

I have my RGB piped into the BG of a merge
My particle system is piped into the FG of the merge
The volume mask of a selected depth is used as a mask within the merge node.

With the resulting mask being 2D, there's isn't really much benefit in terms of depth sorting over using my original approach.
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

Re: How to depth mask 3d particle system with render element

PostThu Sep 21, 2017 10:54 pm

As a bit of a hack I can import my 3ds max geometry and camera, apply a black Blinn material to the geo and add that to the merge 3D containing the particle system. And then screen the render3D results over the top of my beauty pass.

Not a fan of this solution.
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline

David_Cox

  • Posts: 108
  • Joined: Thu Aug 03, 2017 11:20 pm
  • Location: London UK

Re: How to depth mask 3d particle system with render element

PostThu Sep 21, 2017 11:50 pm

You should theoretically be able to do it with the "Perform Depth Merge" in the 2d Merge Channels tab.

This takes two 2D inputs each with a depth channel and keys one over the other based on which one is closer to the camera. In theory, one of your 2D images would be your rendered CGI scene with a depth map and the other would be the 2d render of your particle scene, again with a depth map. Only the particles that are closer to the camera would be keyed over your scene.

BUT...

Depth maps aren't anti aliased and often fall flat when used as key sources. Also, you would need to ensure that the scale of each depth map matched to get accurate ordering. I suspect your less preferred option of bringing in your CGI scene as a 3D mask might be the best one.

DC
Showreels: vimeo.com/davidcoxtv
Website: www.davidcox.tv
Offline

David_Cox

  • Posts: 108
  • Joined: Thu Aug 03, 2017 11:20 pm
  • Location: London UK

Re: How to depth mask 3d particle system with render element

PostFri Sep 22, 2017 12:11 am

Ok, I had to test out that idea. See image. Top line of nodes render a 3D cube with a depth channel. Bottom line creates particles with a depth channel. The right-most merge has the "perform depth merge" enabled in it's channels tab. The particles are correctly keyed by depth, but are a little blocky because of the depth map.

depthKey.jpg
depthKey.jpg (357.3 KiB) Viewed 5913 times
Showreels: vimeo.com/davidcoxtv
Website: www.davidcox.tv
Offline
User avatar

Adelson Munhoz

  • Posts: 271
  • Joined: Thu Mar 05, 2015 5:44 pm

Re: How to depth mask 3d particle system with render element

PostFri Sep 22, 2017 12:24 am

@ David Cox.

A few questions:

1 - Are you setting your renders to 16 or 32 bit float? That's necessary to get a Z-depth with the granularity needed for a good depth merge (and depth blur, if you are going to use it)

2 - Are you turning on the "Super Sampling" for each channel in the render nodes?

3 - Are you setting the transparency of the renders to "Sorted (accurate)" ?

@ David Spittle

Since you brought your geometry to the comp, You can use it as a Matte to the particles using the "Is Matte" Option :
Clipboard01.jpg
Clipboard01.jpg (18.66 KiB) Viewed 5907 times


You will have to merge them in a Merge3D node to do it.
Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

Re: How to depth mask 3d particle system with render element

PostFri Sep 22, 2017 9:03 am

Thanks for the support guys - it's much appreciated, I'll try your suggestions in the morning.
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline

David_Cox

  • Posts: 108
  • Joined: Thu Aug 03, 2017 11:20 pm
  • Location: London UK

Re: How to depth mask 3d particle system with render element

PostFri Sep 22, 2017 10:07 am

Good points from @Adelson Munhoz. In answer:

(1) yes it was 32 bit float
(2) I forgot about ticking SS for the quick test I did. Should improve things.
(3) Transparency....

Transparency is where there could be issues, depending on particle density. Imagine an area where there are multiple overlapping semitransparent particles that ultimately combine to make a solid white area. The downstream merge tool then only sees a solid white blob in that area, whith a single depth value for the closest particle, and can't "unpick" that white to discard all the deeper particles that should be obscured and so not contribute to the solid white. I can imagine that low density dust particles might evade this issue, but thick smoke wouldn't. (This is the argument around true deep pixel compositing where a pixel can have multiple depth values).

Depending on density, I actually found that Transparency mode "Z Buffer (fast") and "Sorted (accurate)" each worked better in different scenarios.

DC
Showreels: vimeo.com/davidcoxtv
Website: www.davidcox.tv
Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

Re: How to depth mask 3d particle system with render element

PostMon Oct 02, 2017 8:16 am

So that seemed to work quite well.

Unfortunately I ran into another issue - my particles kept flickering to the point where I removed the dust altogether.

Can anyone recommend a tutorial for adding dust particles using sprites (actually I was using one original but I can't find it).

The method I used was to extend the timeline into the minus i.e. -100 frames, then key the pEmitter 'number' to stay at 60 between frames -100 & -1, and then from there it was keyed to zero. I was hoping that no more particles would be emitted.

The sprites I used consisted to 5 png files which were plugged into the bitmap Style with the time offset modified with 'shake'.

The result was flickering with dust particals seeming to pop on and off.
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline

David_Cox

  • Posts: 108
  • Joined: Thu Aug 03, 2017 11:20 pm
  • Location: London UK

Re: How to depth mask 3d particle system with render element

PostMon Oct 02, 2017 9:20 am

About the flicker, could it be that you are running out of source animation frames (assuming that your 5 png files make a 5 frame sequence)? On the loader which brings them into the comp, check the "loop" option and just check that when played, you get a clean loop and no blank frames. If you do, you can adjust the trim in / out to cut off the empty frames.

DC
Showreels: vimeo.com/davidcoxtv
Website: www.davidcox.tv
Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

Re: How to depth mask 3d particle system with render element

PostTue Oct 03, 2017 12:31 pm

Perhaps the issue is that the 5 pngs are running as a sequence instead of five separate dust sprites. I was originally watching an after effects tutorial which I tried to adapt for Fusion. Actually I've watched several and I'm trying to piece them all together.

*edit* I don't think that's the issue (or perhaps there are multiple issues!) as the 'blob' particle also flickers. The point particle doesn't.
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline

David_Cox

  • Posts: 108
  • Joined: Thu Aug 03, 2017 11:20 pm
  • Location: London UK

Re: How to depth mask 3d particle system with render element

PostTue Oct 03, 2017 1:46 pm

Try copying the code below and pasting it into Fusion. It's just a basic dust particle setup which isn't flickering on my system. If it flickers on yours, then we can look at hardware issues. If not, then we can look at anything else in your main setup that could cause it.

*edit* This has 100,000 particles defined at frame 0 of the pEmitter node. Drop this if you want to speed things up a little!

Code: Select all
{
   Tools = ordered() {
      pEmitter1 = pEmitter {
         ID = 1,
         Inputs = {
            Number = Input {
               SourceOp = "pEmitter1Number",
               Source = "Value",
            },
            Lifespan = Input { Value = 250, },
            Style = Input { Value = FuID { "ParticleStyleBlob" }, },
            ["ParticleStyle.SizeControls"] = Input { Value = 1, },
            ["ParticleStyle.Size"] = Input { Value = 0.01, },
            ["ParticleStyle.SizeOverLife"] = Input {
               SourceOp = "pEmitter1SizeoverLife",
               Source = "Value",
            },
            ["ParticleStyle.BlurOverLife"] = Input {
               SourceOp = "pEmitter1BluroverLife2D",
               Source = "Value",
            },
            ["SphereRgn.Size"] = Input { Value = 5, }
         },
         ViewInfo = OperatorInfo { Pos = { 507, 153 } },
      },
      pEmitter1Number = BezierSpline {
         SplineColor = { Red = 233, Green = 206, Blue = 78 },
         NameSet = true,
         KeyFrames = {
            [0] = { 100000, RH = { 0.333333333333333, 66666.6666666667 }, Flags = { Linear = true } },
            [1] = { 0, LH = { 0.666666666666667, 33333.3333333333 }, Flags = { Linear = true } }
         }
      },
      pEmitter1SizeoverLife = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      pEmitter1BluroverLife2D = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      pTurbulence1 = pTurbulence {
         ID = 8,
         Inputs = {
            XStrength = Input { Value = 0.064, },
            YStrength = Input { Value = 0.068, },
            StrengthOverLifeLUT = Input {
               SourceOp = "pTurbulence1StrengthoverLifeLUT",
               Source = "Value",
            },
            Density = Input { Value = 41.9, },
            Input = Input {
               SourceOp = "pEmitter1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 632, 155 } },
      },
      pTurbulence1StrengthoverLifeLUT = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      Merge3D1 = Merge3D {
         Inputs = {
            SceneInput1 = Input {
               SourceOp = "pRender1",
               Source = "Output",
            },
            SceneInput2 = Input {
               SourceOp = "Camera3D1",
               Source = "Output",
            },
            SceneInput3 = Input {
               SourceOp = "SpotLight1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 905, 159 } },
      },
      Camera3D1 = Camera3D {
         Inputs = {
            ["Transform3DOp.Translate.Z"] = Input { Value = 6.52538683098039, },
            AoV = Input { Value = 19.2642683071402, },
            ["Stereo.Mode"] = Input { Value = FuID { "OffAxis" }, },
            FilmGate = Input { Value = FuID { "BMD_URSA_4K_16x9" }, },
            ApertureW = Input { Value = 0.831496062992126, },
            ApertureH = Input { Value = 0.467716535433071, },
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 2, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 2, },
         },
         ViewInfo = OperatorInfo { Pos = { 763, 203 } },
      },
      pRender1 = pRender {
         Inputs = {
            _MotionBlurWarning = Input { Disabled = true, },
            GlobalOut = Input { Value = 250, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            OutputMode = Input { Disabled = true, },
            IntegrationMethod = Input { Value = FuID { "RK4" }, },
            ["MaterialID.MaterialID"] = Input { Value = 1, },
            ["ObjectID.ObjectID"] = Input { Value = 1, },
            Input = Input {
               SourceOp = "pTurbulence1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 756, 154 } },
      },
      SpotLight1 = LightSpot {
         Inputs = {
            ["Transform3DOp.Translate.X"] = Input { Value = 3.02173288844513, },
            ["Transform3DOp.Translate.Y"] = Input { Value = 7.09220679260495, },
            ["Transform3DOp.Translate.Z"] = Input { Value = 3.23228473982805, },
            ["Transform3DOp.Rotate.X"] = Input { Value = -65.9677608790807, },
            ["Transform3DOp.Rotate.Y"] = Input { Value = 8.77350342972204, },
            ["Transform3DOp.Rotate.Z"] = Input { Value = -18.8841345245019, },
            Intensity = Input { Value = 2, },
            ConeAngle = Input { Value = 2.69, },
            PenumbraAngle = Input { Value = 6.5, },
            Dropoff = Input { Value = 1.573, },
         },
         ViewInfo = OperatorInfo { Pos = { 763, 256 } },
      },
      Renderer3D1 = Renderer3D {
         CustomData = {
            ToolVersion = 2,
         },
         Inputs = {
            GlobalOut = Input { Value = 250, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            SceneInput = Input {
               SourceOp = "Merge3D1",
               Source = "Output",
            },
            RendererType = Input { Value = FuID { "RendererOpenGL" }, },
            ["RendererOpenGL.Channels.Nest"] = Input { Value = 1, },
            ["RendererOpenGL.Channels.Z"] = Input { Value = 1, },
            ["RendererOpenGL.LightingEnabled"] = Input { Value = 1, },
            ["RendererOpenGL.TransparencySorting"] = Input { Value = 1, },
            ["RendererSoftware.Channels.Nest"] = Input { Value = 1, },
            ["RendererSoftware.Channels.Z"] = Input { Value = 1, },
            ["RendererSoftware.LightingEnabled"] = Input { Value = 1, },
         },
         ViewInfo = OperatorInfo { Pos = { 1028, 160 } },
      },
      DepthBlur1 = DepthBlur {
         Inputs = {
            XBlurSize = Input { Value = 1.54, },
            FocalPoint = Input { Value = -7, },
            ZScale = Input { Value = 10, },
            Input = Input {
               SourceOp = "Renderer3D1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1170, 157 } },
      },
      Blur1 = Blur {
         CtrlWZoom = false,
         Inputs = {
            XBlurSize = Input { Value = 0.5, },
            Input = Input {
               SourceOp = "DepthBlur1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1280, 157 } },
      },
      Merge1 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Blur1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 1390, 155 } },
      },
      Background1 = Background {
         Inputs = {
            GlobalOut = Input { Value = 250, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
         },
         ViewInfo = OperatorInfo { Pos = { 1387, 96 } },
      }
   }
}
Showreels: vimeo.com/davidcoxtv
Website: www.davidcox.tv
Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

Re: How to depth mask 3d particle system with render element

PostMon Oct 09, 2017 9:57 am

Hi

That seems to be working well - there's a tiny bit of flicker when I use my sprite but I think that could be the anti aliasing it it's miles away from my original setup. I still need to add this to my original comp but the projects is finished and I'm flat out on something else now.

Do you know how I would use the separate sprites to get some variation to the dust particles? Note: they're not part of a sequence.

Thanks a lot for your help on this, it's appreciated.
Attachments
Dust02.png
Dust02.png (16.15 KiB) Viewed 5668 times
Dust01.png
Dust01.png (16.17 KiB) Viewed 5668 times
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline

David_Cox

  • Posts: 108
  • Joined: Thu Aug 03, 2017 11:20 pm
  • Location: London UK

Re: How to depth mask 3d particle system with render element

PostMon Oct 09, 2017 10:25 am

A quick way of using the different dust sprites would be to just have more pEmitter/pRender nodes feeding the Merge3D node, each with a different sprite attached. So if you started with a single emitter with 10,000 particles, you would change that to (say) 5 emitters each with 2,000 particles, but each fed with one of 5 different sprites. Just remember to set the random seed number in each pEmitter to be unique, or else all your different dust particles will sit in exactly the same position :-)
DC
Showreels: vimeo.com/davidcoxtv
Website: www.davidcox.tv
Offline

David Spittle

  • Posts: 28
  • Joined: Sat Sep 16, 2017 1:12 pm
  • Location: Brisbane

Re: How to depth mask 3d particle system with render element

PostTue Oct 10, 2017 7:17 am

Makes sense, thanks again.
Specs WS: AMD Threadripper 1950x 16c/32t, 64GB RAM, GTX 1080ti, Win10 Pro. Fusion Studio 9
Specs Laptop: Dell XPS15 9550, i7-6700HQ 4c/8t, 32GB RAM, GTX960M, Win10 Pro, FS9
www.davidspittle.com
Offline

shirogtr

  • Posts: 9
  • Joined: Sun Sep 29, 2019 6:58 pm
  • Location: Poland
  • Real Name: Piotr Szeniawski

Re: How to depth mask 3d particle system with render element

PostTue Dec 24, 2019 12:38 pm

I believe what David meant is a solution like deep compositing.



I recently struggle with the same problem. I prepared and rendered a scene containing multiple sources of different particles (point particles and smoke) in 3DS Max, Vray and Phoenix FD. I would like to composite some Fusion particles with defocus to the scene. I that case importing geometry to Fusion is just not enough.

I wonder if using 32 bit Z depth map and creating something like a point could would be possible.

Return to Fusion

Who is online

Users browsing this forum: No registered users and 36 guests