-
Posts
1,362 -
Joined
-
Last visited
-
Days Won
15
Community Answers
-
gryff's post in Detection of "Mobile" was marked as the answer
Hi Jeff, here is a piece of code that I have been experimenting with - not for loading different assets but for deciding on what camera to use.
var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } };Then once I load the scene I have this code to decide a camera:
if( isMobile.any() ){ //alert('Mobile'); //Create a TouchCamera } else { //Load a FreeCamera from the babylon file }Not my script - from here
cheers, gryff
-
gryff's post in How do you "stop" light at plain edges? is it possible? was marked as the answer
Hi aW
Is this what you are trying to do?
Playground
Two lights, one a point light and one a hemispheric light. Important lines are 35 and 36 - what objects get illuminated by what light.
You can play with pointlight's intensity and range to get the fall off effect you want
cheers, gryff
-
gryff's post in Not everything is shiny, e.g. human skin was marked as the answer
Jeff, the skin material that comes with a MH model does have a specular component - a grey colour.
Try reducing the intensity of the specular to 0.
Here is an example of "suzanne" -only difference between the materials is is one has a specular intensity of 1 the other 0.
suzanne
cheers, gryff
-
gryff's post in Blender animation export problem was marked as the answer
OK stalker, as promised, I have slimmed down the number of steps for fixing your robot leg. You can find the files I started with and finished up with here.
The start file is your file but I have removed the "Area" light (not supported by BJS) and added a "Hemi" light instead, added a ground plane, and then I just rearranged the Blender interface a little. So best if you use my start file - but you can use yours if you want.
Step 1.
a.) If you use your file, make sure that the 3D cursor is at the "origin". Mouse cursor in the 3D window then "Shift + C keys" will put the cursor it at 0,0,0.
b.) Open the 3D window "Properties" panel - the mouse cursor still in the 3D window and hit the "N key".
Step 2.
a.) Select the "Robot" (the mesh) in the Object Mode and look in the "Properties" panel you will see that the "Location" values (x,y,z) are not zero, so with the Robot still selected go:
Object -> Transform -> Origin to 3D Cursor. This will zero the location values.
b.) Now select the "Robot.Armature". Again you will see that the "Location" values are not zero, so again Object -> Transform -> Origin to 3D Cursor.
c.) You will also notice that the Scale values for the armature are not 1, so with the armature still selected go Object -> Apply -> Scale.
I know not much seems to have changed, but you would not be the first person on this forum to see the chaos that hits the export of animations to BJS when the Location, Rotation and Scale values of the armature and mesh are different.
Step 3.
Now to create a frame animation for the armature as currently with the IK setup the "Circle" constraint is being animated and it in turn moves the armature in Blender - so we have to "bake" out the frames for the armature itself.
a.) Select the "Robot.Armature" and go into "Pose Mode".
b.) Make sure ALL the bones are selected then -
c.) From the menu bar for the 3D window - Pose -> Animation -> Bake Action and a little box pops up
d.) Make sure that the three boxes "Only Selected, Visual Keying, and Clear Constraints" are all checked (a little tick). And hit the OK button.
You will see 24 frames appear in the "Timeline and Action Editor" and "Action" appear as the name of the new animation that has been created. That is the animation we want. Make sure it appears in that box when you export to BJS.
Step 4.
Now we need to bind that animation to the mesh.
a.) Select the Robot (mesh) and then Shift + Select the Robot.Armature and with the mouse in the 3D window
b.) CTRL + P - to make the armature the parent of the mesh. Use the "Use Automatic Weights" option.
Step 5.
a.) Select the "Circle" and delete it.
b.) And if you wish clean out all the other animations making sure to return to the new animation - "Action" - you created as the chosen named animation. It will work without doing this - but it always feels better if unused stuff is cleared out.
Now export your animated leg.
Here is the Animated Leg exported from the finished file you will find in the .zip file above. It uses an ArcRotate camera - so you can examine it.
Looking at your file, I get the feeling the "leg" is part of a bigger project (all those vertex groups like head and arm etc.). All the above should work fine on a whole robot though you may have a lot more 'Circle" constraints to delete.
Please don't be offended if you think I am being too simple - bitter experience at the Unity forums taught me to include detail . In the other hand, if you need more info about it - just post here
cheers, gryff
-
gryff's post in An "attachToBone" oddity? was marked as the answer
An as a further test on the new script with the original MakeHuman rig :
Sword 2
And it does not flip either, though the position that the sword ends up in is different - but that can be handled.
I'll say it again, well done DK
cheers, gryff
Edit: Using the new "preview release" script and
but fixing it was the important issue
-
gryff's post in Preventing imported mesh from having a scaling was marked as the answer
Hi Alt
In Blender, I could do one of two things:
1. "Apply the scale"
2. Rather than scale the object (in your case the "chassis") itself, go into Blender's "Edit mode" and scale the vertices as opposed to the object.
I have no idea if those options are doable in 3DMax.
cheers, gryff
-
gryff's post in import two or more meshes same time was marked as the answer
It should not be Hit. The 65k limit is for a single mesh. Take a look at the Hill Valley scene here - it has 0.5 million verts
If you have 12 blender files though you will have to call BABYLON.SceneLoader.ImportMesh for each of of the files (or 11 of them anyway if you use BABYLON.SceneLoader.Load ... for the first one)
cheers, gryff
-
gryff's post in Missing manifest from Blend Exporter? was marked as the answer
Looking at the two models both should work but:
Link 1 - 51 bmp textures in power of 2 resolutions - 50Mb. You probably will have to convert the textures to .png or .jpg. Don't think BJS supports .bmp.
Link 2 - simple houses for a neighborhood scene ... Good for medium to long shots. Do you want to get close to buildings?
Instances. If you have a mesh object then in Object Mode-> Duplicate Linked Object. Then move the duplicate to the position you want. Examples:
Stones and Trees (Several 1000 trees I believe)
See more on this thread
The instance has the same material/texture. If you change the position of a vertex in Blender - all instances reflect that change.
Edit: For example, all those safety posts in the original Roads link you posted could be instances
cheers, gryff
-
gryff's post in Blender Export (32 indices, multi-materials) was marked as the answer
DrYSG: try googling "Blender 3D baking textures" - then chose the video option in Google
I learned a long time ago that just typing blender into a google search would take you to pages of kitchen appliances
cheers, gryff
-
gryff's post in Applying a Material with Texture to a Mesh imported from Blender was marked as the answer
Try this Yoric:
1. In Blender select your cube object -> go into Edit Mode -> Select all the vertices.
2. Still in edit mode -> Mesh -> UV Unwrap ->Unwrap.
3. Now export your cube as Babylon file. This new .babylon file should now have a line:
"uvs":[1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1]cheers, gryff
-
gryff's post in I have trouble to loading texture of an object in Babylonjs SandBox was marked as the answer
Hi LLs, welcome to BJS.
In Blender in the Edit Mode for your object, Select all the vertices then Mesh -> Normals -> Recalculate Outside. Then rexport.
cheers, gryff
-
gryff's post in Export mesh with pivot point at origin was marked as the answer
How did you move it qq? Just dragged it ? Or Object->Transform->Geometry to Origin?
cheers, gryff
-
gryff's post in Min - Max range of FOV was marked as the answer
Jeff, in my experience, the default always seems to be 0.8576. You will get different values if you change the focal length of the lens.
In the image below, I changed the focal length to 105mm - a focal length often used for portrait photography. The FOV on export to .babylon is then 0.3024
My default setting for the focal length is 35mm - which leads to the FOV in babylon of 0.8576
cheers, gryff
Edit: For the math maybe this helps
-
gryff's post in Cant see imported mesh was marked as the answer
Well not really RaananW - just the problem ;-)
One fix Piotr is :
1. In Object Mode in Blender, select the object, then go Object->Transform->Geometry To Origin.
2. Now re-export the mesh
3. Because the object is so large, and your camera settings are:
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);it means you are likely to be inside the object
To fix this, will have to:
1. Scale down the object or
2. Move the camera so that its Z position is is perhaps ~ -150 to -200 units
3. And possibly set the maxZ value of the camera to perhaps 500
cheers, gryff
-
gryff's post in Blender shadows was marked as the answer
Hi Paul - good to see you here. Seems a while since we chatted at the Guardian.
The image below shows the two property panel tabs that you need.
A. Select the objects you want to cast and receive shadows then check the appropriate boxes for shadows. It is possible to self shadow (both cast and receive) but I've not tried that. A search of the forum will help for self shadowing.
B. Select the lights that you want to generate shadows (Point, Sun, Spotlight) then chose the the Shadow Map Type and Size.
Hope that helps.
cheers, gryff
-
gryff's post in Set fps with "PlayAnimationAction" or decrease time between keyframes in Blender was marked as the answer
Hit, I thought you might use the ExecuteCodeAction to call your own function that would allow the use of beginAnimation.
However, you could look at changing things in Blender. As you say above:
1. In Blender have the Action Editor open and select all your key frames
2. With your mouse over the Action Editor, S (for scale) then .3333 (for a three times speed change.)
You can also try "thinning" your key frames before you scale them as above using the Simplify F-Curves addon as outlined in this video
Simplify Animation Curves
cheers gryff
-
gryff's post in Blender to Babylon exporter problem was marked as the answer
@hit 2501: try the method I outlined in the documentation site under Exporters -> Blender -> Installing the Babylon Exporter
And make sure you activate the plugin as described
cheers, gryff
-
gryff's post in Dislocated Submeshs was marked as the answer
how does this look iiceman?
Monk
cheers, gryff
-
gryff's post in Struggling with shadows from high-poly mesh was marked as the answer
I spent several hours this morning using ozrocker's blend file from his previous thread. This is the best I can do:
Player 2
Details:
1. Blender 2.73 with latest exporter. I redid the animation/rigging using the method I described in that previous thread.
2. Light : Sun Lamp. Shadows set up in the Blender exporter - Map Size: 4096, Map Type: Variance.
3. Added purple ground for DK. The ground receives shadows, figure casts shadows.
4. Reduced the animation to just the "press up" part - to reduce file size and exporting time.
4. I am using babylon.2.0-beta.js that I downloaded from Github this morning
I seems to work pretty well.
However, older versions of babylon.2.0-beta.js - from 9 days ago - produced the the kind of weird animation that ozrocker is seeing. I know amorgan was having issues with an animation and some changes were made which I assume are reflected in this latest version of BJS 2.
That is the best I can do.
cheers, gryff
-
gryff's post in Blender and Animations was marked as the answer
morgan, if the result I see in the download is just "learned today" - you did very well.
Here are the couple of simple steps to fix that:
1. With the armature selected, go into "Edit Mode" and select the hip.L bone.
2. Now over in the Properties Panel, select the little Bone tab. Go down the to the "Relations" property and you will see a box labelled "Parent". Click on it and chose "pelvis".
3. Repeat for hip.R
Well, one suggestion I can make. CIick on the Properties Panel, click on the tab with the little camera. Go down to the "Dimensions" property where you will see a box "Frame Rate". Click on that and change it to 30. - the BJS default frame rate.
As for tutorials - this one by Lee Salvemini - a professional animator - is one of my favourites. Comes in three parts but part one is all you need to start with.
Introduction to Rigging
Did you build the rig yourself? I suggest you look carefully at the rig as Lee works with it. Note it has no bones directly equivalent to your hip.L and hip.R
I will look through my stuff see if I can find more tutorials for you.
cheers, gryff
-
gryff's post in Cannot convert Mixamo to Babylon was marked as the answer
Ok oz, I have your blend file but was it the file you used to export to babylon? You are right the armature is very small - but I see no indications that you tried to scale it. Anyway I used it regardless.
First though I did some clean up so that the scene was easier to work with.
1. Switched the view type to "Ortho" and then 3d window view to "Front".
2. Selected the Armature, and Properties Panel-> Armature Tab->Display->Xray. The bones now show through the mesh.
Here is my work flow.to fix the animation - all done in Blender's "Object" mode.
1. Select the figure mesh then Alt + P ->Clear Parent. This separates the mesh from the armature. The mesh is on its back and to the right of the origin.
2. With the mesh still selected - Rotate it on the X-axis by 90 degrees.
3. Still with the mesh selected Object->Apply->Rotation. The mesh will now be in the vertical position.
4. The armature is still at the Origin, Select it, then Properties Panel->Armature->Skeleton->Rest Position.
5. Now Scale the Armature by 100
6. With the armature still selected Object->Apply->Scale. The Armature and the Mesh should now be lined up to the right of the origin.
7. Select the Mesh and then the Armature and then CTRL + P ->With Automatic Weights. Both Armature and Mesh should be back at the origin. Blender might give you a warning about being unable to assign some bones to vertices. The last bone on each hand (index4) and all the bones that are "xxxx_End" are outside the mesh. Ignore the message
7a. Properties Panel->Armature->Pose Position.***
8 Play the animation to ensure everything looks correct.
9.Export to BJS.
Here is the end result that I get. I trimmed the animation down to 180 frames - just the "press up" animation - to reduce the file size (which is still 25Mb!). Your mesh has 100,000 tris and 50,000 verts (is it from a 3D scan?). That is a lot.
Press Up
Takes a few seconds to load.
cheers, gryff
*** Edit: The things you do automatically
-
gryff's post in Blender, Bumpmaps and Babylon.js was marked as the answer
Hi mop - welcome to the forum:)
The issue you are facing is the rather sloppy use of "bump mapping". You are using a grey scale texture as your "bump map" but in fact babylon and blender use "normal maps" to create the "bump" effect. Check this link for and explanation:
"Bump Mapping"
Scroll down to "Bump Mapping" and you will see a Normal Map - blue/red colours. You have to use an image like that to produce the effect.
Try converting your grey scale image with this online Image Converter. Use the Normal Map you get from the converter in Blender, then export as a .babylon file - should work fine though you may need to tweak the export from the converter to get the effect you want (and watch the specular colour )
cheers, gryff
-
gryff's post in Blue screen instead full mesh was marked as the answer
This is that huge model, right hit?
I think you need to alter the far clipping plane.
camera.maxZ = <some value>;The default value is 100 I believe.
cheers, gryff
-
gryff's post in Faster camera or decrease model size... was marked as the answer
Hi hit2501
Did you try changing the camera speed?
Add this line in your code:
camera.speed = <some value>;Default value is 1
How big are your scene objects? You could try adding a simple cube with BJS code - compare to objects in your scene.
cheers, gryff
-
gryff's post in skeletal blender animations was marked as the answer
David, I took a look at your .blend file. I added a light and a camera, then exported it as a babylon file.
Creature Animated
It seems to work ok, but a few points:
1. You have two IK bones and two knee constraint bones. They probably help with animation but once the animation is created are no longer necessary. Not sure how BJS handles those bones as they are not deforming the mesh.
2. I don't get those missing faces like your pic illustrates
3. There seems to be an issue at the waist. I looked at the weight painting of the bones you have labelled "torso", "lower back" and "pelvic" and all seem to indicate that the animation emphasis is at the back of the mesh (the red colour) and there is very little at the front of the mesh (lightblue/green to green). The likelihood is that vertices at the back are being rotated into those at the side. Also the two "clavicle" bones are having an impact along the mesh assigned to the body bones - might want to reduce that to just the top of the shoulder.
Now the "4 bones issue". You added bones for the 4 fingers and one thumb - and that creates 5 bones that are having an impact on the mesh that is assigned to the palm of the hand. With the automatic rigging, I don't think there is a way to restrict Blender, but there may be a ways to edit those cases.
1. Select you mesh and go into edit mode.
2. In the properties panel, select the "triangles" tab.
3. In the triangles tab you will see an area called "Vertex Groups"
4. Make sure that no vertices are selected in your 3d window, then select one of those vertex groups - they will show in the 3D window.
5. Do this for the bones associated with a hand - selecting and deselecting - it will give you an idea of the impact each finger/thumb bones is having on the palm of the hand.
You can probably play with this to remove the influence of each finger bone on the palm of the hand - but I've not tried it myself.
cheers, gryff