.3ds

Blitz3D Forums/Blitz3D Beginners Area/.3ds

Gorley(Posted 2009) [#1]
Hello,


I'm really new to blitz3D but i've been programming BlitzPlus for a while. Is the .3ds format supported in Blitz3D? I tried but the error popup said "entity does not exist". Heres the source code:


Graphics3D 800,600,16

jelly=LoadSprite("C:\My Documents\jelly.3ds")

light=CreateLight(1)
cam=CreateCamera()

PointEntity light,jelly



While Not KeyDown(1)

x#=0
y#=0
z#=0


If KeyDown(205)
x#=.1
EndIf

If KeyDown(203)
x#=-.1
EndIf

If KeyDown(200)
y#=.1
EndIf

If KeyDown(208)
y#=-.1
EndIf

If KeyDown(30)
z#=.1
EndIf

If KeyDown(44)
z#=-.1
EndIf

If KeyDown(35)
roll#=.5
EndIf

If KeyDown(34)
roll#=-.5
EndIf


RotateEntity jelly,pitch#,yaw#,roll#
MoveEntity jelly,x#,y#,z#

RenderWorld
Flip
Wend


_PJ_(Posted 2009) [#2]
I think only md2, b3d and .x formats can be used in Blitz.

I think someone made a converter for .3ds though I'l see if I can find it


Gabriel(Posted 2009) [#3]
Yes, the .3ds format is supported, but you're loading a sprite, not a 3d model. A sprite is a sprite is a sprite. It has two triangles and four vertices. It always will have. It doesn't need any geometry. What it needs ( and what LoadSprite takes if you open the documentation ) is a texture. 3DS is not a texture. Which is why you're getting an error.

LoadSprite ( tex_file$[,tex_flag][,parent] )  

Parameters:


text_file$ - filename of image file to be used as sprite

tex_flag (optional) - texture flag:
1: Color
2: Alpha
4: Masked
8: Mipmapped
16: Clamp U
32: Clamp V
64: Spherical reflection map

parent - parent of entity 

Description:

Creates a sprite entity, and assigns a texture to it. 



Kryzon(Posted 2009) [#4]
http://blitzbasic.com/b3ddocs/command.php?name=LoadMesh

of course .3ds can be used in B3D!

Problem is that you are loading a mesh with the command LoadSprite, which is meant for 2D images (BMP, PNG, JPG, that sort of stuff). You need to use LoadMesh or LoadAnimMesh (for animated models).

EDIT: Dang gabe was faster =P


_PJ_(Posted 2009) [#5]
They say you learn something new each day :)

that'll teach me to:

a) Read the docs

and
b:) Actually look at teh code others have posted :D


Gorley(Posted 2009) [#6]
Thanks you all!


MoonShadow(Posted 2009) [#7]
I have a question. When I load .3ds model with animation and try to animate it, I having a error messages saying that the "model doesn't contain an animation" and I did animated on the 3d program. I heard that 3ds is only good for position/rotate/scale is that's true?

Graphics3D 800,600

SetBuffer BackBuffer()

camera=CreateCamera()
CameraViewport camera,0,0,800,600

light=CreateLight()

man=LoadAnimMesh( "man.3ds")
PositionEntity man,0,-35,600
RotateEntity man,0,180,0

Animate man,1,.1,32,46

While Not KeyHit(1)

If dist<970 MoveEntity man,0,0,.5
If dist=970 AnimateMD2 man,1,.05,0,31

dist=dist+1

UpdateWorld
RenderWorld

Flip

Wend
End


Matty(Posted 2009) [#8]
That is true.
The only animated models that blitz3d supports is .b3d models (there may be an exporter for your modeling app) or .md2 models (once again you'll need an exporter).

You can also use .X models with hierarchical animation but not those with skeletal animation or vertex morphing. (I've never managed to create one of these myself though)

Note you cannot use the MD2 commands on models that are not MD2 models (as you have done in your example).

A simple & cheap exporter is Milkshape3D (roughly $25 (USD) from memory)


Ross C(Posted 2009) [#9]
I don't think that's true. I'm sure it's in the sample code folder, a .3ds animating. It uses hierarchical animation too. And yeah. I wish i could convert my skeletal animation to hierarchical animation...


Yasha(Posted 2009) [#10]
.3ds can definitely be animated, as long as you only want position/rotation/scale animations and not vertex morphs or bones. The code above looks like it'll work if you just take out the AnimateMD2 command - MD2 is a completely different animation system that has nothing to do with standard Blitz3D meshes. For 3DS you just need the Animate command, which works with position/rotation/scale of the model's individual components only. You also don't need to call Animate again in the main loop (unless you want to change to another animation or the speed or something) - once it starts, it's maintained by UpdateWorld. There are examples of 3DS animation everywhere in the Blitz3D samples as when Blitz3D was released it was in fact the primary animation system (B3D was invented later).

If you do want to use MD2, take a look in the Code Archives before you shell out money for a converter. It's a simple open format and there are already converters there.


MoonShadow(Posted 2009) [#11]
Thanks guys. By the way I just copy and paste those codes from the manual, just to make a point but i forgot to change the animateMD2 to Animate and forgot to delete Animate outside the loop. But it's cool, thank you guys. I will figure out to export 3ds to b3d some how-


_PJ_(Posted 2009) [#12]
What 3D modeller do you use?

As you have .3ds I am gonna assume it's Max, so there IS a .b3d export plugin around (maybe look in the "tools" section on these forums) though I honestly cannot tell you if it exports animations too or not, but I dont see why not :D


Ross C(Posted 2009) [#13]
It's called the b3dpipeline. Seems to work fairly well according to other people.


MoonShadow(Posted 2009) [#14]
yep, I try MilkShape3d and Blender and it work fine to import 3ds and export md2 or b3d (actually only MilkShape3d export as b3d) , they work fine but I can't figure out a way to export the animation as well. They only export the mesh, I think so far. I'm going to try b3dpipeline- let's see. Thanks


MoonShadow(Posted 2009) [#15]
Hey I try b3dpipeline it work perfect exporting meshes, but I still can not get the vertex morph. I was able to animate with scale/rotate/move - :oS no luck. I guess I will animate them in milkshape3d


A51M15X(Posted 2009) [#16]
Blitz3d does support .3ds and Blender can export models into .3ds

box = loadmesh("box.3ds")

You dont need to specify the location of the file if its saved in the same folder as the .bb file.


GfK(Posted 2009) [#17]
If memory serves, you will find that with 3DS format you can't animate it with the mesh handle directly. You have to find the first child of the mesh handle, and animate that.

3DS animation is only suitable for hierachical or segmented animation, such as a rotating turret on a tank. If you want to use deformable meshes for a 3D character, then you need to be using B3D format.

Oh, and did I mention that the term "butt pirate" is greatly offensive to some people? You should edit/remove it from your sig.


GIB3D(Posted 2009) [#18]
What's a butt pirate?


Ginger Tea(Posted 2009) [#19]
same as an ass pirate/bandit
slang for gay