Script to blacken all objects except emissive for glow mask compositing

mCasualmCasual Posts: 4,607
edited September 2020 in Freebies

https://sites.google.com/site/mcasualsdazscripts9/mcjallblackexceptemissive

______________________________________________

Run the script

Click the "Do It" button

all materials except those with the 'Emissive' tag will have their Diffuse Color turned black

you can undo this after exiting the script

Edit / Undo / mcjAllBlackExceptEmissive

render the emissive-only scene from the same camera as your real render

use your favorite paint program to gaussian-blur the emissive-only render

push the lightness and contrast up

layer this on top of your real render using for example the "screen" effect

mcjAllBlackExceptEmissive.dsa.png
364 x 364 - 221K
tahiti17enhanced.png
1080 x 1920 - 3M
tahiti17.png
1080 x 1920 - 3M
darkness.jpg
540 x 960 - 16K
Post edited by mCasual on

Comments

  • DaventakiDaventaki Posts: 1,624

    Thank you!!

  • PaintboxPaintbox Posts: 1,633

    You wizard! Cool stuff!

  • Nice, very useful. Thank you

  • WendyLuvsCatzWendyLuvsCatz Posts: 38,198

    I was unaware of this until it was just pointed out by juvesatriani heart

  • When I try to use the script, it gives out this error in the log;

     

    "2021-10-12 20:30:20.353 WARNING: Script Error: Line 98
    2021-10-12 20:30:20.353 WARNING: ReferenceError: Can't find variable: black"

    I assume this is due to my system language being finnish?

  • WendyLuvsCatzWendyLuvsCatz Posts: 38,198

    yes does the same on mine crying

  • mCasualmCasual Posts: 4,607
    edited October 2021

    it's a programming error on my part

    i tested it without closing daz studio

    and daz studio remembered that earlier that day i defined black as being DzColor( 0, 0, 0 )

    so when i did my test, and some part of the program asked "what is black" daz studio replied "i know i know it's DzColor( 0, 0, 0 )"

    but when you tested the script, your Daz Studio never heard of "black"

    the solution was to copy line 64 of the script which reads 

     var black = new Color( 0, 0, 0 ) ;

    and paste it at line 83 of the script

    so later in the program execution, when the script asks "what's black" Daz Studio will know

    i will post the update in about 20 minutes

    note that this is an old script, from before iRay, so some shaders like those in the NVIDIA MDL Example shaders wont get blackened

    Some of those shaders dont have a diffuse color property so the script cant make them black like other shaders,

    all the Uber iRay shaders sould work fine

    another thing that would need to be fixed is that the glossy color seems independant of the diffuse color

    so shiny objects will be visible even if their diffuse color was made black

     

     

    WendyLuvsCatz said:

    yes does the same on mine crying

    Post edited by mCasual on
  • WendyLuvsCatzWendyLuvsCatz Posts: 38,198

    mCasual said:

    it's a programming error on my part

    i tested it without closing daz studio

    and daz studio remembered that earlier that day i defined black as being DzColor( 0, 0, 0 )

    so when i did my test, and some part of the program asked "what is black" daz studio replied "i know i know it's DzColor( 0, 0, 0 )"

    but when you tested the script, your Daz Studio never heard of "black"

    the solution was to copy line 64 of the script which reads 

     var black = new Color( 0, 0, 0 ) ;

    and paste it at line 83 of the script

    so later in the program execution, when the script asks "what's black" Daz Studio will know

    i will post the update in about 20 minutes

    note that this is an old script, from before iRay, so some shaders like those in the NVIDIA MDL Example shaders wont get blackened

    Some of those shaders dont have a diffuse color property so the script cant make them black like other shaders,

    all the Uber iRay shaders sould work fine

    another thing that would need to be fixed is that the glossy color seems independant of the diffuse color

    so shiny objects will be visible even if their diffuse color was made black

     

     

    WendyLuvsCatz said:

    yes does the same on mine crying

    yes 

  • mCasual said:

    https://sites.google.com/site/mcasualsdazscripts9/mcjallblackexceptemissive

    ______________________________________________

    Run the script

    Click the "Do It" button

    all materials except those with the 'Emissive' tag will have their Diffuse Color turned black

    you can undo this after exiting the script

    Edit / Undo / mcjAllBlackExceptEmissive

    render the emissive-only scene from the same camera as your real render

    use your favorite paint program to gaussian-blur the emissive-only render

    push the lightness and contrast up

    layer this on top of your real render using for example the "screen" effect

    This script, and the tecnique work great for filament renders!  

  • Ben Oaks said:

    mCasual said:

    https://sites.google.com/site/mcasualsdazscripts9/mcjallblackexceptemissive

    ______________________________________________

    Run the script

    Click the "Do It" button

    all materials except those with the 'Emissive' tag will have their Diffuse Color turned black

    you can undo this after exiting the script

    Edit / Undo / mcjAllBlackExceptEmissive

    render the emissive-only scene from the same camera as your real render

    use your favorite paint program to gaussian-blur the emissive-only render

    push the lightness and contrast up

    layer this on top of your real render using for example the "screen" effect

    This script, and the tecnique work great for filament renders!  

    For some reason I can't attach an image, so head to my gallery for a preview of what I did with it. 

Sign In or Register to comment.