Closed kutomer closed 6 years ago
This is a good idea. So far the only way would be to do it at load time in JS :(
Thanks a lot for the quick reply! Do you think that it's something can be added to a backlog or something? Would love to help to develop this feature but guidance is needed.
Obviously :) You can perhaps familiarize yourself with the C# code of the exporter. Then we can discuss where in the json file we can export it (it is not a big deal as we can export all kind of materials)
Do you have any documentation for the exporter which I can begin with?
I would say tags just loadibg the VS project should be a good start Project is pretty straightforward
Thanks,
RaiseMessage
and for that, I need to rebuild and relaunch 3dsmax what makes the development process much slower.meshMode.IGameObject.NumModifiers.ToString()
returns 0 for me, have any idea?Hi kutomer,
1) Doing the same 2) Hair and Fur modifier is a World Space Modifier. Don't really know much about it but find attached the code you are probably looking for. Add it to the BabylonExporter.Mesh.cs file, for example before morph targets code (line 360).
With that you get all parameters from Hair and Fur modifier. Seems like there is no interface provided by the API, so you need to retreive each parameter by id. You need to adapt the getter method (GetFloat, GetInt, GetColor...) to the parameter type of each parameter, otherwise it would return the default value (0 for a float).
Be aware that an object might have several WSMs. To retreive the Hair and Fur one you can check its name but this process is ugly and certainly language sensitive (i experimented this for materials' type). If you go for that, tag it with a TODO :)
@noalak awesome, thanks, I'll do that.
So is that fine if I'll support just English for now and add a TODO like:
materialNode.MaterialClass.ToLower() == "physisches material" || // German // TODO - check if translation is ok
(Exporter/BabylonExporter.Material.cs
)
(just wanna make sure you guys will approve my PR)
After exporting all the data from the Modifier I want to create a new Material in the exported babylon filematerials
array with customType FurMaterial
(and all the material data)
I saw that `BABYLON.Material.Parse' doesn't support FurMaterial is that right? if so I also need to modify it to support FurMaterials.
I think a How to contribute
section in the README can make life easier for future contributors.
I can start writing something and you guys can modify, if you want...
something else I need to do or know?
2., 3. and 4. @deltakosh
Once feature is complete for both exporter and loader, add a sample max file and exported babylon outputs (beautified if possible). Be aware of diffusion rights though.
Any plan on fur animations? Doesn't even know if babylon supports them.
@noalak thanks again,
No problem I'll add the examples. Not sure I got the time to do the loader right now, is that fine?
To be honest, I didn't plan on doing animations but I'll be happy to add them (Babylon does support animations and I will try to do it as accurate as possible. (demo))
Hey!
@deltakosh thanks, I'll do that @noalak what do you say is that fine if I won't do the loader side for now?
You don't need to do anything loader side since it's already done as deltakosh said :) Export a fur object with your new exporter and try it out in the babylon sandbox. Should work right away!
@noalak ok, I'll do that.
I've meant loading .babylon
files in 3dsmax (not sure that this is even possible)
It is not unfortunately
How do I extract the diffuseColor
from IColor
obj? I have no GetDiffuse
method like IGameMaterail
, and even more importantly how do I extract the texture for the diffuseTexture
?
for (short paramId = 0; paramId < paramBlock.NumParams; paramId++)
{
var name = paramBlock.GetLocalName(paramId, 0);
// TODO - check translation
switch (name)
{
// Other paramters I extract
case "Root Color":
var color = paramBlock.GetColor(paramId, 0, 0);
// here... how do I extract those paramaters from color obj?
break;
}
}
Thanks again guys :)
mtl.ActiveTexmap.GetSubTexmap(0);
Anyway the diffuse color is just a color with rgb channels. By default, for me root color is a dark yellow. I don't understand the issue here.yes I have, but I have no idea from which paramBlock I can get the material (seems like no one according to the following code example)
for (short paramId = 0; paramId < paramBlock.NumParams; paramId++)
{
var name = paramBlock.GetLocalName(paramId, 0);
// TODO - check translation
RaiseMessage("name = " + name);
try
{
var a = paramBlock.GetMtl(paramId, 0, 0);
RaiseMessage("working = " + name);
} catch(Exception e) {}
//...
}
unfortunately didn't print "working" at all :)
BTW sorry for all the questions, Autodesk documentation really sucks.
@noalak thanks :)
@noalak any thoughts? :)
Sorry for late answer. In case you are still in trouble find attached the code to retreive the maps.
Maps has paramId = 51 MapsEnable has paramId = 52
Maps should always be enabled when they exist (not null) since there is no checkbox like in StandardMaterial. So it's not necessary to test for it.
Glad you got an answer for the color map ids :)
Sorry for the delay. Anyways, I think I have only 1 bug left - the hair is exported according to the parameters but for some reason, there is a gap between the hairs and the mesh they suppose to be attached to.
Playground where you can see it
@deltakosh would very much appreciate your help :) forgot to say - @noalak thanks again for the answer, it was very helpful :)
Hey can you try to fix the value of furLength to 0 ? Like this: https://playground.babylonjs.com/#87I67A#4
Thanks, @julien-moreau :)
I was certain that furLength
actually determines the length of the fur and not the distance from the obj.
So the only parameter that actually determines the length of fur is the fur spacing? (I thought that spacing determines from how many meshes each fur will be made of)
If that's true I can only suggest changing the name of furLength
to furDistance
(and of course update the documentation as well)
You are right, sure I will update :) For backward compatibility, we kept the variable names like this one which was here before we update to the high level fur mode. Updating the doc!
@julien-moreau Awesome, thanks, so I will also update the exporter and will create a PR tomorrow.
Excellent! :)
Hello :) I think it will be very useful if we will be able to export 3dsmax hair & fur modifer as Babylon.FurMaterial
in the meantime do we have any other way to export fur & hair from 3dsmax to Babylon.js?
Thanks!