ThePlatoon.com
December 02, 2008, 11:23:29 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Look around and get acquainted to the new settings and features.
 
  Home   Forum   Help Search Calendar Login Register  
  Shop Gallery  
Pages: 1 [2]   Go Down
  Print  
Author Topic: Caspar the Ghostly friend...  (Read 4424 times)
0 Members and 1 Guest are viewing this topic.
Ronin
Full Member
***

Rep: 0
Offline Offline

Posts: 445
584.00 credits

View Inventory
Send Money to Ronin

View Profile WWW
« Reply #20 on: January 21, 2007, 06:53:38 AM »

I moved the viewer program from MFC back to just a Win32 program.  The MFC framework can be somewhat hostile when you aren't just trying to write a simple document/view program.  It kept losing my textures in OpenGL.  Rather than spin my wheels for a week trying to figure out why the "black box" that is MFC kept doing this to me, I just started another program.

I've got almost all the functionality I had before except for being able to select what's displayed.  I suspect I'll have a little more control over that with out the MFC framework getting in the way, too.

Anyway, I've the levels being display textured, now. Sort of.  Some of the textures look just fine.  Some look completely hosed.  I've even got the multi-texturing working where there are two textures.

There seems to be no rhyme or reason why the textures don't look right.  It's possible I'm not loading those textures correctly.

Here's an example of what I mean:



As you can see, the ground, the airfield itself looks fine.  There is some "shimmer" from the depth masking.  But that's not important.  What is important is that the textures on the fuel tanks and nearly everything else, is just wrong.

It's got to be either the texture coordinates are wrong.  Or the textures aren't being read and built correctly.  Since there are about 5 different RSB types in use, it's hard to tell if it's because some of the RSB files are being read incorrectly.  That will take some examination of files and digging the in map data to determine which texture types look right and which ones don't.  If I find that some of the same type of texture don't look right and some do then I will have to assume that somehow the texture coordinates for those items are incorrect.  There are another set of texture coordinates which we assume are darkmap coordinates.

I have noticed when looking at the data, that on most of the "normal" texture coordinates the S and T values are usually less than one.  This can't be right for a texture that needs to repeat.  In the "darkmap" texture coordinates the S and T values are often greater than 1 in magnitude (some are negative which is perfectly normal).

It's just another little mystery.  Some of the maps (like River) are starting to look pretty good.  When I get the textures displaying properly and the "objects" displaying, these maps should start to look really good.

You may have noticed that the maps are displayed "pre-lit".  These textures are generated by the RSE lighting tool when the map is lit.  So building a new map would require "unlit" textures so it could be lit (actually shadowed) afterward.

I've looked through Mike's VB code for his map parser.  I understand it but it really doesn't resemble Basic at all.  I was looking through that code to try to see where Mike is pulling the texture coordinates for the polygons that he is dumping to the OBJ file.  Except this program doesn't do that.  It appears that this program is identifying the same block of data that I am as the texture coordinates.  But his objects look just fine in Max.  It's possible with all the crazy referencing of vertices, normals and texture coordinates that the wrong coordinates are often used for the vertices.  It wouldn't surprise me at all.  In fact, I thought it quite odd that the texture coordinates are just by vertex and not by triangle since the data is laid out by triangles.  Now, with a mesh, that  makes some sense, but on the face of it, it looks a bit strange.

Anyway, I'll be poking at that tomorrow.  And, by the way, you can probably tell from the picture that the program is now called GhostView.

Stay tuned, the adventure continues... Cheesy
Logged

Just an average schmo.
    * Intel Core 2 Duo 2.4Ghz, 3GB DDR2-667 RAM
    * GeForce 8800GTX PCI-Express 16, 768MB
No XBox 360 :sad:
Zazoo
Administrator
Hero Member
*****

Rep: 13
Online Online

Posts: 1332
1829.50 credits

View Inventory
Send Money to Zazoo

View Profile WWW
« Reply #21 on: January 21, 2007, 07:49:08 AM »

Quote from: Ronin;28889

Here's an example of what I mean:



As you can see, the ground, the airfield itself looks fine.  There is some "shimmer" from the depth masking.  But that's not important.  What is important is that the textures on the fuel tanks and nearly everything else, is just wrong.


Only three things I can think of:

1.)
Are you sure you've pulled the texture index from the polygon group? When I first started playing with my exporter I had a similar problem. I was pulling the material index (instead of the texture index) from the polygon group. A lot of times the texture indices and the material indices match (almost all of them do on the training map). Because of this, some textures show up right (because they have matching material indices) and some don't.

2.)
That, or perhaps you're using the darkmap coordinates insted of the texture coordinates?
On polygon groups with textures and darkmaps, the texture coordinates are always the last array of coordinates in the texture coordinate listing (darkmaps are first). (If this is the case, the reason the ground texture is showing correctly is because on ground textures there are no darkmaps (this is why shadows are rendered directly to the ground texture map itself). In these groups, the ground texture is the first texture coordinate array, the second texture coordinate array is the ground detail texture (sort of like a fake bump map)).

3.)
Also, I'm not sure if it is an OBJ format thing, or something about the way RSE stored their texture coordinates, but to get the textures to display correctly I had to have the exporter invert all of the Y (S) coordinates for the texture maps.

Quote

I've looked through Mike's VB code for his map parser.  I understand it but it really doesn't resemble Basic at all.  I was looking through that code to try to see where Mike is pulling the texture coordinates for the polygons that he is dumping to the OBJ file.  Except this program doesn't do that.  It appears that this program is identifying the same block of data that I am as the texture coordinates.  But his objects look just fine in Max.  It's possible with all the crazy referencing of vertices, normals and texture coordinates that the wrong coordinates are often used for the vertices.  It wouldn't surprise me at all.  In fact, I thought it quite odd that the texture coordinates are just by vertex and not by triangle since the data is laid out by triangles.  Now, with a mesh, that  makes some sense, but on the face of it, it looks a bit strange.


To make the loading process faster (and faster to code) I created a set of user-defined types (like C's structs) and organized them so that they matched the layout of the MAP file entries. Most of the entry data is "mass loaded" by reading a large block of data from the file directly into the UDT as a whole.

This part actually pulls the data from the file (General->ParseGeometryList):
Code:

For lngLoop3 = 0 To .NumTexMaps - 1
     ReDim .TexMaps(lngLoop3).TexMap(.NumFaceData - 1)
     Get mintFF, , .TexMaps(lngLoop3).TexMap
Next lngLoop3

TexMaps is an array of texture coordinate arrays, TexMap are the coordinates arrays.

Which is structured according to these UDT's (General->Declarations):
Code:

' Polygon Group
Public Type GR3D_PolyGroup
    bytUn1 As Byte                  ' Unknown
    bytUn2 As Byte                  ' Unknown
    bytUn3 As Byte                  ' Unknown
    MaterialIndex As Long
    NumTextures As Long
    TextureIndices() As Long
    lngUn4 As Long                  ' Unknown
    DarkMapIndex As Long
    lngUn5 As Long                  ' Unknown
    lngUn6 As Long                  ' Unknown
    lngUn7 As Long                  ' Unknown
    lngUn8 As Long                  ' Unknown
    NumPolys As Long
   
    grpUn1() As GR3D_4UnFloat
    PolygonIndices() As GR3D_PolyIndex
    NormalIndices() As GR3D_NormIndex
   
    NumFaceData As Long
    NumTexMaps As Long
   
    Normals() As GR3D_Normal
    TexMaps() As GR3D_TexMapData
    grpUn2() As GR3D_4UnFloat
End Type

' Texture Coordinate Arrays
Public Type GR3D_TexMapData
    TexMap() As GR3D_TexMap
End Type

' Texture Coordinates
Public Type GR3D_TexMap
    X As Single
    Y As Single
End Type



The OBJ writer I coded isn't very pretty, I appologize for that. The purpose of writing it was to get something visual to work with, and I had to put in a  few ugly fixes for some problems I encountered early on. It's functional, but hardly neat and clean.
Because OBJ files use a single vertex, normal, and texture coordinate array, I had to create a messy way to reindex everything beyond the first room "on-the-fly" as the OBJ file was being written.
I also flipped the Y texture coordinate "on-the-fly" and did a simple texture count "test" to see whether the first array or last array of texture coordinates should be used (first when ground texture is present, last when 1 texture and 1 darkmap are present).

~Mike
Logged

Ronin
Full Member
***

Rep: 0
Offline Offline

Posts: 445
584.00 credits

View Inventory
Send Money to Ronin

View Profile WWW
« Reply #22 on: January 21, 2007, 05:25:52 PM »

@Mike, I was thinking last night as I wrote the prior post about using the darkmap indices (what I thought the last set of indices were).  Cheesy   That's because I noticed that the "darkmap" coordinates (what I thought the last ones were had repeating values and the others did not). It's an odd ordering system where you have the darkmap index in the texture list _after_ the textures but the texture coordinates for the darkmap _before_ the the texture coordinates.  I think that will solve the problem.  Possibly not in it's entirety (I think I may still have some RSB issues) but probably for the most part.

Fortunately, it's an easy thing to fix.  I just have to rearrange my code a little and it should work fine.  I was thinking that the darkmap coordinates would be the last thing since it appeared to be optional and I would always put optional data as an "addon" rather higher up in the data stream.

I think you've cracked it again, Mike.  Thanks! Thumbs up 2 :cookie: I'm going to go try that out, now.

You may have had to negate the "Y" coordinate because of the way GR displays textures.  They start out rotated 90 degrees from what they _should_ look like.  It's possible a conversion could rotate them the wrong way and that would make one of the texture coordinates invert the texture.  I've had that happen to me before.  I did a port of Wolfenstein 3D to OpenGL a couple of years ago.  The textures there are stored rotated 90 degrees to the left.  I found that when I started running the program that the textures were upside down.  I added some code to just invert the texture because I was rotating it the wrong way and writing an inverter was easier than going back and dealing with that rotation again. Cheesy
Logged

Just an average schmo.
    * Intel Core 2 Duo 2.4Ghz, 3GB DDR2-667 RAM
    * GeForce 8800GTX PCI-Express 16, 768MB
No XBox 360 :sad:
Ronin
Full Member
***

Rep: 0
Offline Offline

Posts: 445
584.00 credits

View Inventory
Send Money to Ronin

View Profile WWW
« Reply #23 on: January 21, 2007, 05:36:14 PM »

Quote from: Zazoo;28890

2.)
That, or perhaps you're using the darkmap coordinates insted of the texture coordinates?
 BINGO!!

Quote
The OBJ writer I coded isn't very pretty, I appologize for that.


No need for any kind of apology. I was just commenting that VB doesn't look at all like the basic I'm used to.  Honestly, I don't know why Microsoft even called it Visual "Basic".  Besides, you've been a big help with this.  You wouldn't believe how crappy some of my code is... :tongue: Cheesy
Logged

Just an average schmo.
    * Intel Core 2 Duo 2.4Ghz, 3GB DDR2-667 RAM
    * GeForce 8800GTX PCI-Express 16, 768MB
No XBox 360 :sad:
MONOLITH
Administrator
Hero Member
*****

Rep: 3
Offline Offline

Posts: 3177
697.00 credits

View Inventory
Send Money to MONOLITH

View Profile
« Reply #24 on: January 21, 2007, 05:43:01 PM »

Quote from: Cowbell;28870
I don't know anything about GR maps or mods



heh heh. You bastard.     Nice work Ronin.  Thumbs up 2





.
Logged

Ronin
Full Member
***

Rep: 0
Offline Offline

Posts: 445
584.00 credits

View Inventory
Send Money to Ronin

View Profile WWW
« Reply #25 on: January 21, 2007, 06:49:13 PM »

Okay, changing the order in which the texture coordinates are interpreted seems to have worked nicely.  I didn't flip the T coordinate and things look alright.  But I haven't checked everything.  Things like the "4" on the runway in Airbase look right so everything else "should" be in the correct orientation.

Here's what it looks like with the right texture coordinates... Cheesy



One thing that's bothering me about the rendering is that the initial render is brighter.  After that first frame, the image goes a good bit darker.  I've tried turning off the lighting and that doesn't seem to help.  Hmm. (scratches head)  There's always something... :roll:

Anway, now that that's working, I'm going back to trying to interpret the objects.  That's the last big thing.  The rest is writing up a spec so that I have something to refer to and can update as more bits of the data are identified.
Logged

Just an average schmo.
    * Intel Core 2 Duo 2.4Ghz, 3GB DDR2-667 RAM
    * GeForce 8800GTX PCI-Express 16, 768MB
No XBox 360 :sad:
Wolfsong
One with nature...
Administrator
Sr. Member
*****

Rep: 7
Offline Offline

Posts: 518
1933.00 credits

View Inventory
Send Money to Wolfsong

75672554 WolfsongSwe@Hotmail.com
View Profile WWW
« Reply #26 on: January 22, 2007, 11:50:22 AM »

Quote from: Ronin;28695
Well, the LightWave SDK is freely available for download (unlike the SDKs for Max or Maya).  I haven't really looked at it, but I have downloaded it.
Maya SDK is included in the program. All header files for the C++ API are available. And there is a free version of Maya PLE, Public Learning Edition (although I think that version is without the API and MEL documentations). It's not a different program like GMax compared to Max. It's the exact same thing besides some limits like PLE logo in the background of the viewports and also restrictions to rendering with PLE logo.

Anotehr bonus. Everything that works with Maya PLE works with Maya, simply as it's the same program. And also there is usually no problem with using newer versions of Maya then the plugin was developed with, like it has been with Max.

EDIT: Erh? Why do you call the U & V (& W) coordinates S & T?
Logged

---===[ STAFF ]===---
Lead Technical Artist at Grin Inc.
Current Projects:
- Bionic Commando (PC/PS3/360)
- Bionic Commando - Rearmed (PC/PSN/XBL)
- Wanted (PC/PS3/360)
- Terminator: Salvation
Ronin
Full Member
***

Rep: 0
Offline Offline

Posts: 445
584.00 credits

View Inventory
Send Money to Ronin

View Profile WWW
« Reply #27 on: January 22, 2007, 06:58:20 PM »

Quote from: Wolfsong;28925
Maya SDK is included in the program. All header files for the C++ API are available. And there is a free version of Maya PLE, Public Learning Edition (although I think that version is without the API and MEL documentations). It's not a different program like GMax compared to Max. It's the exact same thing besides some limits like PLE logo in the background of the viewports and also restrictions to rendering with PLE logo.

Anotehr bonus. Everything that works with Maya PLE works with Maya, simply as it's the same program. And also there is usually no problem with using newer versions of Maya then the plugin was developed with, like it has been with Max.

EDIT: Erh? Why do you call the U & V (& W) coordinates S & T?


The Maya SDK isn't included with the PLE version.  Only the full commercial version IIRC.  That might have changed in the last couple of years. I remember looking for the SDK because I wanted to use Maya for something (can't recall what, now) and finally deciding to write my own editor because I couldn't get the SDK for Maya without buying the program.

I've referred to texture coordinates as U&V and S&T interchangeably for a long time.  I don't recall why. :hmm:
Logged

Just an average schmo.
    * Intel Core 2 Duo 2.4Ghz, 3GB DDR2-667 RAM
    * GeForce 8800GTX PCI-Express 16, 768MB
No XBox 360 :sad:
Ronin
Full Member
***

Rep: 0
Offline Offline

Posts: 445
584.00 credits

View Inventory
Send Money to Ronin

View Profile WWW
« Reply #28 on: January 23, 2007, 12:31:55 AM »

I've poked around in Maya this evening and I've been looking at the MEL command reference.  It's a completely new language to me.  But it might be usable to create a map exporter for GR.

I'm going to take a few baby steps with the scripting and see if I can make it work.  Maya is quite a powerful 3d modeler and a pretty good animation tool, too.  We'll see how the scripting goes.
Logged

Just an average schmo.
    * Intel Core 2 Duo 2.4Ghz, 3GB DDR2-667 RAM
    * GeForce 8800GTX PCI-Express 16, 768MB
No XBox 360 :sad:
Wolfsong
One with nature...
Administrator
Sr. Member
*****

Rep: 7
Offline Offline

Posts: 518
1933.00 credits

View Inventory
Send Money to Wolfsong

75672554 WolfsongSwe@Hotmail.com
View Profile WWW
« Reply #29 on: January 23, 2007, 08:29:16 AM »

You'll need to use the C++ API to make exporters and importers if thats on the table. You'll also need to use it if you want to create RSB support.

Besides that MEL should do the trick. It's mainly used for combining all the C++ functions and setting up the UI.
Logged

---===[ STAFF ]===---
Lead Technical Artist at Grin Inc.
Current Projects:
- Bionic Commando (PC/PS3/360)
- Bionic Commando - Rearmed (PC/PSN/XBL)
- Wanted (PC/PS3/360)
- Terminator: Salvation
Ronin
Full Member
***

Rep: 0
Offline Offline

Posts: 445
584.00 credits

View Inventory
Send Money to Ronin

View Profile WWW
« Reply #30 on: January 23, 2007, 07:12:42 PM »

Quote from: Wolfsong;28971
You'll need to use the C++ API to make exporters and importers if thats on the table. You'll also need to use it if you want to create RSB support.

Besides that MEL should do the trick. It's mainly used for combining all the C++ functions and setting up the UI.


Thanks for info.  I spent some time looking at the MEL documentation and the MEL scripts that come with the PLE version (there are a LOT of them).  I didn't see anywhere you change what gets written to a file with MEL.  But I may have missed that.

I did see where you can create new dialog boxes among other things using MEL.  Is there a dialog box designer somewhere in there?  I didn't notice any references to one but that doesn't mean there isn't one.

Since you say that the SDK is required for that, then I'll be needing that.  I'll be out of pocket for the next couple of days (funeral to go to).  But I'll contact you when I get back.
Logged

Just an average schmo.
    * Intel Core 2 Duo 2.4Ghz, 3GB DDR2-667 RAM
    * GeForce 8800GTX PCI-Express 16, 768MB
No XBox 360 :sad:
Wolfsong
One with nature...
Administrator
Sr. Member
*****

Rep: 7
Offline Offline

Posts: 518
1933.00 credits

View Inventory
Send Money to Wolfsong

75672554 WolfsongSwe@Hotmail.com
View Profile WWW
« Reply #31 on: January 24, 2007, 10:43:55 PM »

You can write to files with MEL, but I think it's mainly for feedback purpose. The API is the way to go there.

As for dialog boxes, there are a few preset version that you only add names and text to. If you want check boxes, radio buttons, text fields and all that, there are functions for that as well. MEL also supports full HTML pages if you want to create the interface that way, as MEL has it's own web browser window based on Mozilla.
Logged

---===[ STAFF ]===---
Lead Technical Artist at Grin Inc.
Current Projects:
- Bionic Commando (PC/PS3/360)
- Bionic Commando - Rearmed (PC/PSN/XBL)
- Wanted (PC/PS3/360)
- Terminator: Salvation
Pages: 1 [2]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
SMF Theme © Gaia
Valid XHTML 1.0! Valid CSS!