7
$\begingroup$

I'd like to emphasisze the '3d-ness' of my object, by applying a rectangular mesh to it, as if it were a white object in a black room illuminated only by a (far away) laser that scans horizontal and vertical lines.

I manage to get as far as this picture:

screenshot of my progress so far

Now, instead of the 'black' lines, i would like them to be solid green. And instead of the green gradients, it would be nice if these would be black.

Conceptually, what I'm looking for (I think I am): I'd like to tell the node editor something like:

if your input value is smaller then 0.9, output 0. If it is between 0.9 and 1, output 1.

How do I achieve this?

I used the following setup of my nodes:

material node setup

My question looks a bit like: How to make a mesh look like it was 3D printed

$\endgroup$
  • 1
    $\begingroup$ perhaps of interest: making-a-laser-in-cycles-straight-beam-of-light $\endgroup$ – zeffii May 7 '15 at 7:38
  • 1
    $\begingroup$ See blender.stackexchange.com/q/14394/599. Though I'd recommend zeffii's suggestion of actually illuminating the object with lights as you describe. After all, you have a light simulation engine. Why not use it? ;) $\endgroup$ – gandalf3 May 7 '15 at 8:11
  • $\begingroup$ That does the trick! Never thought of using the brick shader for this. $\endgroup$ – Ideogram May 7 '15 at 8:36
  • $\begingroup$ @gandalf3 Would you mind turning your comment into an answer? $\endgroup$ – Ideogram May 7 '15 at 8:52
9
$\begingroup$

here's a grid OSL shader I wrote a while back.

/*
  Grid Lines 
  : Author Dealga McArdle, 2013
  : modified from Sine Stripes by Thomas Dinges

  example shaders:
  http://www.openshading.com/osl/example-shaders/

*/

#include "stdosl.h"

shader GridShaderUV(

    // input and output parameters
    vector Vector = P,
    color GridColor = color(0.8),
    float Intensity = 1.0,
    float Distance_U = 0.02,
    float Distance_V = 0.02,
    int Stripes_U = 10,
    int Stripes_V = 10,        
    output float Fac = 1.0,
    output color Color = color(0.8),
    float World_X = 1.0,
    float World_Y = 1.0
    )
{

    // shader code
    point Pos = Vector;
    Pos[0] -= World_X;
    float pattern_col = 0.0;

    for(int i = 0; i < Stripes_U; ++i ) {
        Pos[0] += Distance_U;
        pattern_col += abs(Intensity / Pos[0] / 1000.0);
    }

    Pos = Vector;
    Pos[1] -= World_Y;    
    for(int i = 0; i < Stripes_V; ++i ) {
        Pos[1] += Distance_V;
        pattern_col += abs(Intensity / Pos[1] / 1000.0);
    }    

    color C = transformc("hsv", GridColor);

    Fac = pattern_col;
    Color = color("hsv", C[0], C[1], (Fac*C[2]));
}

It generates a grid of black vs some user defined colour. There are many ways to use it, but to get a feel for it I suggest sticking it as a material on a Plane, and see what the sliders do.

If you add a Suzanne, you could set the Stripes U and V to 1 so there's only one grid line, then animate the Distance X between the extents of your object., and you'll get the laser scan effect. Or animate the WORLD X,Y as they are the center of the shader's coordinate system.

enter image description here

Looks like this

enter image description here

It's a grid osl, therefore capable (and intended) to make grids.

enter image description here

Alternatively, xyz banding

remove the axis you don't need. You can offset the Geometry position by some vector amount if the missing Axis band (0,0,0) bothers you

enter image description here

$\endgroup$
  • $\begingroup$ That's extremely cool! $\endgroup$ – Ideogram May 7 '15 at 8:51
  • $\begingroup$ Yeah, too many solutions for some problems :) $\endgroup$ – zeffii May 7 '15 at 9:29
  • $\begingroup$ I like the last answer the most. I used it my own answer, although I marked yours as THE answer. √ $\endgroup$ – Ideogram May 7 '15 at 11:41
6
$\begingroup$

This is how it looks after using @gandalf3 suggestion: (bricks)

enter image description here

And here's a screenshot using @zeffii answer, which I marked as "THE" answer, because it elaborated on my own, initial approach. I include it in my answer, because I changed some settings in the nodes that might be of interest to others:

enter image description here

Changes:

  1. turn 'less than' into 'Greater than'.
  2. Add the X, Y and Z into one value and put this into a CombineRGB --> only green lines
  3. There are two 'value' nodes in the original answer. I combined the into one, where I calculate the value of the second from the first one.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.