Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Scaling up a 3D stroke

  • Scaling up a 3D stroke

    Posted by James Dean on September 11, 2015 at 12:19 pm

    Hi all,

    I’ve got a LOT of comps each containing a single solid with 3D stroke and a camera.

    I’d like to try up-rezing the comps to about 4 times their current resolution. Pre-composing and scaling creates predictably soft results. Pre-composing, scaling and using continuous transforms doesn’t help. Using the Detail Preserving Upscale plugin doesn’t look any better than a conventional scale.

    SO, I’m trying to rebuild the comps. My thought process is this:

    1) Change the dimensions of the comp. I’m doing this through scripting rather than the AE front end so that it doesn’t ‘helpfully’ recentre everything.
    2) Update the solid to match the new comp dimensions.

    3)Since masks and effect properties are stored internally relative to the dimension of the solid, the mask shape and spatial effect parameters have all been multiplied by 4. I use a script to scale them back.

    Now every parameter (effect settings, camera position, mask co-ordinates) are the same in my new and old comps but I’m not getting anything even visually close to the original comp.

    Has anyone else tried to achieve something similar?

    Cheers,

    James.

    James Dean replied 10 years, 8 months ago 53,752 Members · 1 Reply
  • 1 Reply
  • James Dean

    September 11, 2015 at 7:36 pm

    Hi Dave,

    I agree that the end result of running the effect is a bitmap, but 3D Stroke is parametrically controlled, so I’m looking for a way to change the parameters to give me the same image at a higher res.

    I pushed on with my original thinking and I think I’ve got it cracked…

    Should anyone need to do this or something similar then the code below should do it (WARNING – SCRAPPY CODE WITH NO ERROR CHECKING! – SAVE YOUR PROJECT FIRST!). Just run this from the ExtendScript Toolkit.


    scaleFactor = 5; // this is what we're going to scale the comp by
    targetLayer = "stroke 2" //put the name of the layer containing 3D Stroke

    app.beginUndoGroup("rescale 3D Stroke comp");
    c = app.project.activeItem;
    originalEffect = c.layer(targetLayer).effect("3D Stroke");
    bend = originalEffect("Bend").value;
    pos = originalEffect("XY Position").value;
    d = c.duplicate();
    d.name = c.name + "(x"+scaleFactor+")"
    d.width = d.width*scaleFactor;
    d.height = d.height*scaleFactor;
    l = d.layer(targetLayer);

    var strokeEffect = l.effect("3D Stroke");
    strokeEffect("Bend").setValue(bend*scaleFactor);
    strokeEffect("XY Position").setValue(pos/scaleFactor);
    d.activeCamera.zoom.setValue(d.activeCamera.zoom.value*scaleFactor);

    tempLayer = d.layers.addSolid([0,0,0],"scriptSolid", d.width, d.height, 1.0);
    l.replaceSource(tempLayer.source,false);
    tempLayer.remove()
    l.anchorPoint.setValue([0.0,0.0]);
    l.position.setValue([0,0]);
    myShape = l.mask(1).maskShape.value;
    var verts = [];
    for(e in myShape.vertices) {
    var oldPoint = myShape.vertices[e];
    var newPoint = [(oldPoint[0]-(d.width/2))/scaleFactor +(d.width/2),(oldPoint[1]-(d.height/2))/scaleFactor + (d.height/2)];
    verts.push(newPoint);
    }
    myShape.vertices = verts;
    l.mask(1).maskPath.setValue(myShape);
    app.endUndoGroup();

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy