aerys / minko

3D framework for web, desktop and mobile devices.
http://minko.io
Other
904 stars 210 forks source link

Blender addon #220

Closed JMLX42 closed 4 years ago

JMLX42 commented 8 years ago

Hello,

I'm starting this thread to discuss the features of our future Blender addon. There is no release date yet for this addon. But it will eventually be released before the end of 2015 and it will be open source.

Here are videos of the addon in action:

http://blogs.aerys.in/jeanmarc-leroux/?attachment_id=2870 http://blogs.aerys.in/jeanmarc-leroux/?attachment_id=2869 http://blogs.aerys.in/jeanmarc-leroux/2015/08/24/introducing-the-minko-blender-plugin/desktop-08-23-2015-14-46-37-04/

And a live app screenshot using lightmaps pre-computed by Cycles:

http://blogs.aerys.in/jeanmarc-leroux/?attachment_id=2867

List of the features implemented by Aerys:

Features that could be added by the community:

Any suggestions?

breebee commented 8 years ago

Hey! It seems the videos are not working on my end, tried to download them manually from the source but vlc player as well shows only still frame. I think some good features you can consider would be to be able to make html elements within blender, like take a cube and give it a

JMLX42 commented 8 years ago

Another nice thing would be to be able to save the .html scene

3D scenes and HTML files are two different things. The goal of the Blender addon is to build apps. If you just want to have 3D scenes on a web page, you should use the cloud platform on http://minko.io .

If you want to build HTML5 apps using blender and C++ Minko scripts, it's already supported.

I think some good features you can consider would be to be able to make html elements within blender, like take a cube and give it a attribute somehow so you can do things like href="another.html" or run functions onClick

That's what scripts are for. We can't possibly implement all the possible behaviors. But implementing such script and setting it on the scene is very simple.

breebee commented 8 years ago

Blend4web 3d scenes are exported into single .html files from blender.. Is it not worth looking into working with them, or using there SDK? Just a suggestion, if you look into there work it is very impressive.

JMLX42 commented 8 years ago

Blend4web 3d scenes are exported into single .html files from blender...

Minko already does exactly that, even without Blender. And it does the same for Windows, Linux, OSX, Android and iOS.

The Minko Blender addon just gives a user friendly UI to do it.

breebee commented 8 years ago

Ooooh ok i missunderstood "3D scenes and HTML files are two different things." .Will you be able to code c++ within blender? Do you think it will be easy to load a level with c++ to open from one html file to another? If it is possible, will there be a way to reuse the c++ class later on within the user interface?

JMLX42 commented 8 years ago

Will you be able to code c++ within blender?

You'll be able to assign C++ scripts on blender scene objects. C++ scripts are written in your preferred IDE.

Script properties are parsed automagically so you can configure them directly in Blender. Script properties are also synced in real-time: when you change a script property in Blender, it updates the corresponding value in the running app.

If it is possible, will there be a way to reuse the c++ class later on within the user interface?

That's what scripts are. And you can already use them without blender.

breebee commented 8 years ago

Hey im not sure if your aware of the "verse" protocol http://verse.github.io/verse/ but it might be interesting to look into compiling with minko for a built in networking system. It seems to be a really fast protocol and someone has made a gpl plugin for blender already https://github.com/verse/verse-blender hope this can be a small contribution for now.

JMLX42 commented 8 years ago

Hey im not sure if your aware of the "verse" protocol http://verse.github.io/verse/ but it might be interesting to look into compiling with minko for a built in networking system

Very nice finding!

Today we use a very simple JSON protocol on binary sockets to have a live sync between the app and Blender. It "works" enough. It's also simple enough to be directly embedded inside the app without requiring an additional Minko plugin to link against.

But we'll keep that in mind for a future version. Definitely a good idea.

JMLX42 commented 8 years ago

More build targets (HTML5 and Android first): currently we build only for the host target.

Actually we just did that this week. So we can take it off the list.

New ideas welcome...

breebee commented 8 years ago

So currently for unity 3d and unreal engine when you build to html it will compile everything like shaders, characters and levels ect, but in the end the files will be very big. Maybe it would be a good idea to be able to organize assets and various content into seperate html build to dynamically load. For example having a small 800 kb index.html build with only a user interface to get the browser to load right away and from within that user interface you can load assets or levels seamlessly. Maybe a way to layer the builds with special iframe methods is possible. Overwriting modifications to those dynamic assets would also be very good.

JMLX42 commented 8 years ago

Maybe it would be a good idea to be able to organize assets and various content into seperate html build to dynamically load

Minko exports assets in its custom "*.scene" format which enables 2D/3D streaming. So it can load up to 200x faster on the web.

It's not specific to the Blender addon, which is mainly designed to:

Ithamar commented 8 years ago

Sounds like the Blender add-on is (almost?) a replacement for Minko Studio, cool ;)

One feature I'm interested in is Vehicle support, I understand the current bullet plugin has no support for that (yet), but it would be a great to have!

breebee commented 8 years ago

"Minko exports assets in its custom "*.scene" format which enables 2D/3D streaming." so these minko scenes will need to to have a live blender scene active like a host? Im slightly confused sorry, will making games even be possible then or will it be only for showing 3d models??

JMLX42 commented 8 years ago

Sounds like the Blender add-on is (almost?) a replacement for Minko Studio, cool ;)

Yes. But a lot better since we have lightmaps thanks to Cycles and the ability to add scripts to scene nodes. As a result, there is a much better developer/artist workflow.

One feature I'm interested in is Vehicle support, I understand the current bullet plugin has no support for that (yet), but it would be a great to have!

Current plans include basic colliders (box, sphere...) setup because they are already supported in the engine. To support vehicles in Blender we have to support them in the engine first.

so these minko scenes will need to to have a live blender scene active like a host?

Blender scenes (.blend) are automatically converted to Minko scenes (.scene) when the app is built. Minko scenes are much more suited for real-time apps, especially on mobiles and the web.

will making games even be possible then or will it be only for showing 3d models??

If you just want to show 3D models, use the minko.io cloud platform. If you want to build apps, use the Minko engine and eventually the Blender addon to make your life easier.

breebee commented 8 years ago

Ok thanks for clarifying. Is it possible to load assets from different .scene files dynamically and save / load modifications to them allowing a small and fast initial browser load and scalability for big apps? Or is this sort of feature not going to be possible.

JMLX42 commented 8 years ago

Is it possible to load assets from different .scene files dynamically and save / load modifications to them allowing a small and fast initial browser load and scalability for big apps?

Yes. But then again it has nothing to do with Blender. Please try to focus on Blender as a "3D IDE" here. If you have questions about the engine, please open another issue or post on stackoverflow.

breebee commented 8 years ago

Thank you and sorry =) I will give you ideas then. A visual programming implementation like logic bricks or unreal engine blueprints would be very awesome for people scared of coding. Here is a video of someone converting logic bricks to python script https://www.youtube.com/watch?v=JhzbTIf3Rt4

breebee commented 8 years ago

Another idea would be to be able to use blend shapes for things like "in-game" character creation.

JMLX42 commented 8 years ago

Today I added the "add/remove script at runtime" features. One can now add/remove a script to/from a scene node while the app is running: the script will be added on the same node in the live app. It's great for adding/testing/removing behaviors at runtime.

Another idea would be to be able to use blend shapes for things like "in-game" character creation.

I'm not sure what you mean by that. Could you please elaborate ?

Ithamar commented 8 years ago

@promethe42 , when you talk about scripts, are you talking about Lua scripts? I don't imagine you're "injecting" native C++ code into the app "live" :smile:

JMLX42 commented 8 years ago

when you talk about scripts, are you talking about Lua scripts? I don't imagine you're "injecting" native C++ code into the app "live"

We've dropped support for Lua on the dev branch because the bindings were simply to complicated to maintain. But working on the Blender addon and using libclang to parse headers gives us new options to generate such bindings automatically. Maybe Lua will be back if we can automate the bindings and their documentation.

Still, I'm talking about C++ scripts yes. The Blender addon uses libclang to parse the script headers (basically any class that extends component::AbstractScript). So we can list the script "properties" (setters or public members of supported types). Using this list of properties, the plugin can:

Here is an example manifest file:

{
  "RendererScript": {
    "hash": "41c92b356b0f61541bf25d373e3336d7",
    "path": "src/RendererScript.hpp",
    "mtime": 1442423951.4305944,
    "properties": {
      "_contextErrors": "bool"
    }
  },
  "RotateScript": {
    "mtime": 1442394992.9355133,
    "path": "src/RotateScript.hpp",
    "hash": "c79578251528b03538cfa5df68f63864",
    "properties": {
      "speed": "void(float)",
      "axis": "void(minko::math::vec3)",
      "pre": "void(bool)"
    }
  }
}

The manifest file is unique for your entire project. So we have the introspection metadata for all the scripts you use at author time in all the scenes of the project. When we build the app, the manifest file is used to generate some C++ code:

scripts["RotateScript"].ctor = [](){ return std::static_pointer_cast<minko::component::AbstractScript>(std::make_shared<RotateScript>()); };
scripts["RotateScript"].vec3Setters["axis"] = [](AbsScriptPtr s, minko::math::vec3 v){ std::dynamic_pointer_cast<RotateScript>(s)->axis(v); };
scripts["RotateScript"].boolSetters["pre"] = [](AbsScriptPtr s, bool v){ std::dynamic_pointer_cast<RotateScript>(s)->pre(v); };
scripts["RotateScript"].floatSetters["speed"] = [](AbsScriptPtr s, float v){ std::dynamic_pointer_cast<RotateScript>(s)->speed(v); };
scripts["RendererScript"].ctor = [](){ return std::static_pointer_cast<minko::component::AbstractScript>(std::make_shared<RendererScript>()); };
scripts["RendererScript"].boolSetters["_contextErrors"] = [](AbsScriptPtr s, bool v){ std::dynamic_pointer_cast<RendererScript>(s)->_contextErrors = v; };

The introspection metadata is used to instanciate scripts by their (class) name or set properties via their respective names. We then use a simple client (the app) / server (Blender) JSON protocol to send some commands such as add a script, remove a script, set a property... Setting script properties while the app is running is really awesome to iterate rapidly. It's also very cool for artists because they can now tweak a lot of things on their own. For example, a script can be used to customize some shader values.

Doing it over the network is also very cool because it means you can move objects in Blender, and they will move in the Android/iOS app. You can change a script property, and it will change right on your phone/tablet. You can re-compute a lightmap, and it will be updated in the live app so you can check the result immediately.

So it's very static for now: scripts that are not "knowned" at author time cannot be dynamically added at runtime. It could be done via a DLL + dlopen I guess, but that's some extensive work. Especially since we support so many different targets (win, lin, osx, android, ios, html5...). For now, you just have to make sure the script exists before you compile the app. If you want to use a new script, you'll have to re-build the app, which is not that big of a limitation because it doesn't happen a lot.

Also I still have to test VS2015's "edit and continue" feature. Because I guess it could be used to modify the script code/behavior while the app is running. Which is even cooler !

Another thing we've added a few days ago is the possibility to assign a specific Minko effect (file) to a Blender mesh. It's super useful because artists can now set shaders on the scene themselves. I'll add that to the "done" list.

Ithamar commented 8 years ago

Wow, cool stuff @promethe42, thanks for the detailed explanation!

I just saw that Vehicle support is now at least on the TODO also, does this mean Aerys has/will allocate resources to that? I'm willing to have a go at implementing the engine side myself (already have some very early code for that), but don't want to duplicate efforts.

I can open a separate ticket for that over the weekend, just wanted to know if it would be worth spending (my free) time on it ;) Any ideas/suggestions you guys have on how that would be best implemented is welcome (esp. in regard to the Blender add-on), otherwise I'll propose a patch and see if you like it....

JMLX42 commented 8 years ago

I just saw that Vehicle support is now at least on the TODO also, does this mean Aerys has/will allocate resources to that?

No. We're focusing on the basics and the things we need to developer our apps for now.

I can open a separate ticket for that over the weekend, just wanted to know if it would be worth spending (my free) time on it

We'll help as much as we can. Adding vehicles in the engine should not be too hard I guess. If you do it we'll merge it.

I've split the list in two to show the difference between things Aerys will do and things the community could do.

breebee commented 8 years ago

Sorry i said blend shapes, i meant °shape keys° which blender uses to morph a mesh with sliders set from shape targets located in blenders vertex-vertices panel. Here is B4W implementation with an example from there previous release https://www.blend4web.com/en/article/122/ and there is various information about blenders shape keys in general.

JMLX42 commented 8 years ago

i meant °shape keys° which blender uses to morph a mesh with sliders set from shape targets located in blenders vertex-vertices panel

Blender already support mesh morph. The Minko engine doesn't though. If we had vertex target morphing in the Minko engine, I don't think we would need anything specific in Blender to make it work. It's more something that you should open a new issue about so that we can mark it as a Minko engine future feature.

JMLX42 commented 8 years ago

Lately we've been working on "presets" to give artists and developers the ability to have per-target properties. The idea is to be able to have one single scene file that will be exported differently according to the target platform.

So I'm adding three things to the list:

JMLX42 commented 8 years ago

Added to the list:

breebee commented 8 years ago

Wow! Blender to ios?! It sounds too good to be true :) Keep up the great work and add a "Buy us a coffee button" somewhere so your supporters can have a way to thank you.

JMLX42 commented 8 years ago

Wow! Blender to ios?! It sounds too good to be true :) Keep up the great work and add a "Buy us a coffee button" somewhere so your supporters can have a way to thank you.

You still need a Mac though.

JMLX42 commented 8 years ago

Adding to the list:

breebee commented 8 years ago

great new updates from blend4web! Big release a couple days ago!!!! https://www.blend4web.com/en/article/161/ collaborate if you can guys!

Borderliner commented 8 years ago

Awesome!