Adsense

2013年1月31日木曜日

mesh, object, side, material,,, Hmmmm?

In order to understand secondlife mesh system for making pmx mesh dolls, I’m trying to recognize mesh as the following.

  • mesh = prim
  • mesh has up to 8 materials
  • materials = sides (faces), can be customized in texture, shininess, color, glow and transparency. (by manual or script)
  • object is configured by several prims (linked prims)
  • object is configured by several meshes (like linked prim)
  • Alpha channel implementation in secondlife is damned!!!!

For example, if pmx model has 32 materials for setting color (to be exact, for setting its diffuse, specular, ambient, transparency, texture, toon, sphere and so on), you should divide mesh to 4 mesh objects. One mesh object can have up to 8 materials in secondlife collada model therefore it should be divided and linked.

Fortunately some pmx importer can import diffuse/specular/ambient setting to blender. In secondlife, we can not set up diffuse/specular/ambient to “side(material)” but diffuse color is converted to side color.

Animasa style Rin Act2 pmd model has 27 materials
27mats

pmx importer can export diffuse, specular color to blender
matBlender

In blender edit mode, you can separate meshes with “material”.
[Mesh] – [Vertices] – [Separate] – [By material]
separatebymaterial

If you use “blender_mmd_tools” (https://github.com/sugiany/blender_mmd_tools), tool provides [separated by materials] which separates mesh and set one mesh to one appropriate material. Default blender separating by material can not omit extraneous materials therefore you should delete them manually later. I recommend bender_mmd_tools for separating by material.

rinMats

Now Rin mesh model has 27 mesh objects. In uploading to secondlife, one mesh has at least 1 land impact(download) therefore to reduce land impact, you should join mesh objects under 8 materials (= 8 meshes into 1 mesh).

afterjoiningmesh

Change all JAPANESE name to English including texture name, if you would like to avoid “parse error” in uploading. The names are not important(we will not use the names) but should be alpha numeric character.

Select all objects by [A] in object mode, check collada option (blender 2.65a) and export as collada file(dae). Especially [Apply Modifiers], [Selection Only] and [Include Material Textures] should be checked for mesh doll.

In upload dialog, optimize land impact by triangle limit for each LOD. It’s my personal recommendation, around 20 land impact might be better.

uploadrin

Upload and rez it!

RinAct2

You can understand pmx model material diffuse color exported as “prim face color” in secondlife by [Edit], [select face] option and [Texture] – [Color].

diffuseColor

Good luck and enjoy ウインク

2013年1月28日月曜日

Making liner – Normals inside

In 3DCG, face has “normal vector” which means “visible face” or “outer material”.
PMX model also has normal vector on face however MMD allows “両面描画”(both sides drawing) option by PMX editor, you can see “liner” by this option.

No liner – no both sides drawing option for skirt
linerOff

Liner – by both sides option for skirt material
linerOn

PMX Editor “両面描画” (both sides drawing) option
両面描画

In importing pmx model to blender, even though “both sides drawing” option is checked, you can NOT see inside normals(liner).

normalsblender
in edit mode, press [N] and check face icon in [Normals]. blue line is normal vector.

When you export collada model to secondlife, no normals materials get transparent because there are not anything as faces.

colladaNoIiner

Therefore you should make new faces which have inside normals.
By using materials selection, vertex group assign or anything, select faces you want to copy.

selectskirt

Press Shift+[D] to make duplicate and [Enter].
And press [Mesh] – [Normals] – [Recalculate Inside].

shiftdandenter

Check inside normals.
insideNormals

In terms of “Secondlife Collada Exporting”, sometimes you can see huge number of “land impact” by this approach. For example, when I upload this skirt mesh model with liner, I can see 308.048 even though LOD low and lowest are 0.

landimpact1

Land impact is not simple vertex count. It depends on shapes.
If you see huge number of land impact by making liner, you should separate liner as another object in blender.

When you duplicate inside faces, you should assign to new vertex group or separate vertices by selection. And select all objects and try to export it as collada.

You can see 9.074 land impact in the following snapshot.

landimpact2

Also liner is not transparent in-world.

visibleLiner

Good luck. ウインク

2013年1月19日土曜日

Struggling with mesh morphing in secondlife

In conclusion, we can NOT implement custom mesh morphing in secondlife up to date. Still morph target is community proposal level.

http://wiki.secondlife.com/wiki/Morph_Target_Community_Proposal

However some adventures are trying to implement mesh morphing in secondlife. Actually it’s NOT vertex morphing but until Lindeln lab implement custom vertex morphing, it might be only one way we can do it in-world.

Shirousagi san’s challenge

Especially facial expression is so hard to implement without morphing.
In order to make something happen without vertex morphing in secondlife, we can use “flick book”.

Blender 2.65a provides us “collada exporting with shapekey” option. Using this option, we can make transformed mesh object by shapekey.

g00

g01

g02

g03

g04

g05

Uploading these meshes, we can see mesh like “linked prims”. By LSL llSetLinkAlpha and so on, we can control transparency of each mesh. It means we can make flick book animation as follows.

But there are some issues we should improve. The way is still long and long .ウインク

2013年1月16日水曜日

Secondlife mesh limitations

http://wiki.secondlife.com/wiki/Limits

Limitations

  • Number of vertices : 65536 vertices per “LOD” for each mesh(object)
  • COLLADA file size : 8MB(compressed), 256MB(raw collada)
  • Bone influence weights per vertex : 4
  • Number of materials per mesh(object) : 8
  • Number of materials per face : 1

Mesh model can be multiple “linked” objects. It means One mesh doll can be constructed by multiple objects like “prims”. Vertices and material limitation has relevance to mesh(object, prim). If you have over 8 materials for one model, you can divide model to multiple objects and set materials for each object under limitation.

Also total number of vertices can be over 65536 with multiple objects but as a result, Land Impact will be so big number like over 300, you can not rez model on the ground, even though you can upload mesh. (But you can attach model on your avatar, if you want to see it.)

SlUpload
(Total vertices 96078, Upload fee L$342 and Land Impact 348)

Material, face and texture

In the near future when we get “Secondlife Materials Viewer”, we should consider materials (like specular, normal…) more and more.

Secondlife Materils viewer preview


However now we should know the followings.

  • Texture (Picture)
  • Colour
  • Shininess
  • Glow
  • Transparency
  • Full Bright

If original model uses over 8 textures, you should divide model to multiple objects due to the materials number limitation. But don’t divide model to a number of textures of objects. Al least 1 object use 1 Land impact. If you divide model to 8 objects, you will have at least 8 Land Impact. 1 object can have 8 faces (= materials = a number of texture). So you should keep number of objects less.

Also you have same texture for model but if you want one of them “shine”, you should divide materials (= use other face).

Snapshot1_001
A model with multiple objects (not good example. too many separated objects)

Snapshot2_001
Low shininess for hair and eye material (selected face), a little bit “glow” face and skin.

Object menu - [Edit] – [Select Face] option gives us “select material”. “material of mesh” in blender is same to “face of prim” in secondlife. If you set appropriate materials in blender, you can set texture, shininess, colour, glow, transparency and full bright option for material like face of prim.

Good luck.

mesh model : IA http://ia-project.net/vocaloid/
pmx modeller : mqdl san http://mikumikudance.wikia.com/wiki/IA_(Mqdl)

Tools as of today

blender 2.65a http://www.blender.org/download/get-blender/
blender addon - blender2pmx 1.24 http://u7.getuploader.com/Yjo_oi_Neg/
blender addon - blender_mmd_tools 1.1 https://github.com/sugiany/blender_mmd_tools
pmx editor 0.2.1.6 http://kkhk22.seesaa.net/category/14045227-1.html
secondlife viewer 3.4.X http://secondlife.com/support/downloads/

Hatsune Miku Append pmx model by Tda
http://u16hp.blog134.fc2.com/blog-entry-42.html

mikuappend