Horde3D

Next-Generation Graphics Engine
It is currently 29.11.2024, 23:04

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Starting with Horde3D
PostPosted: 27.09.2009, 10:29 
Offline

Joined: 10.07.2009, 21:16
Posts: 42
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 :)


Top
 Profile  
Reply with quote  
PostPosted: 27.09.2009, 13:13 
Offline

Joined: 10.07.2009, 21:16
Posts: 42
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...:'(


Top
 Profile  
Reply with quote  
PostPosted: 27.09.2009, 14:00 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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?


Top
 Profile  
Reply with quote  
PostPosted: 27.09.2009, 15:17 
Offline

Joined: 10.07.2009, 21:16
Posts: 42
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...:(


Top
 Profile  
Reply with quote  
PostPosted: 27.09.2009, 21:24 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
PostPosted: 27.09.2009, 22:22 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
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 ;)

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 27.09.2009, 23:54 
Offline

Joined: 10.07.2009, 21:16
Posts: 42
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 :)


Top
 Profile  
Reply with quote  
PostPosted: 28.09.2009, 03:20 
Offline

Joined: 10.07.2009, 21:16
Posts: 42
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 ^^


Top
 Profile  
Reply with quote  
PostPosted: 29.09.2009, 19:53 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Funto, thanks for the status report. That's good info to have.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group