XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > StarCraft (только чтение)> StarCraft 2 inside
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.


 
Arte_de_Mort

offline
Опыт: 23,452
Активность:
Цитата:
Сообщение от ScorpioT1001
> Есть модель, к костям привязаны вершины с учётом веса вершин.
это где так? в варе кости к ним привязаны вершины, поведение которых эквивалентно поведению костей

везде... на одни и те же вершины могут действовать в различном % соотношении разные кости со всеми соответствующими деформациями
Старый 21.03.2010, 00:34
WaterMan
J.R.R.
offline
Опыт: 17,019
Активность:
Согласен. По крайней мере, в визе, чтобы подвинуть нужные вершины в ту или иную сторону приходится иногда двигать все кости, которые влияют на эти вершины.
Старый 21.03.2010, 08:42
ARCHIMONDE
Маг'хар
offline
Опыт: 16,313
Активность:
Arte_de_Mort, да если одна вершина крепиться сразу к двум костям то веса делятся по 0.5 на "рыло", а вот допустим поставить 0.8 на одну кость и 0.2 на вторую не получиться.
Старый 22.03.2010, 09:55
ScorpioT1000
Работаем
online
Опыт: отключен
в варе может и так, но в нашем инструментарии нет адекватного способа проанимировать вершины с равномерной привязкой к 2 и более костям.

ScorpioT1001 добавил:
ну и естественно ск2 итп тоже этим не обделён..
Старый 22.03.2010, 20:59
ScorpioT1000
Работаем
online
Опыт: отключен
и так, мы имеем плагин для макса :) и никто не поможет с m3
Старый 03.04.2010, 00:13
Arte_de_Mort

offline
Опыт: 23,452
Активность:
о каком плагине речь?
Старый 03.04.2010, 07:20
Sebra

offline
Опыт: 5,603
Активность:
Старый 03.04.2010, 10:57
Инквизитор

offline
Опыт: 7,037
Активность:
качество моделей чуть хуже ВоВ, убермодмейкеры могут начать подбирать и конвертить модели из вовки и планировать свой варкрафт3 с блекджеком и шлюхами -_-
Старый 05.04.2010, 13:22
Arte_de_Mort

offline
Опыт: 23,452
Активность:
а че насчёт моделей для кампаний, слышал там есть хай поли для внутриигровых роликов и т.п.
Старый 05.04.2010, 13:26
Tiodor

offline
Опыт: 75,784
Активность:
This is mostly for witchsong and myself, but feel free to eavesdrop :)
I'm going to explain how I setup the bones/mesh in my maxscript plugin. I'm not very good with matrices, so maybe you can shed some light on what I may be missing. To begin with, I have noticed alot of parallels between the MD5 (doom3) model format and M3. I believe they use similar methods to animate their models. You can find out more about the MD5 file format at Doom3world.
Bone Arrangement
The IREF chunks in M3's seem to contain the transformation matrix for each of the bone nodes. However this is not the bindpose, the nodes are additionally positioned, orientated and scaled through the bone chunks all relative to the parent. In my script I don't even use the matrices to arrange the bindpose bone setup.
First, I create all the bones, then I set up the chain by linking all the bones with parents to their parent bone. After that I iterate through the bones based on depth so that I begin with bones furthest from the root bone of the chain. Then I apply the scale, rotation and position (in that order) to the bone in the coordinate system of the parent bone (in maxscript you have to indicate the coordinate system) for all the bones so that the root bone is done last. I'm not sure if this is the correct way to go about arranging the bones but it gives me what I believe is the bindpose of the model when no animation data is present. That's the bindpose of the bones covered. Code is here:

"" mb = mread.bones -- M3 bone chunks
for i = 1 to mb.count do -- iterate through bone chunks
(
b = mb[i] -- assign b current bone in iteration
-- create bone node, placement seems irrelevant as changed later
cb = BoneSys.createBone [0,0,0] [0,0,0] [0,0,0.1]
__-- 3ds Max settings, nothing important just visual elements
cb.name = b.name
cb.width = bonesize
cb.height = bonesize
cb.showLinks = true
cb.boneScaleType = #none
-- append the cb node onto cbones array (maxscript dynamically enlarges array)
append cbones cb
)
max views redraw -- redraws all viewports
-- After bone nodes are created, link them together
echo "Setting up bone hierarchy"
for i=1 to mb.count do -- iterate through bone chunks/nodes
(
b = mb[i] -- current bone chunk
-- Maxscript uses 1 based arrays instead of 0 based
-- -1 for no bone becomes 0, 0 becomes 1, and so forth
if b.parent!=0 then -- if bone has a parent...
(
cbones[i].parent = cbones[b.parent] -- assign the nodes parent
)
)
echo "Set up bone depth"
-- sort bones by depth function, returns an array of depth assorted bones with
-- x and y members. x indicates depth of bone, y indicates the bone
local bd = M3_Get_Bone_Depth mread.bones
echo "Set up bone transform"
for i=1 to cbones.count do -- iterate through bone nodes
(
-- Do deepest bones first
local h = bd[i].y -- h = bone to transform
b = mread.bones[h] -- M3 bone chunk
cb = cbones[h] -- 3ds Max bone node
__in coordsys parent -- in the parent coordinate system
(
-- apply the scale, rotation and translation in the bone chunk
-- to the bone node
cb.scale = b.scale
cb.rotation = b.rot
cb.position = b.pos
)
)

Vertex Setup
Now the bindpose is not arranged so that it deforms the standard mesh, so you need to adjust the vertices so that the mesh fits the bone placement. The way I do this, I really don't understand the math completely to be honest, but it seems to work at least partially. Iterating through each vertex:

  1. Multiply the original vertex position by the IREF matrix of the first bone it's weighted to (I assume there's a way to do all the bones a vertex is weighted to but I don't know how yet)
  2. Multiply the new vertex position by the scale, inverse rotation and position of the bone. The rotation is the inverse due to the way 3ds max stores transform matrix rotations.
-- 2. for each vertex, setup the bone weights and adjust the vertex position
for j=1 to mread.verts.count do -- iterate through vertices
(
v = mread.verts[j] -- current vertex
for h = 1 to 4 do -- for each of the possible bone weights
(
if v.bw[h]>0 then -- only if the bone weight is larger than 0...
(
k = v.bi[h] -- the bone lookup index associated with that weight
-- grab the bone index from the bone lookup (+1 as maxscript arrays are 1 based)
b = mread.blist[k] + 1 -- bone to adjust the vertex by
if h == 1 then
(
-- only adjust based on the first bone weight for now
-- multiply original vertex position by the bone IREF matrix, returns new position
pos = v.pos * mread.IREF[b]
pos = pos * cbones[b].scale -- adjust position by bone node scale
pos = pos * (inverse cbones[b].rotation) -- by bone node rotation
pos = (pos + cbones[b].position) -- by bone node position
meshop.setvert m j pos -- move vertex to final calculated position
)
)
)
)

Hopefully that makes a bit of sense. I know maxscript can be confusing to read coming from C. Now I know the bones/mesh seems a bit off. I'm not sure why, I think this is as far as I can get. Figuring out the rest will be up to someone who has a better understanding of matrices and such.
I've got a few models to compare to show that my bindposes are at least mostly accurate. The in-game shots are done by blanking all the animid's in the bone chunks so that they don't reference any sequence data. All you're left with is the bindpose of the model. I notice that some meshes aren't in the right place, I believe this has something to do with vertices that are weighted to multiple bones which I'm not taking into consideration, and also attachments using their own transformation matrix.
Старый 06.04.2010, 13:40
WebSter
Товарищ Mechanicus
offline
Опыт: 86,111
Активность:
Tiodor, оформи код как полагается что ли...
Старый 06.04.2010, 15:44
Tiodor

offline
Опыт: 75,784
Активность:
WebSter, или у меня кривые руки или новое форматирование с этим кодом не может норм работать...
Старый 06.04.2010, 23:23
ScorpioT1000
Работаем
online
Опыт: отключен
и так всё понятно. это почти ни о чем не говорит)
ScorpioT1001 добавил:
у нас есть структура m3, но мне лично некогда писать. вот если бы кто-то шарящий в плюсах помог
Старый 07.04.2010, 00:54
Инквизитор

offline
Опыт: 7,037
Активность:
Меня очень заинтересовало, как анимированы волосы зелотов и щупальца противовоздушных юнитов зергов. кто нибуть знает как или это новая фича?
Старый 27.04.2010, 18:04
ReplikanT
Я вернулся
offline
Опыт: 13,516
Активность:
Инквизитор, физический движок Havok, умеет анимировать волосы, жидкости и тд., на основе него и анимированны волосы, водопады и щупальца соответственно.
Старый 27.04.2010, 18:25
Инквизитор

offline
Опыт: 7,037
Активность:
ReplikanT, спасибо, ты батько :)
Старый 27.04.2010, 18:27
D
Ò_ó
offline
Опыт: 17,390
Активность:
Инквизитор:
качество моделей чуть хуже ВоВ
Это только модели юнитов, окружения, но еще есть портреты, модели из интерлюдий, которые является высоко полигональными(сравнительно, даю около 2-4 к поликов на портреты и 8-10 к поликов на модели интерлюдий (типа вот тут ))
Старый 27.04.2010, 18:58
iZucken
ШТО
offline
Опыт: 17,960
Активность:
Инквизитор:
Меня очень заинтересовало, как анимированы волосы зелотов и щупальца противовоздушных юнитов зергов. кто нибуть знает как или это новая фича?
Это просто риббоны продвинутые охохо т.е. это как бы источники частиц ага
Старый 27.04.2010, 19:18
Wulfrein
где я?
offline
Опыт: 88,142
Активность:
Demob:
даю около 2-4 к поликов на портреты
да, у гидрала, например, 4750
Старый 27.04.2010, 20:41
VampireLord

offline
Опыт: 820
Активность:
Народ будет вообще конвентор .mdx\mdl <-> .m3?
Так ведь чуток подработать модели варика и в игру
Старый 06.05.2010, 23:15

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 12:30.