*attention people who can make a mesh (hard way)*

Questions and answers about the how and why of making maps.
Post Reply
User avatar
big_daddy2
Private First Class
Private First Class
Posts: 131
Joined: Sat May 06, 2006 1:06 am
Location: the middle of nowhere, USA

*attention people who can make a mesh (hard way)*

Post by big_daddy2 »

i was wondering if an experianced person could help me make a mesh box using vertexs normals and texcords with faces the numbers are:
position:- size:
0- 1
-301- 48
0- 25
i will also need a second, it the same but instead of a -301 make a positive
if you could do this i would be very thank-full, i suck at making these and some of u can whip one out in a few minutes :wink:
User avatar
big_daddy2
Private First Class
Private First Class
Posts: 131
Joined: Sat May 06, 2006 1:06 am
Location: the middle of nowhere, USA

Post by big_daddy2 »

also no negatives in front of the size numbers i meant for those to be dashes
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

need more info on texcoords. how do you want to wrap the texture? one per side or one for the whole box? Easiest way is to make a 1x1 cube and scale it in the map file. That way the cube can be re-used.
User avatar
big_daddy2
Private First Class
Private First Class
Posts: 131
Joined: Sat May 06, 2006 1:06 am
Location: the middle of nowhere, USA

Post by big_daddy2 »

i need a face for every side (top,bottom,front,back,side1,side2)
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

Try this...
you can scale this to suit your needs.

Code: Select all

define cube
  mesh
    # vertices:  8
    # normals:   6
    # texcoords: 4
    # faces:     6

    vertex  1.000  1.000 0.000
    vertex  1.000 -1.000 0.000
    vertex -1.000 -1.000 0.000
    vertex -1.000  1.000 0.000
    vertex  1.000  1.000 2.000
    vertex -1.000  1.000 2.000
    vertex -1.000 -1.000 2.000
    vertex  1.000 -1.000 2.000
    
    normal  0.000  0.000 -1.000
    normal  0.000  0.000  1.000
    normal  1.000 -0.000  0.000
    normal -0.000 -1.000 -0.000
    normal -1.000  0.000 -0.000
    normal  0.000  1.000  0.000
    
    texcoord 0.000 1.000
    texcoord 0.000 0.000
    texcoord 1.000 0.000
    texcoord 1.000 1.000
    
    face
      vertices 0 1 2 3
      normals 0 0 0 0
      texcoords 0 1 2 3
      matref <mat_name>
    endface

    face
      vertices 4 5 6 7
      normals 1 1 1 1
      texcoords 0 1 2 3
      matref <mat_name>
    endface

    face
      vertices 0 4 7 1
      normals 2 2 2 2
      texcoords 0 1 2 3
      matref <mat_name>
    endface

    face
      vertices 1 7 6 2
      normals 3 3 3 3
      texcoords 0 1 2 3
      matref <mat_name>
    endface

    face
      vertices 2 6 5 3
      normals 4 4 4 4
      texcoords 0 1 2 3
      matref <mat_name>
    endface

    face
      vertices 4 0 3 5
      normals 5 5 5 5
      texcoords 0 1 2 3
      matref <mat_name>
    endface
  end
enddef # cube
'<mat_name>' is a placeholder for your material name
hope this helps
User avatar
Tedius
Sergeant First Class
Sergeant First Class
Posts: 142
Joined: Tue Sep 19, 2006 6:10 pm
Contact:

Post by Tedius »

Thanks anomaly, that does help,
Correct me if/where I'm wrong...

if I were to code this by hand, i wouldn't need this part so much:

Code: Select all

    # vertices:  8 
    # normals:   6 
    # texcoords: 4 
    # faces:     6 
It seems that blender just spits that out for it's own indulgence. Instead, I would label the vertices, and normals etc. like so:

Code: Select all

    vertex  1.000  1.000 0.000      #0
    vertex  1.000 -1.000 0.000     #1
    vertex -1.000 -1.000 0.000     #2
    vertex -1.000  1.000 0.000     #3
. 
.
.
    
    normal  0.000  0.000 -1.000    #0
    normal  0.000  0.000  1.000    #1
    normal  1.000 -0.000  0.000    #2
.
.
and so on.

As far as I can guess, the normals determine which way the faces face.... erm, that is, you probably want the texture of the top face to be seen from the sky, like a roof, as opposed to being seen from the inside, like a ceiling. In our case I'm referring to the second "face" with vertices 4 5 6 7 shown here:

Code: Select all

face 
      vertices 4 5 6 7 
      normals 1 1 1 1 
      texcoords 0 1 2 3 
      matref <mat_name> 
    endface 
As it turns out, using normals and texcoords are optional, but I hope someone will explain this part of the code.
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

Tedius wrote:
if I were to code this by hand, i wouldn't need this part so much:

Code: Select all

    # vertices:  8 
    # normals:   6 
    # texcoords: 4 
    # faces:     6 
No you don't need that. Anything past the '#' to the end of line is a comment. The 'define' was created by modeltool. I usually export an object from blender as a wavefront .obj and convert using modeltool.
Tedius wrote: It seems that blender just spits that out for it's own indulgence. Instead, I would label the vertices, and normals etc. like so:

Code: Select all

    vertex  1.000  1.000 0.000      #0
    vertex  1.000 -1.000 0.000     #1
    vertex -1.000 -1.000 0.000     #2
    vertex -1.000  1.000 0.000     #3
. 
.
.
    
    normal  0.000  0.000 -1.000    #0
    normal  0.000  0.000  1.000    #1
    normal  1.000 -0.000  0.000    #2
.
.
and so on.
the order or numbering is right, but again blender did not 'spit out' the text. It was modeltool. I have not been successful in having BZWTools consistantly work. Since I only want the mesh anyway I just use modeltool. In case someone is not familiar with modeltool, it is included in the BZFlag source in the 'tools' directory.
Tedius wrote: As far as I can guess, the normals determine which way the faces face.... erm, that is, you probably want the texture of the top face to be seen from the sky, like a roof, as opposed to being seen from the inside, like a ceiling. In our case I'm referring to the second "face" with vertices 4 5 6 7 shown here:

Code: Select all

face 
      vertices 4 5 6 7 
      normals 1 1 1 1 
      texcoords 0 1 2 3 
      matref <mat_name> 
    endface 
As it turns out, using normals and texcoords are optional, but I hope someone will explain this part of the code.
The normals are calculated from the face vertices. As you can see the top face normals are pointing 'up', the 'z' coord is +1.000. I think BZFlag will calulate the normals for you if you don't provide them. And you can have OpenGL do this as well. The winding or order of the vertices determine which way the face 'faces'. OGL has a setting for this: GL_CCW or GL_CW, counter clockwise or clockwise winding order. Texcoords are only necessary when you want to apply a texure to a polygon.

Having said that...
We can now defer to a real programmer.
User avatar
Tedius
Sergeant First Class
Sergeant First Class
Posts: 142
Joined: Tue Sep 19, 2006 6:10 pm
Contact:

Post by Tedius »

psst, thats your cue, real programmer....
User avatar
optic delusion
Special Forces
Special Forces
Posts: 1054
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Post by optic delusion »

Tedius, you should get wings3d and the export plugin, then start making your own meshes, it's easy and free. You will like it.
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

I agree with Optic. Wings3D is a very nice subdivision modeller. I have used it alot. And as Delusion pointed out there is a BZFlag exporter plugin. It doesn't handle number conversion very well. You may end up with numbers like -2.2345667e-19. Thats essentially 0.0 (zero) as far as bzfs is concerned. I have had issues with those kind of numbers in maps. And had to hand edit them to zero. However... Wings3D can export as wavefront object format. And you can use modeltool to convert. I find that modeltool does a very nice job. Wings3D can do some useful things that blender can't do, at least without plugins. Like inset polys and bevel individual points and edges, for instance.

Although blender has a steep learning curve, you CAN learn it. (If I can anyone can).
User avatar
Tedius
Sergeant First Class
Sergeant First Class
Posts: 142
Joined: Tue Sep 19, 2006 6:10 pm
Contact:

Post by Tedius »

I know I'm stubborn, but I like to hand code my maps. I've used blender, I've followed the tutorial, and I've even exported it to my map. Obviously if I want to make something complicated like a volcano, I would want to use a modeler. Its just moments like the one big_daddy had that make me want to figure out how to make a simple box without having to go through all the trouble of an external editor. I am hoping that once we weed out all the extra stuff that these programs dump in, it won't be all that bad to hand code something simple. We've got a good start I think, we just need someone to help us work out texcoords.
User avatar
macsforme
General
General
Posts: 2069
Joined: Wed Mar 01, 2006 5:43 am

Post by macsforme »

Tedius wrote:I know I'm stubborn, but I like to hand code my maps.
A good idea for learning how everything in a map file works. I coded my Tunnels map entirely by hand (probably overkill, hehe). That was really good for learning how to do it, but I'd probably use a real modeler in any subsequent maps I make.
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

Actually the meshes are the only thing I don't do by hand. Complex meshes anyway. If you do boxes and pyramids and such then hand coding is the best way I think. My Landmine City was done entirely by hand in my favorite text editor. I think you have to be flexible though. I agree with Constitution.
User avatar
optic delusion
Special Forces
Special Forces
Posts: 1054
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Post by optic delusion »

I used text exclusively to map for 18 months. There's nothing wrong with that. You will have ideas that a mapper using modelers would never have.
Even with lots of experience using modelers, you still need to do some things in text. The best mappers know both ways to do it.
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Post Reply