jMonkeyEngine3 material system - full explanation!


#1

If you are constantly being puzzled by jME3's material system- no more!

The attached document includes an excruciatingly detailed description of the entire thing like never before. :wink:



EDIT: For guest users, here's a download link on googlecode:

http://jmonkeyengine.googlecode.com/files/jME3_materials.pdf


Broken link in shader/material documentation
Broken link to materials documentation
#2

very good document....

a few questions...

are material parameters bindings to shader uniforms?

and if so is a facility to check for coherence, ie parameter exists in both shader and materialdef....

is there a way to bind to attributes or is this unnecessary?

also is there a table of world parameters?

is it also possible to list the techniques types used by the materialdef...

i know at the moment there is usually default and FixedFunc but i can't see where i can pull the tecnique names from...



on a side note can i ask why you chose a proprietary format over say xml or json?

i've been working on an antlr grammar for materialdef, mainly as a syntax checker for materialdefs, if you're interested i've attached it to this post....

non delimited paths are a pain in the ass to generic parse :)



sorry for all the q's but i really like the material system and it's very interesting to me....


#3
ncomp said:


are material parameters bindings to shader uniforms?



yes



ncomp said:


and if so is a facility to check for coherence, ie parameter exists in both shader and materialdef....



Why? The user doesn't need to do this.



ncomp said:


is there a way to bind to attributes or is this unnecessary?



Not necessary.



ncomp said:


also is there a table of world parameters?



No, but I can make one.



ncomp said:


is it also possible to list the techniques types used by the materialdef...



There's no way to get a listing but you can get a TechniqueDef through the method MaterialDef.getTechniqueDef(String).

Also, why would you ever need to do this?



ncomp said:


i know at the moment there is usually default and FixedFunc but i can't see where i can pull the tecnique names from...



You choose them (the user). In most cases the names are standard so you know what you need.



ncomp said:


are material parameters bindings to shader uniforms?



yes



ncomp said:


and if so is a facility to check for coherence, ie parameter exists in both shader and materialdef....



Why? The user doesn't need to do this.



ncomp said:


is there a way to bind to attributes or is this unnecessary?



Not necessary.



ncomp said:


also is there a table of world parameters?



No, but I can make one.



ncomp said:


is it also possible to list the techniques types used by the materialdef...



There's no way to get a listing but you can get a TechniqueDef through the method MaterialDef.getTechniqueDef(String).

Also, why would you ever need to do this?



ncomp said:


on a side note can i ask why you chose a proprietary format over say xml or json?



I think XML is not good for a file format that is primarily human-readable.



ncomp said:


i've been working on an antlr grammar for materialdef, mainly as a syntax checker for materialdefs, if you're interested i've attached it to this post....

non delimited paths are a pain in the ass to generic parse :)



sorry for all the q's but i really like the material system and it's very interesting to me....



Very good :)

If you're interested, perhaps you could continue to work on it. As you can see there are some unfinished features..


#4


...and if so is a facility to check for coherence, ie parameter exists in both shader and materialdef....



Why? The user doesn't need to do this.





i'm just thinking about doing materialdef validation with regards to a pipeline, a coherence check would catch some bugs before the materialdef gets loaded...





also is there a table of world parameters?



No, but I can make one.





that would be great thanks...





is it also possible to list the techniques types used by the materialdef...



There's no way to get a listing but you can get a TechniqueDef through the method MaterialDef.getTechniqueDef(String).

Also, why would you ever need to do this?





my reasoning here would be from the point of view of a tool to inspect materialdefs...

by accessing all the technique registered with the materialdef users could see what parameters are applicable to a given technique without having to open the materialdef file itself, and possibly introduce bugs via a newbie edit...

an inspection tool would allow parameters for techniques to be edited safely....





i've been working on an antlr grammar for materialdef, mainly as a syntax checker for materialdefs, if you're interested i've attached it to this post....

non delimited paths are a pain in the ass to generic parse :)



sorry for all the q's but i really like the material system and it's very interesting to me....



Very good :)

If you're interested, perhaps you could continue to work on it. As you can see there are some unfinished features..





what features are you referring to here?

i'll continue to work on the materialdef grammar....

thanks for taking the time to awnsere my questions...


#5
ncomp said:


my reasoning here would be from the point of view of a tool to inspect materialdefs...

by accessing all the technique registered with the materialdef users could see what parameters are applicable to a given technique without having to open the materialdef file itself, and possibly introduce bugs via a newbie edit...

an inspection tool would allow parameters for techniques to be edited safely....



I will put a tool to edit the j3m files visually into jMP very soon, it will have to parse the existing j3md files as well so I definitely see the point there :wink:


#6

Validating the J3M/J3MD is nice, but I don't think its fit for real-time. It would be okay to validate them automatically within the jMP though.


#7

bananapie?  :D



Thx for the document! Helped me a lot :stuck_out_tongue:


#8

Thankyou... I've just began looking at the material system and this is a MASSIVE help!



bananapie  :wink:


#9

bananapie


#10

bananapie


#11

Found a small typo in this excellent paper:

"Techniques may have nested blocks, any [and?] many types of statements."

Also: bananpie :)



Edit: Doh! I spelled it wrong :smiley:


#12

bananapie!


#13

bananapie :smile:


#14

Hi, I just could not download this pdf file.
Does anyone have a new download address ?


#15

You can get it here


#16

I know you asked for the PDF but its also part of the wiki. If your interested.

https://wiki.jmonkeyengine.org/jme3/advanced/material_specification.html