IMPORTANT: The forum is in Read-Only mode and registrations have been disabled.

WPF 3D exporter

General information regarding development of exporters and plugins
objo
Posts: 2
Joined: Fri Jun 19, 2009 4:50 pm

WPF 3D exporter

Post by objo »

I just published a project for exporting the WPF 3D scene graph to Kerkythea:
http://wpfrendering.codeplex.com
http://www.codeproject.com/KB/WPF/WpfRendering.aspx
notareal
KT-Team
KT-Team
Posts: 4211
Joined: Fri Oct 27, 2006 7:27 am
Location: Finland

Post by notareal »

Welcome! Nice to see a new exporter project.
giannis
Site Admin
Posts: 4627
Joined: Mon Jul 04, 2005 9:59 am
Location: Athens, Greece

Post by giannis »

Very nice Bjørke!

I am anxious to see more - and please keep us updated here as well ;)
giannis
lsn1980
Posts: 4
Joined: Wed Jul 22, 2009 5:40 am

Post by lsn1980 »

I used your sample and exporting my WPF 3D scene graph to Kerkythea, but Kerkythea render very slow.Did Kerkythea have any starup parameter can control rendering operation? that we can choose quick mode or any others.
objo
Posts: 2
Joined: Fri Jun 19, 2009 4:50 pm

Post by objo »

Use one of the predefined Raytracing settings for faster rendering. Still you must expect minutes or hours of rendering time if your scene graph is large. It would be interesting to see an image of the results!
lsn1980
Posts: 4
Joined: Wed Jul 22, 2009 5:40 am

Post by lsn1980 »

I checked your code,but can not found the predefined Raytracing settings.

for your class KerkytheaExporter,I only found some properties like BackgroundColor,MaterialType,Shadows,Width,Height etc. it can not control use RenderSettings.

and used

string programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
string exe = System.IO.Path.Combine(programFiles, @"Kerkythea Rendering System\kerkythea.exe");
Process.Start(exe, file);

starup Kerkythea.exe that maybe used default RenderSettings.becasue when Kerkythea.exe starup only pop-up a rendering window no any option.llik the attached picture.

and I found kerkythea installation directory have a folder named \RenderSettings, the Kerkythea main application can use this RenderSettings.

so how I can used Kerkythea RenderSettings in my program ?
Attachments
temp1.JPG
notareal
KT-Team
KT-Team
Posts: 4211
Joined: Fri Oct 27, 2006 7:27 am
Location: Finland

Post by notareal »

One option is to use kerkythea messaging system and merge suitable render settings before rendering or you can directly manipulate advanced settings with messages.
http://www.kerkythea.net/docs/Kerkythea ... System.doc
lsn1980
Posts: 4
Joined: Wed Jul 22, 2009 5:40 am

Post by lsn1980 »

Thanks a lot~
I found the RenderSettings written in XML file,so I can control it.

but I don't know how to used the kerkythea messaging system. for example, I want use SaveImage message to save image to another path, so where can I sent to the message and how to sent it ?

in addition I found my Material lost, I think that because of the KerkytheaExporter class have some code. so can give me more detail for XML format information?
Aaron
Posts: 18
Joined: Fri Feb 05, 2010 9:18 am

Post by Aaron »

I'm currently using the Exporter (from the Helix toolkit project) in the following workflow:

1) Our customer sends us 3DS models
2) We convert these to WPF XAML and create a WPF scene with these models
3) We then convert the Viewport to a Kerkythea scene (xml file).

This is working fine, but I'm looking to add texture support to the exporter. For this, I first need to be able to apply textures to my models in the kerkythea scene, after that I can implement this in the exporter.

However, I'm not succesful at applying textures. Here are some facts that outline my issue

- The 3DS model has a texture applied, we also received the actual texture bitmap.
- If I load this 3DS model in Kerkythea I can remove the texture and change it with another image etc... it still looks good
- If I convert the 3DS model to WPF XAML and load it in a viewport, I can see the texture and it still fits perfectly.
- If I export this model in a Kerkythea scene, the texture is removed because it's not yet supported by the exporter.
- If I then try to apply the same texture image to the model in Kerkythea it is all jagged, as if the texture is applied to every triangle in the model, instead of to the entire surface (see attachments)

In the images given in the attachment I haven't yet touched the "Bitmap Coordinates", but with those I haven't really been able to do anything useful.

I'm assuming there's a problem with the way the model is built or something, but I'm not really very experiences with 3D Modelling, so I wouldn't know.


Should anyone want the models, I migh be able to provide the exported Kerkythea scene, but I will not put it online here in public. Also, maybe somebody of you can provide a simple 3DS model of something similar with a texture that I can use publicly, I will then do my XAML conversion and export on that model, I'm assuming the problems will be identical. That would be better, then I can freely post these scenes online.

Thanks to anyone reading this!
Attachments
My model with a texture applied...
My model with a texture applied...
The actual texture image (it's a test image that has the same dimensions as the original one, but I can't upload the original one to the internet)
The actual texture image (it's a test image that has the same dimensions as the original one, but I can't upload the original one to the internet)
The Original 3DS model with the texture image applied.
The Original 3DS model with the texture image applied.
notareal
KT-Team
KT-Team
Posts: 4211
Joined: Fri Oct 27, 2006 7:27 am
Location: Finland

Post by notareal »

It could be a scaling issue. Different UV created by exporter. If you set scale 0.1 or maybe even smaller in "Bitmap Coordinates" you might get better idea what's happening. Turn on solid rendering.

Permanent fix must be done to exporter.
Aaron
Posts: 18
Joined: Fri Feb 05, 2010 9:18 am

Post by Aaron »

Thanks for the reply.

I have added coloured lines to my texture image at all sides so I can identify what part of the texture is shown on the model.

If I move the scale of the coordinates to something like 0.350 I can see in the texture preview (in the material editor at the bottom left) that it shows part of the topleft of the image (which is a thick red line, a yellow line and part of the black arrow).

Now, when I apply this to my model, I can see those colors in every segment of the model.

If I turn the scale the other way, and make it 20 or something, I can see colors of the entire image but also in the same line-pattern all accross the model. If I turn the scale to 0.001 I see a red line pattern, because then all the image still contains is a red line and some white from the top of the image.


For me it seems like the texture is applied multiple times on parts of the model, almost as if he doesn't see it as a single surface... (if that is possible?)
Attachments
The preview of the texture...
The preview of the texture...
Wire Frame And Render
Wire Frame And Render
This is my test structure
This is my test structure
notareal
KT-Team
KT-Team
Posts: 4211
Joined: Fri Oct 27, 2006 7:27 am
Location: Finland

Post by notareal »

Perhaps no UV are set... so you would try cubic projection from "Bitmap Coordinates". But sometimes it's impossible to fix UV with different projections. Worth to try anyway.
About the scale; the smaller number is used in scale, less bitmap is repeated.
Aaron
Posts: 18
Joined: Fri Feb 05, 2010 9:18 am

Post by Aaron »

Something else I've just noticed when using solid rendering is that my texture image is visible (and stretched) at the bottom of my model. This is when scale = 1.

This is not visible like that when I'm actually rendering though.
Attachments
SolidRendering.png
Aaron
Posts: 18
Joined: Fri Feb 05, 2010 9:18 am

Post by Aaron »

It could very well be that "no UV's are set"... But I'm afraid that topic is very vague for me, I guess it could be this is not exported, or it could be it's already gone when I convert to XAML.

I really don't know at the moment.

However, I just activated Cubic projection and if I make the scale small enough, I can finally see my texture in a recognizable way. So as long as I use Cubic project, I believe it's just a matter of finding the right scale.

I guess it's a problem with the exporter... that he changes the scale of my model, which caused the texture not to fit the model anymore?


However, it's still difficult to get my texture to fit my model. We always assumed if we had the texture on the 3DS model, we would be able to just apply that image again to the WPF-exported model. We can not manually start to fit the texture onto the model as it's an automated process we're working on, so we'd need a way to just say "apply this image to this model" and get it right somehow. If I were to get the UV coordinates from the 3DS model into my kerkythea scene, would that be a possible solution for this?
Aaron
Posts: 18
Joined: Fri Feb 05, 2010 9:18 am

Post by Aaron »

Hey I think I just found something.

I suppose I have to export the Map Channel! Which I hopefully can map to WPF's "Texture Coordinates".

If I throw this Map Channel out of my XML I generated using the 3DS file, I get the same effect.

I didn't know all this, but I'm going to persue that track... And hopefully by the end of it all, my exporter will support textures! :)
Locked