[glow=yellow,2,300]If anybody is working on a patch for Ogreloader, please PM me ASAP. The different steps of the merge may result in merge conflicts. This can be minimized with some preparation.[/glow]
Hi all,
some days ago I started to check what’s currently supported by com.radakan.jme.mxml.MaterialLoader class of Radakan’s OgreLoader. This is the info I wrote down examining that class and a piece of material file created by Ogre Blender exporter: (http://www.ogre3d.org/wiki/index.php/Blender_Exporter):
material Floor_LMAPS // readed, supported (readMaterial())
{
receive_shadows on // readed, material.recieveShadows = true -> not really supported, this attribute does not trigger any action (readMaterialStatement());
technique // readed, supported (readTecnique())
{
// readed, supported (readPass())
// Ogre docs for pass: http://www.ogre3d.org/docs/manual/manual_16.html#SEC38
pass
{
ambient 0.500000 0.500000 0.500000 1.000000 // MaterialState.setAmbient()
diffuse 1.000000 1.000000 1.000000 1.000000 // MaterialState.setDiffuse()
specular 0.000000 0.000000 0.000000 1.000000 0.250000 // MaterialState.setSpecular()
emissive 0.000000 0.000000 0.000000 1.000000 // MaterialState.setEmissive()
// http://www.ogre3d.org/docs/manual/manual_16.html#SEC44
//
scene_blend <add|modulate|alpha_blend|colour_blend> // supported values: "alpha_blend", "modulate"
// used to create TRANSPARENT objects (also with blend);
// if (alpha_blend)
// {
// material.transparent = true; --> obj.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
// BlendState as = (BlendState) material.getState(RenderState.RS_BLEND);
// as.setBlendEnabled(true);
// as.setSourceFunction(SourceFunction.SourceAlpha);
// as.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha);
// //as.setBlendEquation(BlendEquation.Add);
// as.setTestEnabled(true);
// as.setTestFunction(TestFunction.GreaterThan);
// as.setReference(0.1f);
//
// CullState cs = (CullState) material.getState(RenderState.RS_CULL);
// cs.setCullFace(CullState.Face.None);
// }
// else if (modulate) // transparency is OFF;
// {
// // transparent = false -> obj.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
// BlendState as = (BlendState) material.getState(RenderState.RS_BLEND);
// as.setBlendEnabled(true);
// as.setSourceFunction(SourceFunction.DestinationColor);
// as.setDestinationFunction(DestinationFunction.SourceColor);
// }
//
// http://www.ogre3d.org/docs/manual/manual_16.html#SEC47
depth_write <on|off> // ZBufferState.setWritable()
// http://www.ogre3d.org/docs/manual/manual_16.html#SEC60
lighting <on|off> // if (off) -> obj.setLightCombineMode(LightCombineMode.Off);
// ??? not present into original Ogre specs ???
shader <vertShaderFile fragShaderFile> // GLSLShaderObjectsState glsl = (GLSLShaderObjectsState) material.getState(RenderState.RS_GLSL_SHADER_OBJECTS);
// glsl.load(vertShader, fragShader);
// ??? not present into original Ogre specs ???
uniform_int <name value> // GLSLShaderObjectsState glsl = (GLSLShaderObjectsState) material.getState(RenderState.RS_GLSL_SHADER_OBJECTS);
// glsl.setUniform(name, value);
// http://www.ogre3d.org/docs/manual/manual_17.html
// readed, supports only the following statements:
// * texture
// * tex_address_mode
// * filtering
// see: readTextureUnit(), readUnitStatement()
texture_unit // create a new TextureState
{
// http://www.ogre3d.org/docs/manual/manual_17.html#SEC78
// supports only <texturename>
texture FloorGrid_COL.png // create new Texture object with declared image resource;
// http://www.ogre3d.org/docs/manual/manual_17.html#SEC84
// Simple Format: tex_address_mode <uvw_mode>
// supports wrap -> texture2D.setWrap(WrapMode.Repeat);
// mirror -> texture2D.setWrap(WrapMode.MirroredRepeat);
// clamp -> texture2D.setWrap(WrapMode.Clamp);
tex_address_mode wrap
// http://www.ogre3d.org/docs/manual/manual_17.html#SEC86
// supports only "trilinear":
// texture2D.setMinificationFilter(MinificationFilter.Trilinear);
// texture2D.setMagnificationFilter(MagnificationFilter.Bilinear);
filtering trilinear
// NOT SUPPORTED
colour_op alpha_blend
}
texture_unit
{
texture testLevel_LMAP.png
tex_address_mode wrap
filtering trilinear
}
}
}
}
Is this correct ? Am I missing something ?
In the next days my team will going to create some use cases driven by our 3d artist. Our goal is to:
1) try to understand what he needs (this could be hard :P)
2) discover how to create a correct .material file for every use case
3) check if OgreLoader and those material files fulfill our needs
3.1) if not, we will try to understand what's missing from the puzzle and to try to cooperate with jme community to extend the OgreLoader (maybe supporting more parameters of material script?) or to make code contribs.
4) create some sort of visual catalog of mesh effects with the material files used to obtain them (with textures, GLSL shaders, etc) and some explanation
If my team will be able to accomplish this, we'd like to contribute back our docs to the community.
foxat said:
In the next days my team will going to create some use cases driven by our 3d artist. Our goal is to:
1) try to understand what he needs (this could be hard :P)
2) discover how to create a correct .material file for every use case
3) check if OgreLoader and those material files fulfill our needs
3.1) if not, we will try to understand what's missing from the puzzle and to try to cooperate with jme community to extend the OgreLoader (maybe supporting more parameters of material script?) or to make code contribs.
4) create some sort of visual catalog of mesh effects with the material files used to obtain them (with textures, GLSL shaders, etc) and some explanation
If my team will be able to accomplish this, we'd like to contribute back our docs to the community.
Hi All,
in the previous post my idea was to create a set of Ogre's .material files to try to detect "optimal" settings for materials we are going to use in our project.
Pipeline was: Blender modeler -> Ogre's BlenderExporter script -> customization of .material files -> jme OgreLoader -> jme world (inside the engine).
I spoke with the 3D artist of my team (Eugenio) and he gave me another point of view:
i think the point is that you're planning to translate attributes belonging to a software rendering shader into a realtime material
this approach has three problems:
- you need to chose a subset of the attributes in the software shader and try and find the realtime correspondents, this is in part an arbitrary process, and you're not sure you can cover every effect you can obtain in realtime
- you don't have a preview of the material until you can see the result in the engine
- you have to mess with material templates and custom IDs, obtaining anyway only a partial result
i think it would be better to have a tool on the realtime engine side, where you can choose the mesh and associate its UVsets with textures and blending modes: easier and more effective
To me, the best solution seems to use / extend Noel Lynch's ncomp's Scene Worker (http://code.google.com/p/scenemonitor/wiki/SceneWorker) to have a sort of material editor.
What do you think about it ?
foxat said:
foxat said:
In the next days my team will going to create some use cases driven by our 3d artist. Our goal is to:
1) try to understand what he needs (this could be hard :P)
2) discover how to create a correct .material file for every use case
3) check if OgreLoader and those material files fulfill our needs
3.1) if not, we will try to understand what's missing from the puzzle and to try to cooperate with jme community to extend the OgreLoader (maybe supporting more parameters of material script?) or to make code contribs.
4) create some sort of visual catalog of mesh effects with the material files used to obtain them (with textures, GLSL shaders, etc) and some explanation
If my team will be able to accomplish this, we'd like to contribute back our docs to the community.
Hi All,
in the previous post my idea was to create a set of Ogre's .material files to try to detect "optimal" settings for materials we are going to use in our project.
Pipeline was: Blender modeler -> Ogre's BlenderExporter script -> customization of .material files -> jme OgreLoader -> jme world (inside the engine).
I spoke with the 3D artist of my team (Eugenio) and he gave me another point of view:
i think the point is that you're planning to translate attributes belonging to a software rendering shader into a realtime material
this approach has three problems:
- you need to chose a subset of the attributes in the software shader and try and find the realtime correspondents, this is in part an arbitrary process, and you're not sure you can cover every effect you can obtain in realtime
- you don't have a preview of the material until you can see the result in the engine
- you have to mess with material templates and custom IDs, obtaining anyway only a partial result
i think it would be better to have a tool on the realtime engine side, where you can choose the mesh and associate its UVsets with textures and blending modes: easier and more effective
To me, the best solution seems to use / extend Noel Lynch's Scene Worker (http://code.google.com/p/scenemonitor/wiki/SceneWorker) to have a sort of material editor.
What do you think about it ?
You can use Ogre materials in 3ds max/blender. For example look here: http://www.ofusiontechnologies.com/
Has anybody come up with a implementation of ragdoll physics for Ogre yet? I know MD5Importer has: http://www.jmonkeyengine.com/jmeforum/index.php?topic=8956.0 I just wanted to check before possibly trying it myself.
SomethingNew said:
Has anybody come up with a implementation of ragdoll physics for Ogre yet? I know MD5Importer has: http://www.jmonkeyengine.com/jmeforum/index.php?topic=8956.0 I just wanted to check before possibly trying it myself. :)
It should be quite easy, if using jME-physics. You can use bone control to make the bones follow the ragdoll. Another way is creating your own implementation of BoneAnimation (e.g RagdollAnimation) which would do the same thing.
If anybody is looking for more concrete OgreMax support, you can use this material file as a reference to the kind of features it uses. Most of these parameters are set to default so you don't have to support all of them, it should just be possible to load this kind of material file without any crashes or errors.
material 01-Default
{
receive_shadows off
transparency_casts_shadows off
technique Map#2
{
pass Map#3
{
ambient 0.698039 0.698039 0.698039 1
diffuse 0.698039 0.698039 0.698039 1
specular 0.898039 0.898039 0.898039 1 0
emissive 0 0 0 1
scene_blend one zero
depth_check on
depth_write on
depth_func less_equal
depth_bias 0 0
alpha_rejection always_pass 0
cull_hardware clockwise
cull_software back
lighting off
shading gouraud
polygon_mode solid
colour_write on
max_lights 8
start_light 0
iteration once
texture_unit Map#4
{
texture D01.jpg 2d unlimited
binding_type fragment
tex_coord_set 0
tex_address_mode wrap wrap wrap
tex_border_colour 0 0 0 1
filtering trilinear
max_anisotropy 1
mipmap_bias 0
colour_op_ex modulate src_texture src_current
alpha_op_ex modulate src_texture src_current
colour_op_multipass_fallback one zero
env_map off
}
texture_unit Map#5
{
texture stone.jpg 2d unlimited
binding_type fragment
tex_coord_set 1
tex_address_mode wrap wrap wrap
tex_border_colour 0 0 0 1
filtering trilinear
max_anisotropy 1
mipmap_bias 0
colour_op_ex modulate src_texture src_current
alpha_op_ex modulate src_texture src_current
colour_op_multipass_fallback one zero
env_map off
}
texture_unit Map#6
{
texture D05.jpg 2d unlimited alpha PF_A8
binding_type fragment
tex_coord_set 0
tex_address_mode wrap wrap wrap
tex_border_colour 0 0 0 1
filtering trilinear
max_anisotropy 1
mipmap_bias 0
colour_op_ex modulate src_texture src_current
alpha_op_ex modulate src_texture src_current
colour_op_multipass_fallback one zero
env_map off
}
}
}
}
I've seen the JME-test class showing using ogreloader and attaching a simple box to ninja's hand. It is possible to do the same thing with armors (for example)? I'd like to create rpg game with animated characters and give users possibility to create their own equipment which then could be attached to player's characters? It is possible with ogre? In simple case like swords I would go similiar to the box but what with more complicated objects?
Hi *,
have anyone try to read resourceLocations from a DotScene file ?
For a example my scene file have:
<?xml version="1.0" encoding="UTF-8" ?>
<scene formatVersion="1.0.0" generator="MyBuilder">
<resourceLocations>
<resourceLocation type="FileSystem" name="./Models" />
<resourceLocation type="FileSystem" name="./Materials" />
</resourceLocations>
</scene>
</xml>
Greez,
Paul
PaulSyntax said:
have anyone try to read resourceLocations from a DotScene file ?
The scene importer is a pretty plain xml reader. For most of my projects I copied it to my source tree and adapted it to my needs (e.g. read blender properties and create PhysicsNodes from the objects if they have the property), so its easy to adapt.
For the resource locations, I like to use a self-built external tool to convert the ogre meshes to jme binary files before and load those in the game (no unnecessary conversion during game startup). So handling of resource locations for textures etc. can be done in that importer.
Cheers,
Normen
always the same…always reinventing the wheel. i use for testing an a great ogre editor and export my scene to dotScene file and it would be nice to render the scene in jme without any workarounds…
ok, i will try to modifiy the code…thx.
Paul
Once you're done, make sure to submit your changes as patch in the contribution forum
Momoko_Fan said:
Once you're done, make sure to submit your changes as patch in the contribution forum ;)
ok, i will contrubution my changes...let's begin with small changes.
Ok my first patch (include loading dynamic resource mesh+materials). The SceneLoader have some potential to be completely rewritten some parts are discontinuous and unhandy.
I will try to complete the DotSceneLoader…
[edit: not need anymore]
Hallo *,
in the last day's i rewrite a part of the dotScene Loader. It's work great and have a nice functionality.
It's very clear and simple to understand and it works complete with model bean's.
Additionals to the normal dotScene loader:
- Work and valid the dotScene-file thru xsd.
- Has build up a complete model structure thru JAXB 2.2 (no addtional libs needed if you use Java 1.6)
- Separate each part into own Loader (resource,environment,nodes,lights,terrain,externals)
- Can work with different ogre editor's who use the xsd file (Blender Scene Export,Ovise,Ogitor)
Next Todo's:
- implementation of SkyBox,SkyDome,SkyPlane,Fog into the loader…
- implementation of simple terrain
Code can be download under:
http://code.google.com/p/ogrejmeloader/
Grez,
Syntax
recent update… now we have skybox in the scene loader
- add Skybox into envirmontLoader. Works with the ogre material file:
material MySky
{
technique
{
pass
{
lighting off
depth_write off
texture_unit
{
cubic_texture Galaxy separateUV
tex_address_mode clamp
}
}
}
}
i made some modification of com.jmex.model.ogrexml.MaterialLoader (i hope that this can be patch back to jme ).
Greez,
Syntax
PaulSyntax said:I'm sure after we've had a little feedback in here to confirm the validity of your changes we can grant you commit access. This is one of jME's most important usability features so any serious commitment to it comes highly appreciated :)
(...) i made some modification of com.jmex.model.ogrexml.MaterialLoader (i hope that this can be patch back to jme ).
Make sure you stick by the commit practices though!
erlend_sh said:
I'm sure after we've had a little feedback in here to confirm the validity of your changes we can grant you commit access. This is one of jME's most important usability features so any serious commitment to it comes highly appreciated :)
Make sure you stick by the commit practices though!
hi erlend_sh,
i have post the changes in Contribution Depot. You can take look it the changes and show if this work's fine. Any advancement would be nice.
http://www.jmonkeyengine.com/forum/index.php?topic=13359.0
(edit):
in the next day's i will change the MaterialLoader more than once. :/
i need working methode for this material files:
(edit2):
now the two ogre format work:
Format 1 : cubic_texture <base_name> <combinedUVW|separateUV>
Format 2 : cubic_texture <front> <back> <left> <right> <up> <down> separateUV
So Skybox loading thru Material file is done ;)