PDA

View Full Version : OZ - Ascii Custom Scene Import


GeorgeS
05-20-2005, 10:48 AM
WC - Is it possible to include the following feature into the next OZ version

- Ability to import ascii/text files that contain worldly object placement definitions.

i.e.

start
- Object.3ds //filename of object
- xxx,yyy,zzz //position
- Rotation angle // yaw_angle around center for placement
- xx,yy,zz //Object scale x,y,z ; 1=default
end

So, in effect, this would enable me to import a scene of object placements from into OZ very rapidly.

Thanks
George

Windcatcher
05-20-2005, 11:12 AM
I don't see how it would be a problem. I might change the syntax just a little bit so I could make use of the existing parser, but I think that something like that would be a snap.

GeorgeS
05-20-2005, 12:22 PM
That's most excellent news

I have a home brewed DX7 world editor I made last year and it's extremely fast for 3D. It outputs the ascii object list and if it works with OZ, I will modify it to have a better user interface and then upload it for everyone to try.

It'll be interesting to see what sort of zones we can make with more tools that work together!

George

Windcatcher
05-20-2005, 07:59 PM
I'll get working on it this weekend. I just finished reskinning all of the icons on the main window and added menu options to switch either the menu or toolbar icons to 16x16, 24x24, 32x32, or 64x64 (yes, I made them all -- I'm finally getting some use out of that version of CorelDraw I bought six or seven years ago). The look of OpenZone should be a lot more pleasing...

Windcatcher
05-23-2005, 09:53 AM
Okay, here is the syntax of importing .3DS objects via an ASCII file:


Mesh
Name meshname
Loc x,y,z
Heading rx,ry,rz
Size sx,sy,sz
3DSFileName fully-qualified path and file name
End

It's basically just an extension of OpenZone's .SCN file format where it recognizes a new token: 3DSFILENAME. Here is an example that I used to test it (meshimport.scn):

LongName 3DS Max Import Test
ShortName importtest
ZoneType Outdoor
Mesh
Name Mesh1
Loc 0, 0, 0
Heading 0, 0, 0
Size 1, 1, 1
3DSFileName D:\Borland\Delphi6\Projects\OpenZone\3ds\knot.3ds
End
Mesh
Name Mesh2
Loc 2000, 0, 0
Heading 0, 0, 0
Size 1, 1, 1
3DSFileName D:\Borland\Delphi6\Projects\OpenZone\3ds\knot.3ds
End
Mesh
Name Mesh3
Loc 4000, 0, 0
Heading 0, 0, 0
Size 1, 1, 1
3DSFileName D:\Borland\Delphi6\Projects\OpenZone\3ds\knot.3ds
End
Mesh
Name Mesh4
Loc 6000, 0, 0
Heading 0, 0, 0
Size 5, 5, 5
3DSFileName D:\Borland\Delphi6\Projects\OpenZone\3ds\knot.3ds
End

.SCN files are case IN-sensitive. The NAME, LOC, HEADING, and SIZE tokens have to come first in the MESH object. You would import the objects to an existing zone by clicking Edit...Insert scene... rather than opening the scene as you normally would ("Insert Scene..." opens an .SCN file and adds its contents to your zone).

The HEADING token rotates an object around the X, Y, or Z axes, where X points north-south, Y points east-west, and Z points up-down. It always rotates around Z first, then around X and Y. To yaw an object 5 degrees about the Z axis, for example, you would specify it as HEADING 0,0,5 (all angle units are in degrees, not radians).

The import code is smart in that it caches any meshes you import in this manner, so importing the same object hundreds of times should be fairly efficient. Unless there are any more requests, I'll package it and put out a release this week.

GeorgeS
05-23-2005, 11:23 AM
That's excellent. I will look forward to that release.

In the meantime, I've made about 40 static zone objects such as trees,cut trees,ruins,buildings,altars, etc.. (sample previews coming)

These will fit themes for desert and swamp based zones for now. I anticipate to make about 500 objects in all.

With the pending OZ release I will attempt to create a zone with these objects to see any difficulty in exporting to 3DS using .PNG or .BMP textures.

So far, transparent textures for trees do not import into OZ well. I cannot figure out the method to create transparent textures i.e black is see-through.
I tried .PNG with alpha channel's and that did not work either, nor did an attempt with OZ's toolbar converter. stumped!

My 3Dworld editor works very well with .X and .3DS, so what I'll do is show some screenshots of it in action. Whether the objects (in my editor)will 'spawn' in the same locations as in OZ is unclear, but that will be something I will feverishly work on.

Regarding the humanoid models and non-humanoid models, I will attempt to make a simple elipsoid human model and add bones as you mentioned. Once we agree on bone placement and assorted issues, I will start the real deal of making monster mesh's.

George

Windcatcher
05-23-2005, 02:47 PM
Importing .3DS objects with masked textures is tricky. The reason is that the client has to have a special bit set when a texture is masked (e.g. tree leaves). The way KhaN has been doing it is to create the zone, save it to .SCN, and then edit the .SCN file in a text editor for those special textures. Tree leaves, for instance, have to have their "masked" property set to true, and they also have to have their "solid" property set to false so the client will let players pass through them (it's another special polygon property that the client looks for).

OpenZone has a dialog under Edit...Change polygon properties... that lets you set the "solid" property, but not the "masked" property. I've added a setting that lets you change the "masked" property, and I've added a toolbar button to make accessing the dialog easier (second to last button, right next to the help button).

OpenZone can convert a 24-bit non-alpha-masked .BMP texture to a 32-bit alpha-masked BMP texture under File...Convert to transparent bitmap... It pops up a dialog that lets you enter input and output texture file names. It works by looking at the pixels in each corner of the texture and choosing the one that's most prevalent as the mask color. This is useful, for instance, if you have magenta as your mask color and you need the mask information to be in the alpha channel instead. If you already have an alpha-masked texture then you don't need to use this feature.

If you want to go the text-edit route to change the .SCN file, you need to know the formats of the TRIANGLE, TRIANGLETEX, RECTANGLE, and RECTANGLETEX tokens:


TRIANGLE x1, y1, z1, x2, y2, z2, x3, y3, z3, texturename, transparent, semitransparent, solid, color, hascolor, tag, hastag, angle, hasangle, masked, hasmasked, hasnormal, nx1, ny1, nz1, nx2, ny2, nz2, nx3, ny3, nz3

TRIANGLETEX x1, y1, z1, x2, y2, z2, x3, y3, z3, tx1, tz1, tx2, tz2, tx3, tz3, texturename, transparent, semitransparent, solid, color, hascolor, tag, hastag, angle, hasangle, masked, hasmasked, hasnormal, nx1, ny1, nz1, nx2, ny2, nz2, nx3, ny3, nz3

RECTANGLE x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, texturename, transparent, semitransparent, solid, color, hascolor, tag, hastag, angle, hasangle, masked, hasmasked, hasnormal, nx1, ny1, nz1, nx2, ny2, nz2, nx3, ny3, nz3, nx4, ny4, nz4

RECTANGLETEX x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, tx1, tz1, tx2, tz2, tx3, tz3, tx4, tz4, texturename, transparent, semitransparent, solid, color, hascolor, tag, hastag, angle, hasangle, masked, hasmasked, hasnormal, nx1, ny1, nz1, nx2, ny2, nz2, nx3, ny3, nz3, nx4, ny4, nz4


Most likely you'll be dealing with TRIANGLETEX tokens. If hascolor/hastag/hasangle/hasmasked is FALSE then it means that OpenZone is to ignore the color/tag/angle/masked setting. If hasnormal is FALSE, then the normal values aren't present.

I'm looking into the possibility of allowing you to set these properties for all polygons with a certain texture. I'll update my post here if I can pull it off.

EDIT: Okay, the edit polygon properties now has a checkbox at the very bottom that, if checked, will cause OpenZone to scan every object in your zone and change all matching polygons instead of just the one you select. This will only work for imported objects (not scripted objects, for example), and will warn you whenever you check it. Also, if you are using it to change a polygon's texture, it's really easy to select the new texture but forget to add it to the texture list and the dialog will warn you if you forget to do so.

The gist of all this is that you could click on a polygon with tree leaves, open the edit polygon properties dialog, check the "change all" box, check the "masked" and "player can pass through" boxes, click Ok, and OpenZone will change the settings for ALL polygons with that texture.

GeorgeS
05-26-2005, 11:46 AM
The scene format looks interesting. What the difference between
TRIANGLE, RECTANGLE (I assume are quads) and the TRIANGLETEX formats?

When I'm creating my 3DS objects, I export non triangulated mesh' and although I got OZ to import a house, it took quite a bit of trial to make the textures appear. Is it imperative for the textures to be n^2? i.e 128x128 and 128x512 are ok?

I already have about 100 objects textured, with many of the custom themed textures already finished. The swamp, desert and mayan themed ones are done. So before I export the whole lot for you, I will need to figure out exactly what 3DS does not allow (and allows). i.e triangulated, object hierarchy etc..

This is quite a learning curve for me, but alas I'm pretty persistent in making this work.

I also just realised that I could model the entire zone in 3DStudio and export that to OZ - any thing I should be aware of there?

Later,
George

KhaN
05-26-2005, 03:16 PM
In gaming industry, there are some rules :
- Always use power of 2 textures.
- Always use Tri's.
So far i think that if your objects are quads, OZ should convert them to tri's (but WC would need to confirm).

If you are modeling under 3DSmax and importing into OZ, there are a few things you should know
- Blinn Specular Light should be black
- Blinn Transparency only works at 0% - 50% - 100%
- You can import lights used into 3DSmax (1u=8EQm)
- You can setup Water/lava/PVP by setting a cube named as for example OZ_WATER01
- And lots more im sure WC added into help file :)
More generally you do almost all, but place objects :)

Windcatcher
05-26-2005, 03:17 PM
I'm not sure about everything that .3DS supports, but OpenZone's .3DS import expects everything to be composed of triangles.

You're right about RECTANGLE/RECTANGLETEX being quads. The -TEX variants allow you to specify texture coordinates, while the non-TEX ones force OpenZone to use it's own algorithm to guess at decent texture coordinates. Obviously, if you're importing from an external source, I strongly recommend using the -TEX variants. The non-TEX ones are mainly for OpenZone's use since many of its scripts don't generate texture coordinates and have to rely on its internal algorithm.

All of my 3D software use OpenGL, which requires that textures be a power of 2 on each side. They don't have to be square, but they have to be, for example, 64, 128, 256, 512, etc. on a given edge.

KhaN has taken the route of modeling entire zones and then importing them as a giant .3DS file. It's possible, but has some minor limitations. The main one is that the .3DS format doesn't have a way of setting the "masked" and "solid" flags I mentioned above, so it means setting them after the import. These flags are critical for objects like trees where solid has to be set to FALSE so players don't bump into their leaves (and the masked flag is critical so the masked-out parts of the textures will be transparent). The new features in OpenZone 5.6 under Edit Polygon Properties should make those easier (until then, the only real way was to do a search-and-replace on the .SCN file to set the flags for a given texture).

Importing entire zones also means that OpenZone doesn't know which mesh is the "ground" mesh, so if you place objects in the zone after importing it, OpenZone might have trouble keeping them on the ground (when OpenZone generates its own ground it can make sure that trees, for instance, always adhere to the ground). It's not an issue if you don't plan on adding anything from OpenZone's internal library after you import your zone or, if you do, if you plan on placing objects precisely.

If you only want to import and immediately export to .S3D, then the only issue is the "solid" and "masked" flags (and possibly the transparent/semitransparent flags), which can globally be set for a given texture from the Edit Polygon Properties dialog.

GeorgeS
05-26-2005, 05:18 PM
Thanks for the replies. I'm nearly there with object import.
Here's a few previews of the objects in the modeler.
I had to fix a few things on a few objects, but they import into OZ and subsequently into the zone viewer nicely! I'm rather impressed!!

http://www.wizardportal.com/optimaiv/orion2/eqemu/scenes1.jpg
http://www.wizardportal.com/optimaiv/orion2/eqemu/scenes2.jpg
http://www.wizardportal.com/optimaiv/orion2/eqemu/scenes3.jpg
http://www.wizardportal.com/optimaiv/orion2/eqemu/scenes4.jpg
http://www.wizardportal.com/optimaiv/orion2/eqemu/scenes5.jpg
http://www.wizardportal.com/optimaiv/orion2/eqemu/scenes6.jpg
http://www.wizardportal.com/optimaiv/orion2/eqemu/scenes7.jpg

I will spend some time exporting these to 3DS and a nice zip for ya all.
There are many more of these on the way.

George

GeorgeS
06-03-2005, 09:11 AM
I managed to write an exporter for my world editor and the .scn file looks fine.
What I cannot figure out is how to import it into an Existing zone I set up. What happens when I file/open the import.scn in OZ, the previous zone dissapears and the imported one appears with just the objects and no zone.

Is there a way to import onto an existing prepared zone?


Thanks
GeorgeS

Windcatcher
06-03-2005, 11:12 AM
Yup. Click Edit...Insert Scene. It should do the trick...

If you have any problems, let me know...and if you have any nice shiny screenshots, those are fine too (wink).

P.S. Have you tried the File...Convert to transparent bitmap option?

GeorgeS
06-03-2005, 12:05 PM
Excellent WC!
So far so good, my world editor now correctly exports the .scn (except for the slight issue i'm having with Z-heights being offset a bit.)

...but position and heading work!
Once I get the Z-height issue worked out, I will submit the program. Since I am actively working on it, I might as well create a help.pdf as well.

But before that, I will have screenshots of it with several zones! I'm actually pretty amazed I made it this far.

The world editor was being made for an offline eq-like game, but I realised that those games take a lot of time to code.

After I get another hundred objects made for the editor, I will start on monsters. Already made some good textures, and have my sketchpad ready for the monster texturing (I color by hand on real paper and scan the textures in)

GeorgeS