Sunday 5 February 2017

The CutAway Shader - A free Blender add on for architectural visualisation, model cutaways and more.







After 3 years in the making - I'm excited to announce the alpha release of the CutAway Shader - a free addon for Blender for artists, architects, scientists and engineers.

If you've ever wanted to cut away a cross section of a model, perform an architectural reveal or carry out some tricky special effects then this is the tool for you! 


It works for still images and for animations.

The CutAway Shader can be used for:
  • Model cut aways.
  • Architectural reveals.
  • Scientific and engineering images.
  • Filming through walls (without damaging or re-dressing the set).
  • Special effects (e.g. turning a winter scene into a summer scene).
  • Wire frame to solid model transitions.
  • ... plus much more!





What does it do?

Checkout the CutAway Shader demo reel video on YouTube

Downloading the Addon

  • Download Adddon(.zip)  
    (node_cutaway_shader.zip  v1.2 alpha)
    (This is an alpha release - so remember to save your work!)

Installation

Install the addon in Blender in the usual way. 

or just do the following:
  • File  -> Preferences -> Addons Tab -> Install from file -> node_cutaway_shader.zip
  • File  -> Preferences ->  File Tab -> Check "Auto Run Python Scripts"

Video Tutorials

  1. Installation Instructions and Very Quick Overview Video
    How to download and install the addon - and a very quick intro on how to use the shader.
      
  2. Architectural Reveal with the CutAway Shader: (YouTube link)
    Learn how to reveal the walls and furniture in a house - as seen in T.V design shows and documentaries.

    This tutorial jumps right into it with a practical example - and assumes no knowledge of how to use the shader.
     
  3. CutAway Shader Controls: Overview Tutorial
    All the CutAway Shader controls are covered  - showing what situations they're useful for and how to use them. It is assumed that the shader has already been installed.

    This tutorial is really a compilation of 11 short videos (2 min to 10 min each) covering:
  • A quick overview of the controls.
  • Setting up the CutAway Shader in your scene.
  • Adding cutaway planes.
  • Solidify and Rim Fill options.
  • Cutaway Shape: Rectangular and Circular.
  • Cutaway Shape: From Gray Scale Image.
  • Cutaway Shape: By editing the shape of the cutaway plane mesh.
  • Origin Control Buttons: To help with plane scaling and positioning.
  • Parenting Controls: Easily duplicate parent shaders to selected objects.
  • Auto and Manual Refresh: Viewport speedups.
  • Remove All CutAway Shaders button.

    Each 'mini' tutorial has a heading -- so scroll though the video to get to the desired section, or click on the quick links on the YouTube page.
 ... More tutorials to follow

How does it work? Executive summary

  1. The Cutaway Shader is added as a material node to an existing Cycles material (or materials)
     
  2. Objects in front of the 'green' side of the cutaway plane (that use the assigned materials) will be made fully or partially transparent.
     
  3. A number of helpful controls are available to:
    - Add the Cutaway Shader to multiple materials at once (parenting).
    - Draw a rim at the cutaway cross section.
    - Fadeout the cutaway edge
    - Cutaway arbitrary shapes based on gray scale images, or the shape of the cutaway plane.
      ... plus many more features. (Checkout this tutorial)

Some background info

History: 

After finishing the Open Shader language (OSL) Cycles Lens Flare shader a few years ago, I began experimenting with a few more OSL shader designs. The CutAway shader looked like it would be the quickest to finish (!!!) - so I continued with it.

I noticed with the previous Lens Flare shader release that many people did not know how to add the Blender drivers - these are needed to let the Lens Flare shader know the position of the sun (an 'Empty')  in the scene. A custom 'py-node' in front of the Lens Flare OSL shader could have automated this task. (A Blender py-node is a node that runs Python custom code)

For the CutAway shader release I decided to include a custom py-node to help automate many useful tasks (see figure to the right)

For example, the py-node adds all required drivers automatically. These let the CutAway shader know:

  • The position of the cutaway plane.
     
  • The rotation of the cutaway plane.
The custom py-node also:

  • Colours the cutaway plane in the view port (red on one side and green on the other)
     
  • Provides parenting and duplication functions.
... and a lot of other things too.

This all took quite a lot of time!

Even so, the bulk of the code was finished over two years ago - however, this was followed by the production of 12 demonstration video scenes and several tutorials.

As I am kept very busy during the day project managing this (and like most people have a very busy home life too) this project has taken  approximately 3 years to get to the alpha release stage.


Special Effects Use

Initially I imagined the CutAway shader performing the obvious tasks - Model cross section cutaways, geological cutaways and architectural reveals. But I soon became excited about other uses the shader could be put to.

Special effect Revels: The a shader can easily hide materials on one side of the 'cutaway plane' and (optionally) reveal materials on the other.

This type of effect can be seen in the demonstration video in the following scenes:
  • Winter Forest -> Summer Forrest scene.
  • Ivy growing on statue scene. 
  • Magic stairway reveal scene.
  • Island forest -> Island city scene.
  • Filming through set walls (see full video)
     
These 'special effect'  examples can easily be extended to many additional scenarios:

  • Revealing car tire tracks in the snow, or in the desert, or on a road.
  • Casting shadows in laser lights shining on a mist.
  • Animated characters 'morphing' from one costume set to another (super hero style)
  • Cat scan style cutaway sections.
  • Easily Cutting holes to let the light into a scene (without affecting the mesh or U.V wrappings)
  • ... etc

Another interesting use for the CutAway Shader is related to the 3D  pipeline work flow. The shader makes it easy to 'punch' any arbitrary shaped hole through scene elements without affecting the base mesh or U.V mapping. If a client wants to move or add an window to a scene at the last minute - none of the existing mesh or U.V work has to be re-worked. The shader will create the new hole with the desired shape and additional geometry (or existing windows etc) can be moved into place.

If the pipeline involves mesh assets the are frozen (or scene dressings that are locked) then the shader offers a new  method of  hiding (cutting away) assets that are blocking the camera view. This can be achieved without actually moving assets or redressing the scene.

This concept extends to 'filming' through set walls - without affecting a set's internal lighting setup, as the shader can be configured to only cutaway 'camera rays'. (i.e. we can look through 'solid' walls without light leaking into or out of the set!)

Filming through sets can be useful for when the desired framing and depth of field results in a lens size that forces the camera to be placed outside the walls of a small set (e.g. a small bedroom, or small space capsule).

So, the possibilities for the Cutaway Shader are surprisingly large for such a simple concept!

Give it a try!

Let me know what you think in the comments below - or e.mail:  iReboot42 at gmail dot com.

Please note:

  • This is an alpha release - so please save your work first. 
  • There are a few 'non-standard' features related to the parenting controls of the shader, These allow the CutAway Shader node to be automatically replicated among selected objects in the scene. Child copies of the parent node are added to the material nodes of selected objects (i.e this feature will alter material nodes in your scene).

Future Work

There are many features that could be added to the shader - along with some optimisations. I would like to look at micro displacement of shaded points in the drawn 'rim' to improve this effect.

Cheers

Dylan

28 comments:

  1. I have wondered when blender might get this.. its been years! Wonderful!

    ReplyDelete
  2. Realy very useful feature. Great effort to make the blender rich further. Thanks Dylan.

    R.Rangan

    ReplyDelete
  3. This is very cool, thanks for all of your hard work. I can't imagine all of the hours you must have put in to develop a tool of this complexity.

    ReplyDelete
  4. I get AutoRun disabled, with an IGNORE button and Driver 'var' next to it.

    ReplyDelete
  5. Maybe I should read the instructions first...DOH! Works great!

    ReplyDelete
  6. Realy very useful feature.Works great!

    ReplyDelete
  7. Hi ! Thank you so much for this great, helpfull, and pretty easy to use tool ! I've been missing this since I moved from 3sdmax !

    I run into a problem when cutingaway from an image which is not in the same driver as Blender : the image is not used at all (I can send an image of the error report). Is there a small dummy reason for that behavior that could be fixed easely ?

    ReplyDelete
    Replies
    1. Hi - I'm not sure straight away what is happening here. If you can send your .blend file along with an image to iReboot42 A.T gmail.com then I can have a look :-)

      Cheers

      Dylan

      Delete
  8. Hi! I have a problem: My object cuts in the xy-plane. If i add a cutaway plane, it doesnt get recognize as one. Nothing is changing.

    ReplyDelete
    Replies
    1. Hi there,

      Try the following:
      1) Check that the "Auto Run Python Scripts" is enabled (this is required)
      File => User Preferences => File Tab, Auto Execution => 'Check Auto Run Python Scripts'
      Save Preferences

      2) Re-start Blender and open your file.

      3) Add a new cut away plane, and manually delete the old one (if there is one there).

      IF this doesn't work, you can send your .blend file along with an image to iReboot42 A.T gmail.com then I can have a look.

      Hope this helps and happy Blending!

      Cheers

      Dylan

      Delete
    2. Thank you it worked! :)

      Delete
  9. Hi, great work and thanks for your hard work and effort in this add on, just one query, the use of an alpha image as a cutaway doesn't work with me, the script can't seem to find the image file unless its on the install drive location of blender, if my image files are on another drive i get a warning triangle and a failure to mount image

    ReplyDelete
    Replies
    1. Hi!

      This is one of those 'alpha release' things!
      The short answer is its on my 'to do' list to fix - so sorry about the inconvenience at the moment.

      Here are a couple of things you could try:

      Option 1) With Blender closed, try double clicking the .blend file to open it. Re-open you alpha image in the Shader and save the .blend file.

      Or

      Option 2) Open Blender, and then open the .blend file from within Blender. (Although I think this option leads to the issues you are having)

      Here is a bit of a long winded explanation of what's happening.

      I found this type of problem during development.

      I wanted the path to the image file to be 'relative' to the .blend file (for better portability) - but the 'relative path' returned by the pyrhon api changes depending on whether the .blend file is opened in Blender (this returns a relate path to the Blender .exe in Wibdows) or whether the .blend file is 'double clicked' (this returns a path relative to the .blend file).

      I would also like it to work if the object being cut away its 'linked' to from another file.

      I never found the solution for all cases. After 3yrs of overall development this issue was put on the 'to do next' list - to allow any sort of release!

      If this is preventing your project from working - I could make you a 'special' version that allows you to specify an absolute path - or something similar - but his could take a while.

      If you know some Python, I could send you the line number in the code where the path is set.
      I hope this helps, and apologies for the inconvenience!

      Cheers

      Dylan

      Delete
    2. Cheers Dylan, in the scheme of things its not a problem to move alphas to the blender root directory,its just that i've grown accustomed to keeping blender projects and all other texture/ alpha related stuff on a dedicated drive. Its not a problem to move them to root when needed for a project.Will try your suggestions, thanks!

      Delete
  10. Hi!
    I tried to use it in a very complex model, made with several linked files, but it doesn't seem to work. I can't add the shader node in the compositing.
    Do I need to append all the files?

    ReplyDelete
  11. Great add-on!
    Almost perfect for my job. I only guess if there's a way to render the cutaway plane, with a specific shader, or it must be transparent/image. My problem is that I'm modeling an under earth cave, and I want to render not only the cut section of the cave, but the cutaway plane itself too (the part outside the cave). I tried with the rim option but it doesn't seem to work for this purpose.

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. This add-on looks great, by any chance can you update it for 2.8 please?

    ReplyDelete
  14. Hi please updated this for 2.8
    This will be so useful
    Thank you

    ReplyDelete
  15. Any change for an update for 2.8? That would be awesome. Cheers!

    ReplyDelete
  16. Dylan:
    Such a clever piece of coding. I tried it out on a earlier version of Blender 2.7x and it worked quite well. Is there going to be a potential update to 2.8 now that it is out of Beta and Alpha.

    Cheer & Thanks for your sharing of talent.
    MR HOLLYWOOD

    ReplyDelete
  17. Please update for 2.9 ! Thanks for the work

    ReplyDelete
  18. It would great you find time and nerves to update the new version.
    Best Regards from Germany

    ReplyDelete
  19. Im currently working on it, it sort of works again. Do need to fine tune some minor errors im getting. Its also CPU only. but thats how it always was.

    Was kinda of hustle to convert it to the collection system. Also some parts are not working correctly now, but i think i get those working.

    ReplyDelete
  20. Im still hustling with a major part, when we use the link method lots of cutaway options are not transferred over to the child objects. It will cut away, but if you use the rim option it just wont show. It will only work on 1 object in the scene. Im not familiar with OSL language though. Ill try to keep fiddling around, see what i can do

    ReplyDelete