Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Dynamic shadows for bone models with around 120-130 bones

Author
Message
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th Mar 2015 22:16 Edited at: 16th Mar 2015 22:18
The evolved shaders doesn't work with bone models and the fix that green gandalf made to use it with bones allow a maximum of 60 limbs (bones + geometry), as I have a characters a bit complex which required a lot of bones (total limbs is probably like 120-130, bones + geometry), how can I do to make a dynamic shadow for him?

At the moment I am using the same object with way less polygons flattened on the ground, with the same animations, it works not too bad and eat just 3 fps but as it is flattened can't be rotated properly with the rotation of the main character (for example if the character is rotated 0 or 180 degrees on the y axis it is fine, but if is rotated to 90 or 270 degrees the shadow has the same rotation of the 0-180 degrees ones, as can't be rotated, so is not realistic).

Is there some other kind of smart way to do dynamic shadows or someone knows a shader that can handle 120-130 limbs (bones + geometry)?
Kuper
18
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 16th Mar 2015 22:44
You can render your object pure black and then project this image like dynamic shadow. I dont think that you can use any shader solution because of limitation inside shader system.So you cant make it with shadow on animated object itself only on ground.
Still you can separate it in 3 parts and use shader on each of them

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th Mar 2015 23:09
Quote: "You can render your object pure black and then project this image like dynamic shadow."


How can I do this?
Kuper
18
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 17th Mar 2015 13:45
Quote: "How can I do this?"

Load small black image - texture animated object with it - on other object set shader which color them white - render with camera - project the fianl image

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Mar 2015 18:27
sorry but this is not clear at all, can you make an example?
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 17th Mar 2015 18:56 Edited at: 17th Mar 2015 18:56
I believe that 60 bones is a DBPro limit. But it seems there is a work around. This is a quote from lee.

Quote: "I only managed to get the bone count per mesh to 60 before the shader refused to take any more matrix data, so I guess 60 is your top limit for 'bones per mesh', but can have more bones just dont associate them all with a single mesh, use a few meshes. Also make sure no more than four bones influence once vertex or the shader will throw another wobbler. I thought about adding a mode for GPU skinning so bone limit is not a factor, but do you really want to take this step backwards into CPU land? Feedback welcome.""


Here is a link to the post.

http://forum.thegamecreators.com/?m=forum_view&t=133850&b=21&p=5

If you break your model into more than one mesh it should work.

WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Mar 2015 19:17
It is already made by different limbs (base object, shirt, jeans, shoes, eyes, eyelashes, teeth, tongue). I have no control at all over the rig because the character comes already rigged by Makehuman, and as I needed all the bones of the hands to close properly them, I must chose rigs with a minimum of around 80 bones, 110-120 bones was the rig i have chosen previously for the main character, realizing only later that the 80 rig was enough, but now I must keep it how it is or I must redo the character from zero and make all the animations again (are plenty and some complex so no time for that), also, even redoing the character from zero it will still have the 80 bones which are too many anyway to be handled by the shadow shader.
The main character is animated properly by the way even if has 110-120 bones plus all the limbs taken by the meshes previously mentioned, so I don't know what do you mean about dbpro limit, maybe for the shadow shader?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Mar 2015 23:10
Quote: "maybe for the shadow shader"


That's the problem. The restriction is caused by the 256 limit of the shader constant table. The bone matrix palette used by the shader for the animations uses up nearly all of the constant table entries leaving just a few locations available to store other information required by the shader.



Powered by Free Banners
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 18th Mar 2015 02:46 Edited at: 18th Mar 2015 02:57
I use a make human model for my Bullet Physics Demo.
Export .dae from make human with out a skeleton.
Open the dae file with Fragmotion and create a custom skeleton.
Then use the auto assign vertices tool and tweak with the paint vertex weights tool.
If you already have animations for your model open that model with Fragmotion and export the animations
as a (bio visions file).bvh, then use the merge animation tool to marry it to your custom skeleton model.
It does not matter that the animation in the bvh file has a different number of bones it will work.
Here is a model with a 53 bone skeleton that I created in Fragmotion. The hands have all the bones.



I recently helped the author of Fragmotion to fix some bugs when exporting to .x and .dbo formats and it works great.
He has not released these fixes as an update yet, so I am working with a custom version of Fragmotion.
This is Make Human Model in DBPro, notice the transparency of the hair and eyebrows without a shader.
It works because of the fixes made to Fragmotion that allow me to export the groups of the make human model as limbs
to DBPro. He will be releasing this fix soon.



The most important fix that he made was for exporting animation. DBPro needs the animation to be position and rotation(quaternion's) keys not
matrix keys. When using position and rotation keys you do not need a key for every frame of animation, DBpro can interpolate the in between frames
especially when using a bone animation shader. If you use matrix keys you will need one for every frame of animation which makes the file very large.
DBPro cannot interpolate between matrix keys without hitting gimbal lock which will cause the model to scale during animation.

WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th Mar 2015 03:33
To make the animations i use 3ds max, are you aware how to remove some of the useless bones/helpers without breaking the skin modifier? I ve tried to select some and delete with "canc" but then the mesh is broken when I import the model in dbpro.
I have managed to share some animations between different characters, the characters have to be the same height otherwise it will autoscale the character with the size of the character used to make the animation, in some cases some limbs had a weird offset too.

By the way, when i export an animation file from 3ds max, i use a pro optimizer modifier on all the geometry limbs, lowering the polygons to the minimum (3-4 vertices per limb) as they are not necessary for the animation, but they still need to be there or the different number of limbs will not let work the animation (dummies/bones are seen as limbs when imported in dbpro), this allows me to get a smaller file (usually 100kb instead of 1 MB per animation), also usefull to decrease loading time and RAM used (1 animation doesn't make a huge difference but when you have a lot of characters and animations it does)
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Mar 2015 14:32
@Stab in the Dark software

I'm impressed - and more than a little envious. [It would be against the AUP for me to post what I think of my modelling skills. ]



Powered by Free Banners
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 18th Mar 2015 15:12 Edited at: 18th Mar 2015 15:34
I do not use 3ds max because it never seems to do easily what you need. Try using Fragmotion.

Green Gandalf


LOL, I did not make the model it was created by the open source program "Make Human".
I just figured out a good work flow to go from Make Human to Fragmotion to DBPro correctly.
I needed full control over the skeletal design because I use that to create a physics ragdoll with my physics wrapper in DBPro.
I came up with this method while developing the ragdoll for the masked solider in Game Guru.
If you look at the credits in Game Guru you will see me listed.
Make Human is very easy to use and will export low and high poly versions. Export from MK using the inches scale and they will be the correct size in DBPro.
That is the same size as the Game Guru(FPSCReloaded) characters.


http://www.makehuman.org/

WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th Mar 2015 15:55
Yes sometimes is a bit Tricky but with the proper knowledge is a powerful tool (referring to 3ds max), the main annoyance is that some modifiers must be in a specific order or one will brake the other, or not being loaded in dbpro, but when you know the tricks everything is fine.
About makehuman, it's a great tool, not perfect but you can't expect more from a open source free program like that, it's a bit Tricky as well due to some bugs but not so huge to make it useless (some versions for example export a broken rig that will make some weird artifacts when animated, like the current version, that's why I am using a nightlybuild version at the moment).
For the polygon part, if you import the model in 3ds max you have full control over the polygons amount using the proper modifiers, for example, a full character as you can see from the image is around 30-35k tris, to make LODs of some characters I have been able to lower the amount to 1k only or even less, and on my game I will put an option to chose from low-med-high meshes, where high meshes will load the Whole 35k tris objects, the med one reduced by 50% and the low poly version reduced to 20%.
Another annoyance of makehuman is that when you export a model there is Always something to fix about the mesh, like jeans going over the tshirt, or the skin itself going over the tshirt, but is quick to fix this on 3ds max, the only real problem about the characters is the tshirt close to the armpit, when you animate your character you often see the arm stretching over the shirt part, and that is almost unfixable (on some characters I have managed to fix it a bit but on some Others there is nothing to do, the rig on the armpit part of the shirt is not perfect so can't work perfectly)

About Fragmotion, you mentioned that it is currently bugged so that you are using a different version to use it with dbpro, can you please provide a link where to download the fixed version? So I can check it out and see what I can do with it please?
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 18th Mar 2015 16:26
The version I am using is not available for download yet.
I will email the author and find out when it will be released.

In the meantime here is the link to the website.
The free version is accessible by following the instructions after installation. Its a fully working version.
The great thing about Fragmotion is it exports to DBPro's native format .dbo

http://www.fragmosoft.com/fragMOTION/index.php

WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th Mar 2015 16:42
Installed, 30 sec later, unistalled.

First of all i thought this was a free version, but is a trial, second thing, it ask me to type the words as they come in order to activate a 7 days licenses, well, I typed like 50 words as they went on the screen, and a new word keep appearing to type, is this a joke or what? Do I have to type these words for 1 year in order to get a 7 days license AND REPEAT this process every week? This is senseless
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 18th Mar 2015 17:25
Its not a joke. It is free to use for seven days if you type in all the words. It is not a big deal to type some words to use the
full unrestricted version.
I purchased a copy because I liked what the program can do.
It is a lot CHEAPER than 3dsmax.
If you are not using the paid version of 3dsmax you can not use the models in a DBPro project or redistribute them.

WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Mar 2015 21:02
@SitDs

Thanks for the tips.

Unfortunately I already have loads of "easy to use" modelling packages and have very little to show for it. It seems to take me forever to produce a simple animated model in those where I can produce anything. I think I'll leave modelling to those who already know what they're doing. In fact with my present modelling skills it would be quicker for me to wait till I get reincarnated as a modeller.



Powered by Free Banners
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 19th Mar 2015 00:23
It may not be a joke but is completely senseless, why would I have to type thousands of words every week in order to use it? What do they earn from doing that? nothing at all, it's just pure senseless
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 19th Mar 2015 01:55 Edited at: 19th Mar 2015 02:12
The guy is religious its called praying.
He needs a little divine intervention to make sure his software does not crash.
Lets face it you can never do enough praying when it comes to getting things to work in DBPro.LOL

Our program,
Who art in memory,
"Hello" be thy name.
Thy spreadsheets be formatted,
thy code be downloaded,
from disk
as it will be in memory.
Give us on screen
our data spreads,
and fogive us our typo errors,
as we forgive those who ask that we document.
Lead us not into frustration,
but deliver us from glitches.
For thine is the algorithm,
the application,
and the solution,
looping forever and ever.
Return.


P.S. He is releasing the new version in the next few days.

WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 19th Mar 2015 16:00
Stab please look your inbox messages.

About the shadow problem, I think I will probably use a lower bones/lower poly character just for the shadow, hiding him in the main render and showing him on the shadow camera render.
I think that first I need to fix another thing because if i try to do the shadow on the green gandalf example, using my character instead of the soldier one, there is a shadow casting but objviously the mesh is broken due to the lot of bones not handled.
If I try to apply the shadow in my game, the only result I have Is a grey pavement (so with no shadow but not even the texture anymore), probably I am missing something, I need more light for example on the sync mask command, the documentation is very poor regarding this, does for example sync mask 2^2 hide or show camera 2? If I have 3 cameras and I want to render only camera 3, do I have to do sync mask 2^0 || 2^1 || 2^2? Basicly I am using camera 1 and camera 2 for the water shader (even if i am not using refraction so 1 camera is not rendering anything), so the shadow shader is assigned to camera 3
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Mar 2015 18:59 Edited at: 19th Mar 2015 19:02
Quote: "does for example sync mask 2^2 hide or show camera 2? If I have 3 cameras and I want to render only camera 3, do I have to do sync mask 2^0 || 2^1 || 2^2?"


Look at this thread:

http://forum.thegamecreators.com/?m=forum_view&t=213917&b=1

or even this one:

http://forum.thegamecreators.com/?m=forum_view&t=213971&b=1

Don't forget to browse related threads occasionally.



Powered by Free Banners
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 19th Mar 2015 19:35 Edited at: 19th Mar 2015 19:40
yes i have already taken a look on a lot of post, these included, but something is not clear on my mind.
Looking at your code green gandalf, the part that i think i am doing wrong and i still need to understand completely is this one



Can you explain me what happens?
All what I get is that camera 1 is used to take the shadow part to "blend" with the main camera?
If in my game i use the shadow camera as camera 3, all what I need to change is sync mask 2^3 instead of 2^1?
Is not already clear to me if sync mask "select" the camera to render or "paste" the camera rendering with the camera 0
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 19th Mar 2015 22:22
sync mask tells it which cameras to include / exclude from the render on sync / fast sync these are bit values where camera 0 is set in bit 1 camera 1 is set in bit 2

2^1 = 2 = %0010

bit 1 now = 0 false off
bit 2 now = 1 true on

so camera 0 is ignored camera 1 is included

if you wanted to render only camera 3 you can sync mask

2^3 = 8 = %1000

bit 1 cam 0 off
bit 2 cam 1 off
bit 3 cam 2 off
bit 4 cam 3 on

if you then wanted to include cameras 1 and 3 but exclude 0 and 2 as the values 8 + 2 = sync mask 10

Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 19th Mar 2015 23:28
Ok, this for rendering, but if camera 3 renders the shadow, how can I apply that shadow so that I can see it on camera 0? Is it applied using the image taken from camera 3 to the object receiving the shadow, as a texture stage? I am starting to understand something but there are still something missing, maybe we could analize step by step the code snippet i have posted?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Mar 2015 00:27
Quote: "but if camera 3 renders the shadow"


It doesn't. It renders a shadow map which is really a depth map, i.e. it records the distances of each visible surface pixel from camera 3 (i.e. from the point of view of the light). The shader then uses that information to decide whether or not a given 3D point in the scene is in shadow.



Powered by Free Banners
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 20th Mar 2015 00:53
Hey gandalf, going back to your piece of code, will that be enough to be change sync mask 2^1 to 2^3? As I am using the 3rd camera for the shadow map? Will the 1st and 2nd camera (used for the water) not be affected?

For the 2 shaders in the example, is the one used for the model the one that I have to apply to any other objects I want to cast a shadow? And the 2nd shader used for the pavement to each object I want to receive shadows? Is that how it works?
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Mar 2015 16:27
Cescano

Could you provide the link to the demo of mine you're using? I have several different versions here.



Powered by Free Banners
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 20th Mar 2015 18:38 Edited at: 20th Mar 2015 18:39
The demo I ve tried is taken from here:


http://forum.thegamecreators.com/?m=forum_view&t=196819&b=1


download from your main post
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Mar 2015 20:44
Thanks. Hope to have an answer tomorrow - but more likely Monday since I'm busy and/or out this weekend.

Aside: I wonder why I posted that demo on my birthday. Perhaps my birthday present from my wife was to allow me to do forum stuff on my birthday?



Powered by Free Banners
Cescano
11
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 20th Mar 2015 21:24
sure take your time, have a nice weekend

Login to post a reply

Server time is: 2026-07-11 18:03:40
Your offset time is: 2026-07-11 18:03:40