Material Definition question ... sigh

Soooo sorry for the bombardment of questions… buuuuut…



Per the documentation:


RenderState

The RenderState block specifies values for various render states in the rendering context. The RenderState block is nested inside the Technique block. There are many types of render states, and a comprehensive list will not be included in this document.

The most commonly used render state is alpha blending, to specify it for a particular technique, including a RenderState block with the statement Blend Alpha.

Example:

RenderState { Blend Alpha
}


Where can I get "a comprehensive list" that IS "included in this document" :)
1 Like

http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core-plugins/com/jme3/material/plugins/J3MLoader.java?r=9546#311



In the method readRenderStateStatement(String statement) you can see how it is parsed. There you can see what you need to input.

For example when you want to know how to set up blending, there is this:

[java]else if (split[0].equals(“Blend”)){

renderState.setBlendMode(BlendMode.valueOf(split[1]));[/java]



You can see you first need the keyword Blend. Afterwards comes BlendMode.valueOf(split[1]), so if you take a look at BlendMode’s code:

[java]/**

  • <code>BlendMode</code> specifies the blending operation to use.

    *
  • @see RenderState#setBlendMode(com.jme3.material.RenderState.BlendMode)

    */

    public enum BlendMode {



    /**
  • No blending mode is used.

    */

    Off,

    /**
  • Additive blending. For use with glows and particle emitters.
  • <p>
  • Result = Source Color + Destination Color -> (GL_ONE, GL_ONE)

    */

    Additive,

    /**
  • Premultiplied alpha blending, for use with premult alpha textures.
  • <p>
  • Result = Source Color + (Dest Color * (1 - Source Alpha) ) -> (GL_ONE, GL_ONE_MINUS_SRC_ALPHA)

    */

    PremultAlpha,

    /**
  • Additive blending that is multiplied with source alpha.
  • For use with glows and particle emitters.
  • <p>
  • Result = (Source Alpha * Source Color) + Dest Color -> (GL_SRC_ALPHA, GL_ONE)

    */

    AlphaAdditive,

    /**
  • Color blending, blends in color from dest color
  • using source color.
  • <p>
  • Result = Source Color + (1 - Source Color) * Dest Color -> (GL_ONE, GL_ONE_MINUS_SRC_COLOR)

    */

    Color,

    /**
  • Alpha blending, interpolates to source color from dest color
  • using source alpha.
  • <p>
  • Result = Source Alpha * Source Color +
  •      (1 - Source Alpha) * Dest Color -&gt; (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)<br />
    

*/

Alpha,

/**

  • Multiplies the source and dest colors.
  • <p>
  • Result = Source Color * Dest Color -> (GL_DST_COLOR, GL_ZERO)

    */

    Modulate,

    /**
  • Multiplies the source and dest colors then doubles the result.
  • <p>
  • Result = 2 * Source Color * Dest Color -> (GL_DST_COLOR, GL_SRC_COLOR)

    */

    ModulateX2

    }[/java]



    So you can see you can input stuff like:

    Blend Modulate

    Same goes for all the other stuff in that method, always go to the appropriate place in code and see what it says.
1 Like
@cvlad said:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core-plugins/com/jme3/material/plugins/J3MLoader.java?r=9546#311

In the method readRenderStateStatement(String statement) you can see how it is parsed. There you can see what you need to input.
For example when you want to know how to set up blending, there is this:
[java]else if (split[0].equals(&quot;Blend&quot;)){
renderState.setBlendMode(BlendMode.valueOf(split[1]));[/java]

You can see you first need the keyword Blend. Afterwards comes BlendMode.valueOf(split[1]), so if you take a look at BlendMode's code:
[java]/**
* &lt;code&gt;BlendMode&lt;/code&gt; specifies the blending operation to use.
*
* @see RenderState#setBlendMode(com.jme3.material.RenderState.BlendMode)
*/
public enum BlendMode {

/**
* No blending mode is used.
*/
Off,
/**
* Additive blending. For use with glows and particle emitters.
* &lt;p&gt;
* Result = Source Color + Destination Color -&gt; (GL_ONE, GL_ONE)
*/
Additive,
/**
* Premultiplied alpha blending, for use with premult alpha textures.
* &lt;p&gt;
* Result = Source Color + (Dest Color * (1 - Source Alpha) ) -&gt; (GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
*/
PremultAlpha,
/**
* Additive blending that is multiplied with source alpha.
* For use with glows and particle emitters.
* &lt;p&gt;
* Result = (Source Alpha * Source Color) + Dest Color -&gt; (GL_SRC_ALPHA, GL_ONE)
*/
AlphaAdditive,
/**
* Color blending, blends in color from dest color
* using source color.
* &lt;p&gt;
* Result = Source Color + (1 - Source Color) * Dest Color -&gt; (GL_ONE, GL_ONE_MINUS_SRC_COLOR)
*/
Color,
/**
* Alpha blending, interpolates to source color from dest color
* using source alpha.
* &lt;p&gt;
* Result = Source Alpha * Source Color +
* (1 - Source Alpha) * Dest Color -&gt; (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
*/
Alpha,
/**
* Multiplies the source and dest colors.
* &lt;p&gt;
* Result = Source Color * Dest Color -&gt; (GL_DST_COLOR, GL_ZERO)
*/
Modulate,
/**
* Multiplies the source and dest colors then doubles the result.
* &lt;p&gt;
* Result = 2 * Source Color * Dest Color -&gt; (GL_DST_COLOR, GL_SRC_COLOR)
*/
ModulateX2
}[/java]

So you can see you can input stuff like:
Blend Modulate
Same goes for all the other stuff in that method, always go to the appropriate place in code and see what it says.


I was actually looking for everything other than Blend :) Like FaceCull, etc, etc
@t0neg0d said:
I was actually looking for everything other than Blend :) Like FaceCull, etc, etc


They are in the same place as already linked:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core-plugins/com/jme3/material/plugins/J3MLoader.java?r=9546#311