How can I access to the material of an imported 3DS file in Unity? - unityscript

I imported a big 3DS file to my Unity scene and I would like to make it transparent.
My object is as big that has been imported as a mesh with 5 different "sub meshes" inside and some of them have materials (already imported).
Can someone shed some light on how can I do it? I'm thinking that maybe I need to do a loop to go through all the sub meshes and check the material there... but honestly... if that is a solution... I do not know how to do it...I'm using C# but this are my first steps on Unity and C#.

The user Mark is right. I need to start with baby steps before understanding the complexity of it. Sometimes I'm running too fast!
Thanks a lot.

Related

Exporting Wrap Deformed object from Maya to unity

I would like to know if we can somehow export wrap deformed object from Maya to unity 3d because rigging at the moment is causing some serious problems. If i could somehow export a wrap deformed object to unity3d then it would literally save a lot of work.
Lemme know if anyone knows anything about it.
Cheers!!
from my experience unity won't support custom deform objects. So you probably need to consider converting them to a skincluster there few scripts available to be able to do this. But probably you need to adjust according to your needs. Check it here

What to use for creating custom 3D objects and animations?

I'm used to working with SolidWorks and Catia for 3D object and basic animations but i got a personal project that i work on where i need to build a LASER manufacturing machine and i need to make it look like it is in real life, make zoom inside the machine and see how the light gets polarized as it passes through a crystal, see how the laser beam hits the surface and particles fly of the hit surface,etc.
I thought about Unity Engine but don't know much about this area of 3D and in what program to do the models before importing into Unity, can you guys help me with better solutions ?
Thanks,
Adrian
If you want to use Unity, you can import the following file formats: .FBX, .dae, .3DS, .dxf, .obj (http://docs.unity3d.com/Manual/HOWTO-importObject.html)
From Solidworks, you can export as an STL, then import the STL into a 3d Application (ex. Blender), and in Blender you could export the model as an FBX.
I think you're able to achieve more in terms of animation with unity. You can design your model documents in SolidWorks or CATIA and save them in IGES (neutral format).

Animation in Three.js JSON Files

I have a question on a problem I've been struggling with.
I have been trying to figure out if the "bones" member in the Three.js JSON file format is supposed to be the bind pose of a skeleton?
I ask because, at the moment, I am exporting an avatar from DAZ Studio to Three.js, and that works fine. But as soon as I add the bones and animation everything is distorted. Basically, stretched out in the X and Y plane. I assume this is because I am exporting the "bones" and the "animation" members incorrectly. (Currently, I export the bind pose to the "bones" member).
The issue is that when I look for documentation on what is supposed to go into those fields, I can't really find anything. (Currently I just copied the format of the buffalo.js sample file on the three.js site). But obviously, I am outputting the bone translations, rotations and scales in the wrong coordinate space. Or maybe they should all be the bind pose??? I'm not sure... because I can't find anything to reference. I tried to use the blender exporter as a guide, but blender spaces and armatures are significantly different from what you find in DAZ Studio or Unity 3D.
If there is anyone out there who is familiar with the required coordinate spaces for values in the "bones" and "animation" members of the Three.js JSON file format, I would appreciate any guidance you could give me.
I am a bit too perplexed at the moment, and thought this might be a good time to "reset" and ask for a bit of guidance.
Thanx in advance to anyone who can help.

Dynamically(at some time intervals) change textures on a plane/cube in three.js?

I know it's something with texture.needsUpdate() while rendering but I don't have a clue how to actually implement it. Maybe someone knows a link where I can see a working example or post some piece of code? Cheers.
An excellent question; I created some sample code to do exactly this -- using a spritesheet to do some 2D animation on a plane and on a cube, which requires regular updates. Here is a link to a documented example, that in particular contains a function to do exactly what you need.
http://stemkoski.github.com/Three.js/Texture-Animation.html
Hope it helps!

Model with bones animation (blender export) animating incorrectly in three.js

I am currently working on skeletal animation tests in three.js. I have a simple model which animates just fine in blender. Basically it consists of three stacked, bending cubes.
When I export the blender file to the three.js using the blender export plugin with Blender V2.64, the animation in the webGl context appears different as if the skinweighting is wrong.
WebGL-Demo:
http://rainbowrangers.de/threejs/animation_test01/
Blender-File:
http://rainbowrangers.de/threejs/animation_test01/model/animation_test01.blend
What do I have to do to get the correct result in three.js?
I am the person you quoted from the github discussion. I have recently been experimenting with this pipeline, ( ie Blender bone animations into threejs,) and have found that it is very very difficulty to find a reliable process that will work every time.
On my blog, I have compiled a list of 'tips' that allowed me to achieve success on some occasions:
http://dev.mothteeth.com/2012/10/threejs-blender-exporting-skeletal-animations/
To summarise, the most important things I found were:
Delete the Armature Modifier before exporting, or the animation will be all messed up.
Check that your Vertex Groups are properly assigned to the bones. ( In Blender, you can use automatic bone weights. )
Key all bones in the first and last frames of your animation. ( As you discovered, if you only have keys for the bones you have changed, ThreeJS won't infer anything about the other ones, and things will be broken. )
Even following these guidelines, I can't get things to work consistently, and have been considering using morph targets until the library matures a bit more. The file sizes for morph targets are much larger but they seem to be a more reliable option at this point, in my experience.
After a lot of digging I finally found the answer in one of the three.js github discussions:
"Insert a full keyframe for all of the bones at the beginning and end of the animation. I found that without the first keyframe the animation would be subtly distorted, and without the one at the end I would lose parts of the animation toward the end."
Source: https://github.com/mrdoob/three.js/issues/2106
That was exactly what happened to our render. We only hat keyframes set for the bones that were changing and not for the static ones.
I've also found that to get the exported model working right the export should be done at frame 0 in Blender.
Another thing that solved a problem I've encountered was not to scale model after exporting it. This means that the model can't be scaled in the JSON file and probably in the code directly.
Using three.js r56

Resources