ShaderTalk


#1

Hi guys,
I’m setting up this ShaderTalk thread so you all can get more indepth, without clogging up the renders/gallery section.

Have Fun :buttrock:
-mG


#2

Very good thinking. And to lessen thread congestion even further, for those who haven’t read the m:Studio docs yet, shaders are under :

-> Interface
—> Render Tab
-----> Materials
-------> Introduction

:slight_smile:


#3

I have alots of questions. First how do you process color variables in shader writing.

Here is a test shder script, but I am not sure how to get the input of the color input and output the color.

//#messiahscript

#include <messiah_render.h>

#define SCRIPT_SHADER_STANDARD 0

int IN_CLR = 0;

int OUT_CLR = 0;

int ShaderObjectCreate(object obj)

{

IN_CLR = fxShaderCreateInput(obj, “COLOR”, TYPE_COLOR, 0);

OUT_CLR = fxShaderCreateOutput(obj, “COLOR”, TYPE_COLOR, 0);

return (1);

}

int ShaderEvaluate(object obj, void shader_globals, void input, void output)

{

color inColor;

// Not sure this works, or if there is a GetInputColor function
inColor = GetInputFloat(obj, input, IN_CLR); <—

//Output 0 value,

SetOutput(obj, output, OUT_CLR, inColor);

return (1);

}


#4

You should just take a look at the scripts that are included with messiah, wood and grid etc.

But be aware that scripting shaders is currently extremely “suboptimal” in messiah:

  • You don’t have an interface for the shaders.
  • It doesn’t work with multithreading.
  • There are not much prebuilt noises or other needed functions that you can use in scripts like in Cinema4D or Renderman. Those systems allow you to do usefull shaders as scripts since the core noises and stuff are implemented in C and are therefore fast.
  • So your scripts will render very slowly…

#5

Hey Thomas,

I already checked out the other shader scripts, but none of them actually dealt with Color as an input or output. Scripting shaders are just a good way to test stuff out, before going to compiling it. I want to work on coding over some useful renderman shader, I got a couple already done, like a brick and velvet shader, but I’m stuck getting the color variable working with mSL(messiah shader language) like the way they do in RSL.

Cheers,


#6

For an example on using color, check “Spot2Color.msa”.

-lyle


#7

Lyle,

There is a problem with that shader. I get black bands(no Color) and it sometimes the black band changes where it is on the surface.


#8

As I said - shaderscripts don’t work with multithreading.


#9

Thanks,

Damn, then that explains the problem I was having with some of my scripts.

Cheers,


#10

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.