Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
I am looking for commands that I can type at the mged prompt to change material shader properties (such as transparency, reflectivity, and shininess, etc). Does the shader command support these parameters?
(What are the values for shader_args?)
I know that this can be achieved by navigating the menu and utilizing the combination editor. However, I would like to be able to set such parameters from the mged console.
The 'mater' command is how you set shaders on the command line.
That said, the shader parameters are unfortunately not very well documented (or better said, the documentation isn't in one convenient place). The GUI describes all of the options available for the plastic (aka phong) shader which includes transparency, reflectivity, shininess, etc.
What you can do to learn what the shader parameters are and how to set them is to use the combination editor. Set all of the parameters to some non-default value on a combination. The 'mater' command will show you what they all are (as well as the 'attr' command) and let you set them to new values. The combination editor will also show you what the actual shader string is as well.
One more thing, the 'mater' command had a bug introduced a while back that made it stop prompting for interactive input. Similar to the 'in' command, if you just run 'mater' without any options, it used to prompt you for all of the remaining options while explaining what they were. I just fixed that bug very recently, which will be in the upcoming 7.18.4 release.
I'm not quite sure what you mean here. I am not using the gui, or an interactive editor. I am trying to set the properties using a command line. I don't want to use the interactive combination editor.
The help option for mater tells me:
The mater command on its own tells me:
Usage: mater region_name shader r g b inherit
(The help information does not mention these parameters, so that looks like a minor bug - I will file that).
So, I can set the shader, the rgb colour and the inheritance value from the command line.
The attr command tells me:
So I have the rgb value and a los value.
The values I want to set are transparency, reflectiveness and shininess. I don't see those with either mater or attr. Can I set these non-interactively using commands?
I think you misunderstood my reply. The mater command is *supposed* to prompt you for each parameter (on the command line) interactively. Example:
Usage: mater object_name shader r inherit
mged> mater all.g
Current shader string =
Specify shader. Enclose spaces within quotes. E.g., "light invisible=1"
Shader? ('del' to delete, '.' to skip) plastic
Current color = (No color specified)
R, G, B color values (0 to 255)? ('del' to delete, '.' to skip) 255 0 0
Current inheritance = 0: lower nodes (towards leaves) override
Should this object's shader override lower nodes? ('.' to skip) .
mged> l all.g
Color 255 0 0
mged> attr show all.g
Pressing the up-arrow, that interactive prompting can be seen what it looks like as non-interactive input:
mged> mater all.g plastic 255 0 0 .
That, however, is the bug that I was referring to. Only the latest (unreleased) version has the interactive prompting that explains what the options are due to the bug. So you can use the GUI combination editor to set a shader, the run the 'attr' command to see what options you could have set via 'mater'.
If you go to the GUI combination editor, set plastic with transparency, reflectiveness, and shininess, then run the 'attr' command, you'll see that the 'oshader' attribute is something like "plastic tr=0.3 di=1.0 re=0.2" - and that is what you can feed to the mater command:
mged> mater all.g "plastic tr=0.3 di=1.0 re=0.2" 255 0 0 .
This page lists most of the available shaders and their parameters, but is a little out-of-date with regards to the specific format and command names. If you jump down to the "plastic" shader, though, you'll see the 'tr', 'di', 're', and other parameters for the plastic shader along with descriptions of their meaning.
Cheers Sean. This works a treat. I'll create some notes on that.
Great, feel free to add a tutorial page to the BRL-CAD wiki or write up a Docbook documentation article if you are inspired. That's an area we obviously need to work on documenting better.