1
\$\begingroup\$

It is not trivial to use your own shader on blender, so I've created a good-looking webgl shader. Now, what do I need to use the things I made in blender on it? An obvious first idea would be to parse the blender format. For that, I need to know it's specification: what does it include? Meshes? Bones? Animations? Vertex colors? What else? But I guess there could be easier paths, though. Maybe an exporter from Blender to an easy-to-understand JSON format exists? So that is my question, what is the fastest path to use blender files with my webgl renderer?

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

This is going to depend on what you want to work with. Blender has an export feature which will allow you to export the models into several formats. If you want to write a customer parser, there are a few for various formats. You mentioned WebGL, which makes me think you're going to be working with JavaScript. With this in mind, Three.JS has some built in loaders you could use:

enter image description here Source

With this in mind, you could use Blender to export to several of these, such as Collada, JSON, or OBJ. Just research the method you want to use, such as OBJ.

If you want to write your own loader, you can find documentation on these more popular formats all over the web:

\$\endgroup\$
4
  • \$\begingroup\$ If I understand this, .obj format has no information on texture UVs nor bones nor animations, correct? Does collada offer those? I can't find it. \$\endgroup\$
    – MaiaVictor
    Apr 6, 2014 at 22:30
  • \$\begingroup\$ Collada supports animation without a doubt. You are correct that OBJ does not. If you use a library, it is possible to combine multiple of these as the loaders will support many of them. \$\endgroup\$ Apr 6, 2014 at 22:32
  • \$\begingroup\$ @Dokkat .obj does indeed support UVs (and normals), though it does not support multiple texture coordinate channels, tangents/bitangents, mesh skinning/animation of any kind, or object hierarchies. \$\endgroup\$
    – bcrist
    Apr 6, 2014 at 22:54
  • \$\begingroup\$ '.obj' also lacks normals/binormals so you can't use them for normal mapping unless you calculate them after loading the file. \$\endgroup\$
    – TenFour04
    May 4, 2014 at 23:26
1
\$\begingroup\$

The easiest approach is probably going to be exporting to COLLADA. Blender comes with a COLLADA exporter out of the box, so you'll just have to import the COLLADA XML data into your own data structures.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .