Thursday 3 June 2010

Creating Bokeh effects in 3dsmax with particle flow

Will upload my results upon completion, but i am working on a varied version of this:

Bokeh effect tutorial
by vitsly

VIMEO UPLOAD TO GO HERE


First create your Bokeh assets.

Here a few links for some beautiful premade Bokeh light flashes. Creating by the fantastic RegularJane on Deviantart.

Collection 01
Collection 02
Collection 03
Collection 04
Collection 05
Another interesting pack



Cut them with your image editing program and make them transparencied PNG's or TIFF's



Setup the multi/sub object material in 3ds max for 10 ID’s, with additive transparency.



Put the white-to-black gradient ramp texture to the opacity slot using the second UV channel.



Put the bokeh images sequence into the diffuse slots using the first UV channel.
Let’s make the particle flow system based on some interesting complex geometry, e.g. some twisted helix splines.
Set proper number of the vertices in the Birth operator, and also set location: selected in the Position Object operator.



Use Mesh select over all splines to convert splines to mesh vertices.
Add Material Dynamic operator with prepared multi/sub object material to the PFlow event.




Let the Shape Facing operator, oriented to the Target Camera define particles shape.

And now the main part of the tutorial – add the Script operator with the following script:

on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useScale = true
pCont.usePosition = true
pCont.useMapping = true
)
on Init pCont do
(
)
on Proceed pCont do
(
count = pCont.NumParticles()
tarpos = $Camera01.Target.position
campos = $Camera01.position
for i in 1 to count do
(
pCont.particleIndex = i
pCont.setParticleMapping i 2 [abs((distance campos tarpos)-(distance campos pCont.particlePosition))/500,0,0]
— all the particles get the UV coordinates at 2-nd UV channel here.
— UV coords depends on the distance to camera’s focus “sphere”.

pCont.particleScale = abs((distance campos tarpos)-(distance pCont.particlePosition campos))/5
— here is the dependence of the particle’s scale defined
— “focused” particles are small, as they moving away from the focus – they are becoming bigger.

)
)
on Release pCont do
(
)

This script will define particle’s scale and transparency depends on camera’s focus.
Now you can animate the geometry or the camera and render the particles with scanline.
Don’t forget to cache all the particles for viewport/render using the Cache operator.
This setup renders pretty fast as opposed to mental ray’s or vray’s honest dof.

And we have fast bokeh effect with the ability to inceract with scene geometry.
Problem solved!

No comments:

Post a Comment