Horde3D
http://horde3d.org/forums/

Starting with Horde3D
http://horde3d.org/forums/viewtopic.php?f=2&t=961
Page 1 of 1

Author:  Funto [ 27.09.2009, 10:29 ]
Post subject:  Starting with Horde3D

Hi all,

As I am new to Horde3D, I would like to first create a basic production pipeline : creation in Blender -> exportation with the Blender exporter -> displaying in my application.

The aim is to make something fun with Tux in an Horde3D application, using the D language.

As for the moment I managed to export Tux from Blender to Horde (fixing the exporter ^^), but it does not display.
However, I can see it in debug mode :
Image

As you can see, another problem is that the skeleton is not well placed ; I suppose this is a bug in the Blender exporter, or a bad use of it :/

Here is the engine log : http://pastebin.com/m234a09f6

I use a custom shader, which I called "uniform.shader", like this :

Code:
[[FX]]

// Contexts
context AMBIENT
{
   VertexShader = compile GLSL VS_AMBIENT;
   PixelShader = compile GLSL FS_AMBIENT;

   ZWriteEnable = true;
   BlendMode = Blend;
}

[[VS_AMBIENT]]

void main( void )
{
   gl_Position = gl_ProjectionMatrix * gl_Vertex;
}


[[FS_AMBIENT]]

uniform vec4 materialColor;

void main( void )
{
   gl_FragColor = materialColor;
}


The pipeline is the forward shading one, with an ugly blue clear color :p

There are various materials for Tux, which all look like this one :
Code:
<Material>
   <Shader source="uniform.shader" />

   <Uniform name="materialColor" a="0.96599" b="0.96761" c="0.94171" d="1.0" />
</Material>


My code is based on a very simplified version of the Knight example (the knight and the sphere are correctly displayed, though I removed the animation, particles, etc).

Configuration : Ubuntu 9.04, 32 bits, nVidia GeForce 8600M GT.

Could you please tell me where I should start my investigation ?

Thanks :)

Author:  Funto [ 27.09.2009, 13:13 ]
Post subject:  Re: Starting with Horde3D

Hum, I finally used the provided model.shader model and adapted the materials, and got this fun gold Tux :

Image

However, the feet and the skeleton are still not in the good location...:'(

Author:  marciano [ 27.09.2009, 14:00 ]
Post subject:  Re: Starting with Horde3D

You definitely need to apply the Modelview matrix in the vertex shader since it contains the view/camera transformation: gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
You should also apply the object to world transformation which is handled by calcWorldPos in model.shader.

Regarding the golden Tux: ;)
Looks like a skinning issue, probably related to the Blender exporter. Is the skinning flag set in Tux' material?

Author:  Funto [ 27.09.2009, 15:17 ]
Post subject:  Re: Starting with Horde3D

Oops, I didn't see I forgot the modelview matrix...

Ok for the calcWorldVec() ; I thought writing a simple "uniform color" shader would be the easiest way to start with the engine, but it's simpler to reuse the "model" übershader :)

As for the materials, yes, the skinning flag is set.
In fact I just adapted knight.material.xml.

They look like this :
Code:
<Material>
   <Shader source="shaders/model.shader" />
   <ShaderFlag name="_F01_Skinning"/>
   <ShaderFlag name="_F04_EnvMapping"/>

   <Sampler name="albedoMap" map="tux/textures/white.png" />
   <Sampler name="envMap" map="models/skybox/skybox.dds" />
</Material>


Disabling the skinning flag removes the problem for the feet, so the problem is effectively due to the skinning...

Some screenshots :
- In debug view mode :
Image

- With skinning enabled : the feet are not correctly transformed :
Image

- Without skinning :
Image

:(

So, as you say, I think it must be yet another problem with the Blender exporter...:(

Author:  marciano [ 27.09.2009, 21:24 ]
Post subject:  Re: Starting with Horde3D

I think writing your own minimal shader is really a good exercise to understand how things are working. If you just want to render static objects, calcWorldVec is no more than a simple matrix multiplication. So your own shader is very close to be working.

I wonder how much effort it would be to modify our existing Blender exporter to output simple Collada instead of Horde files directly. That way Blender could go the ColladaConv route as well and benefit from all the features that are implemented there (like seam handling and geometry optimization).

EDIT: Seems that good Collada support for Blender 2.5 is getting more realistic. Using an official Collada exporter would be the best solution of course.

Author:  swiftcoder [ 27.09.2009, 22:22 ]
Post subject:  Re: Starting with Horde3D

marciano wrote:
I wonder how much effort it would be to modify our existing Blender exporter to output simple Collada instead of Horde files directly. That way Blender could go the ColladaConv route as well and benefit from all the features that are implemented there (like seam handling and geometry optimization).
Plus, you could get many kudos for supplementing Blender's own (incredibly broken) collada exporter ;)

Author:  Funto [ 27.09.2009, 23:54 ]
Post subject:  Re: Starting with Horde3D

I already thought about diving into the COLLADABlender project (current Python script to export COLLADA from Blender, separate project which seems to be dead :/), but the learning curve is not really simple : Blender, Blender Python API and COLLADA...

I did not know about the Blender/OpenCOLLADA initiative you mention, marciano, and according to this page on the Blender wiki, it may be possible to use it right now !

I am going to give it a try and give the results of my experiments on this thread :)

Author:  Funto [ 28.09.2009, 03:20 ]
Post subject:  Re: Starting with Horde3D

Ok, I just started to experiment with the Blender OpenCOLLADA SoC branch. It is based on the next 2.5 release of Blender.

After successfully :
- svn checkouting OpenCOLLADA, installing PCRE, compiling it
- compiling Python 3.1 / installed it in /usr/local (necessary...)
- svn checkouting, editing config/linux2-config.py, compiling the branch (namely soc-2009-chingachgook)

I finally managed to get Blender running.

I tried :

Blender export -> tux.dae -> Blender import

=> No skeleton, and the meshes changed their positions :/

- original model in Blender :
Image

- after re-importing in Blender :
Image

Here is the exported COLLADA file :

tux.dae :
http://pastebin.com/m74256056

Finally, I tried to run ColladaConv on tux.dae, which segfaulted :/

Here is the valgrind log for ColladaConv :
http://pastebin.com/m44b2c85b

In conclusion, COLLADA importing/exporting through OpenCOLLADA does not seem to be mature, and as it is a GSoC project, I suppose the student must have stopped working on it...
There seems to be still some work to do ^^

Author:  marciano [ 29.09.2009, 19:53 ]
Post subject:  Re: Starting with Horde3D

Funto, thanks for the status report. That's good info to have.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/