Do I understand Material usage correctly?

Hello,



do I understand the usage of the Material class correctly? If I want to use a material, I have to construct an instance using the material constructor with the assetManager. This allows me to define which “type” of material I want to use, e.g. a solid material. If I have constructed such a material instance, the instance is fixed, i.e. I can only manipulate the parameters which exist within the materials def file loaded by the assetManager. If I try to set, for example, the shininess value using setFloat(“m_Shininess”, 5.0f) although there is no shininess parameter in the materials def file loaded by the assetManager, an exception is thrown.

This means that if I have constructed a material of a specific type I can not change it anymore. Is there a possibility to construct a general material instance?



The reason why I am asking is following. I want to build a framework on top of JME3.0 but I do not need “external” or “internal” material defs.



Thanks for help.



regards,

equi

The materials are based on shaders, they will not work without them.

Hello,



So, can I set all properties which I find in the various Common/MatDefs files directly, mixing them up. Does this have any impact on performance? Or would you say that for, lets say, a SolidColor material you should only set



Vector4 m_Color

// Texture of the glowing parts of the material

Texture2D m_GlowMap

// The glow color of the object

Color m_GlowColor



etc.? Why is an error whrown if I try to set “m_Shininess”?



Thanks



regards,

equi

When there is no shininess parameter you cannot set it. The used j3md defines the parameters of the shader/material.

ui ui ui ui

this will be complicated to be connected to a wysiwyg property editor in netbeans

but thanks, now I understand how it works. the shader files are the templates. they define all properties, once defined you must not add or delete some of them but you can manipulate their values.



How will you implement the editor with this “text based” solution in jmonkeyplatform? Will you have a node property editor in jmonkeyplatform?



Thanks

It is implemented (although not quite done yet, but the preview works now as opposed to the video):

http://www.youtube.com/watch?v=Feu3-mrpolc

Equilibrium said:
this will be complicated to be connected to a wysiwyg property editor in netbeans
but thanks, now I understand how it works. the shader files are the templates. they define all properties, once defined you must not add or delete some of them but you can manipulate their values.

How will you implement the editor with this "text based" solution in jmonkeyplatform? Will you have a node property editor in jmonkeyplatform?

Thanks

It is already there. In most cases you don't need to edit the definitions but you only make instances that use them.
If you actually need to make your own or edit the definitions then you have enough experience that you don't need a GUI tool to do that.

Hi Momoko Fan,



yes thanks. I want to build up a GUI for other people. The reason is following. I want to build a scientific modelling tool, a so called “Molecular Dynamics Viewer” where chemical structures are displayed. The user, of course, need not know anything about shaders. The user should only have to be concerned about “colors”, “shininess” etc. So, if my molecule is displayed with “solid color”, there is a color property in the Netbeans Property Editor. Let’s say the user wants to have a nice “reflection color” with light effects etc. Then, if I understand it correctly, the user would have to change the “shader type” (let’s say through a combo box, so that the Netbeans property editor changes completeley and THEN he can manipulate the parameters.



I’ll try it in this way.



Thanks.

No, if the user is not supposed to work with the real parameters then I would also hide the “shader type” thing and just select a materialdef and create a material based on the users input. W/o selecting the material “type” etc.

It is possible to do what you’re asking. Just make a GUI tool that would edit the parameters for the materials, using the “set****” methods.