Page 5 of 16
Re: [OPTing] a new opting tool is under construction
Posted: Thu Jun 26, 2014 12:12 pm
by Atx
The shading errors can be sorta fixed by cutting the face in half - I did that sometimes with my little buck rogers starfighter opt and it worked well. It's all a matter of getting that vector to point in the right direction.
Wasn't there a small program that fixed the face orders and rendered them real-time with lighting in a viewer? That worked real well with some other stubborn opts I had.
Re: [OPTing] a new opting tool is under construction
Posted: Thu Jun 26, 2014 11:11 pm
by Gank
that would only apply if your problems on concave quad and you use optech, sometimes its a bit more complex
if you look here you can see a shading artifact
Capture2.JPG
but the wirefram shows cuting a face isnt going to do much good
Capture3.JPG
likewise here
Capture.JPG
Re: [OPTing] a new opting tool is under construction
Posted: Thu Jun 26, 2014 11:17 pm
by Gank
wireframe
Capture5.JPG
hte problems are hard to see there, its easier when your viewing the model in 3d, but cutting anythings not going to solve anything, problem is some points are off planar, mainly due too rhinos poor mesh editing tools. Easiest way to see in rhino with a complex mesh is try to weld the mesh with an angle of 0, if some edges arent selected somethings off planar
but anyways this is a modeling issue and nothing really to do with jeremys tool
Re: [OPTing] a new opting tool is under construction
Posted: Mon Jun 30, 2014 2:25 pm
by Atx
Normally, when I did those sort of details I would plan ahead and manually slice the face to get the number of verticies I needed.
Delete the face and reinsert a clean one then slice the hell out of face making a nice tight grid and if possible, manually adjust the vertices to get the shape you desire and then do the indentation (negative extrusion?). That's a nice way to get your verticies coplanar if you can lock it down in Rhino like 3D Max allows...I'm pretty sure there's an option to move along the face's/vertex's local axis.
I never used cutaway tools or Boolean tools because you're leaving that up to the software to decide which isn't the best option in this case and you'll always end up with those ugly tris everywhere.
I had that issue from time to time but that was my workaround for me. God, it's been awhile but it's slowly coming back. LOL.
Re: [OPTing] a new opting tool is under construction
Posted: Wed Jul 02, 2014 6:53 pm
by JeremyaFr
"Triangling to infinity" problem workaround
Here is a possible workaround for the "triangling to infinity" problem.
Code: Select all
At offset 193C4A, replace 750C with 9090.
At offset 193C53, replace 02 with 08.
This will replace the hardcoded vertex count limit (in the execute buffer) of 512 with 2048.
When the game engine reach this limit, it does not send the vertices to the execute buffer. So subsequent triangles draw uses previous vertices. That's what cause the "triangle to infinity" effect.
Re: [OPTing] a new opting tool is under construction
Posted: Wed Jul 02, 2014 9:08 pm
by Rasalas
Thanks Jeremya! This is really cool stuff, as usual!
Is there a reason for raising the limit "only" to 2048 instead of, for example, 4096?
Re: [OPTing] a new opting tool is under construction
Posted: Wed Jul 02, 2014 11:22 pm
by Atx
Sweet! So you bypassed (NOP'd) the 'sending to the buffer' code and quadrupled the limit.
Makes perfect sense...awesome stuff!
Also, the reason he didn't go any higher might have been for practical reasons...it could easily slow the game down even on modern day machines. Also, with him setting it to an 8 and not higher might be for the simple reason that it might not allow/accept more than the nybble (half byte)? so possibly throwing in a 15 (4095) might be the largest it can go...but to me that's highly doubtful.
4 times the limit is more than enough for a decent model for this old engine.
Re: [OPTing] a new opting tool is under construction
Posted: Thu Jul 03, 2014 8:24 pm
by JeremyaFr
This modification will not remove the existing vertex count limit for opt files.
The vertex count limit is 512 per mesh and it cannot be changed.
The modification is related to the triangling problem.
By triangling, it means this kind of effects (in wireframe):
frame.png
Triangles appear all accross the screen.
It happens when triangles are drawn using wrong vertices.
The triangling effect means that the opt model contains a FaceGroup that has too many triangles. The simplest way to solve it is to split the FaceGroup that has too many triangles in several FaceGroups.
The modification inscreases the triangle count a single FaceGroup can have.
There is no real reason to set only 2048. In fact, vertices are indexed using words. So the max vertex count can be 65535.
But remember that the vertex count limit per mesh is 512. I don't think the vertex count in a single FaceGroup will be as high.
Re: [OPTing] a new opting tool is under construction
Posted: Wed Jul 23, 2014 6:17 pm
by Ramshu
I use "convert Opt textures to 32 bits" and "apply exe patcher" on a xwa upgrde folder. I detect a little problem, the ligths on cockpit and starships are off.
images to compare:
XWA Upgrade:
http://i60.tinypic.com/v2r0jt.jpg
XWA Upgrade with 32bit texture convert:
http://i62.tinypic.com/a4o0at.jpg
any idea how to fix it?
Re: [OPTing] a new opting tool is under construction
Posted: Wed Jul 23, 2014 8:53 pm
by JeremyaFr
This is because light maps are not yet supported.
Re: [OPTing] a new opting tool is under construction
Posted: Fri Jul 25, 2014 2:54 am
by Bman
Looks like it maybe related to "Diffuse Lighting" effect. Ramshu, have you tried adjusting your in-game single-player "Video" menu settings ?
Re: [OPTing] a new opting tool is under construction
Posted: Fri Jul 25, 2014 3:17 am
by Bman
Jeremy, in your post above with the picture, are you saying that too many adjacent triangles or planes that share the same single vertice x1,y1,z1 can cause triangulation ? For a "FaceGroup" my understanding is you are defining that as two or more faces (triangles) in a given mesh that share the same textured bitmap file. Does a FaceGroup have to reference the entire bitmap coordinates of textured file, or can it reference part of bitmap file ? Why not just split a textured bitmap file into a separate file(s) before stitching to the faces? i.e. File.bmp is 1024x1024 total pixels. i.e. x0,y0 to 1023x,1023y uses whole image vs. x48,y111 to x624,y704 which is part of the 1024x1024 image. How many textured bitmap files are allowed to be imported and referenced, 100 ?
Re: [OPTing] a new opting tool is under construction
Posted: Fri Jul 25, 2014 11:26 pm
by JeremyaFr
A Face is a triangle or a quadrangle.
A FaceGroup is a group of faces on which a texture is applied.
A MeshLod contains FaceGroups.
A Mesh contains MeshLods.
An Opt contains Meshes.
Execute Buffer
The triangling is related to the number of triangles that are rendered. A triangle that is outside the screen is not rendered.
The rendering is done with an execute buffer.
DirectX 5 SDK:
execute buffer:
A fully self-contained, independent packet of information that describes a 3-D scene. An execute buffer contains a vertex list followed by an instruction stream. The instruction stream consists of operation codes, or opcodes, and the data that is operated on by those opcodes.
XWA creates an execute buffer whose the size is 0x10000.
A vertex is described by a D3DTLVERTEX structure.
typedef struct _D3DTLVERTEX {
D3DVALUE sx;
D3DVALUE sy;
D3DVALUE sz;
D3DVALUE rhw;
D3DCOLOR color;
D3DCOLOR specular;
D3DVALUE tu;
D3DVALUE tv;
} D3DTLVERTEX;
dvSX, dvSY, and dvSZ:
Values describing a vertex in screen coordinates.
dvRHW:
Value that is the reciprocal of homogeneous w.
dcColor and dcSpecular:
Values describing the color and specular component of the vertex.
dvTU and dvTV:
Values describing the texture coordinates of the vertex.
When XWA fills the buffer, it fills up to 512 vertices and ignores the extra vertices.
That is what causes the triangling effect.
The content of the execute buffer looks like this:
Code: Select all
10699 Execute Buffer:
0: ( 615 ; 749 ; 0 ) 0.29922 FF9A9090 00000000 ( 0.5 ; 0.083333 )
1: ( 615 ; 751 ; 0 ) 0.29909 FF303030 00000000 ( 0.071429 ; 1 )
2: ( 616 ; 750 ; 0 ) 0.298786 FF303030 00000000 ( 1 ; 1 )
3: ( 609 ; 749 ; 0 ) 0.297183 FF303030 00000000 ( 0.066667 ; 0.925926 )
4: ( 610 ; 749 ; 0 ) 0.296721 FF303030 00000000 ( 0.6 ; 1 )
5: ( 611 ; 744 ; 0 ) 0.29761 FF303030 00000000 ( 1 ; 0.111111 )
6: ( 609 ; 744 ; 0 ) 0.298075 FF303030 00000000 ( 0.4 ; 0.037037 )
7: ( 574 ; 726 ; 0 ) 0.287171 FF303030 00000000 ( 0.996656 ; 1 )
8: ( 615 ; 751 ; 0 ) 0.29909 FF303030 00000000 ( 0 ; 0.75 )
9: ( 615 ; 749 ; 0 ) 0.29922 FF9A9090 00000000 ( 0 ; 0.25 )
10: ( 575 ; 724 ; 0 ) 0.287372 FFF7D3D3 00000000 ( 0.996656 ; 0.083333 )
11: ( 611 ; 709 ; 0 ) 0.274725 FFCFBCBC 00000000 ( 0.004255 ; 0.006667 )
12: ( 589 ; 700 ; 0 ) 0.268666 FF333131 00000000 ( 0.017021 ; 1 )
13: ( 559 ; 715 ; 0 ) 0.281232 FF333131 00000000 ( 1 ; 0.7 )
14: ( 574 ; 722 ; 0 ) 0.285812 FFCFBCBC 00000000 ( 0.991489 ; 0.006667 )
0: PROCESSVERTICES
COPY start: 0 dest: 0 count:15
1: STATERENDER
TEXTUREHANDLE 3830
2: TRIANGLE
0 1 2
3 4 5
3 5 6
7 8 9
7 9 10
3: STATERENDER
TEXTUREHANDLE 3833
4: TRIANGLE
11 12 13
11 13 14
5: EXIT
When the game is launched, the render states are initialized:
Code: Select all
1024 Execute Buffer:
0: STATERENDER
TEXTUREPERSPECTIVE TRUE
TEXTUREMAG LINEAR
TEXTUREMIN LINEAR
SUBPIXEL TRUE
SUBPIXELX TRUE
WRAPU FALSE
WRAPV FALSE
ALPHABLENDENABLE FALSE
TEXTUREMAPBLEND MODULATE
SRCBLEND ONE
DESTBLEND ZERO
ALPHATESTENABLE TRUE
ALPHAFUNC NOTEQUAL
STIPPLEDALPHA FALSE
SHADEMODE GOURAUD
MONOENABLE TRUE
SPECULARENABLE FALSE
FOGENABLE FALSE
FILLMODE SOLID
DITHERENABLE TRUE
ANTIALIAS NONE
ZENABLE TRUE
ZWRITEENABLE TRUE
ZFUNC GREATER
CULLMODE NONE
1: EXIT
Then the render states are modified as needed.
Textures
A FaceGroup does not have to reference the entire texture coordinates space.
Xwa exe can handle up to 200 textures per opt. With the patch, the limit is 1024. If needed, it can be increased. The real limit is the memory consumption.
Re: [OPTing] a new opting tool is under construction
Posted: Sat Jul 26, 2014 7:46 am
by Bman
Good to know. Probably safe to say most modern systems today have at least 4GB of main memory not including graphic cards' on-board memory. Recapping: so with the patch, then you could have up to 1,024 textured-bitmap files each potentially at 1024x1024 pixel dimensions, right?
A FaceGroup "family" cannot be part of more than one specific mesh, correct ? Every mesh has its own one or more FaceGroup(s).
If a FaceGroup is a group of faces on which a texture is applied, then is that same thing as saying one is just stretching a texture over those faces, like putting a blanket over a garden pegged at each corner? Or does each face (it's vertices) have to reference specific coordinate of the same bitmap-texture? Asked another way, for any given mesh, can each triangle face reference its own separate texture-bitmap file, or do all faces in a given mesh have to pull from the same texture-bitmap file (with same or different pixel coordinates) ? A one-to-one, one-to-many, or many-to-many relationship ?
Re: [OPTing] a new opting tool is under construction
Posted: Sat Jul 26, 2014 6:58 pm
by JeremyaFr
For memory consumption, remember that xwa is a 32-bit exe.
With the patch, you can have up to 1024 textures per opt. It is safe to say that the size of a texture can be up to 4096x4096. The mininum size is 8x8.
Each mesh has its own geometry.
Each face can reference its own texture.
A texture can be referenced across several meshes.
Several textures can be added to a FaceGroup. Each one forms a flight groups color.
Re: [OPTing] a new opting tool is under construction
Posted: Tue Jul 29, 2014 12:43 pm
by Gank
Unless you've a 4k monitor a 4096^2 texture is overkill as mip maps will be used at lower resolutions, at least as far as my understanding of it is.
Re: [OPTing] a new opting tool is under construction
Posted: Tue Dec 02, 2014 5:22 pm
by JeremyaFr
UPDATE for:
- Xwa Dat Editor
- Xwa Cbm Editor
- Xwa Opt Editor
If you use any of these tools, please re-download them to ensure that you use an up-to-date version.
Re: [OPTing] a new opting tool is under construction
Posted: Wed Dec 03, 2014 1:44 am
by Darksaber
might be a daft question, but where do I download
Xwa Dat Editor
Xwa Cbm Editor
I thought they where in with the XWA Opt Editor, (the link on the first post, then I thought they might be incorporate into the XWA Opt Editor, but I can't find that in there either
or am I missing something?
Re: [OPTing] a new opting tool is under construction
Posted: Wed Dec 03, 2014 10:38 am
by Bman
Thanks Jeremy. Appreciate it. Forgot your tool is still W-I-P. Eventually to replace OptTech.
DS, all of the latest stuff is here at his site:
https://onedrive.live.com/redir?resid=A ... 94FB%21116
Re: [OPTing] a new opting tool is under construction
Posted: Wed Dec 03, 2014 4:22 pm
by Rasalas
By the way, Jeremya, what happened to XwaStatisticsView? It's a very useful tool, much more userfriendly than BHE and way less buggy than MXvTED.
Re: [OPTing] a new opting tool is under construction
Posted: Wed Dec 03, 2014 5:26 pm
by JeremyaFr
A more complete and less buggy version of XwaStatisticsView will be soon available.
Posted: Thu Dec 11, 2014 11:33 am
by Bman
.
Re: [OPTing] a new opting tool is under construction
Posted: Sun Feb 08, 2015 2:14 pm
by Q
JeremyaFr wrote:UPDATE for:
- Xwa Dat Editor
- Xwa Cbm Editor
- Xwa Opt Editor
If you use any of these tools, please re-download them to ensure that you use an up-to-date version.
You can download all the files from JeremyaFr's virtual drive here:
https://onedrive.live.com/redir?resid=A ... 94FB%21116
Re: [OPTing] a new opting tool is under construction
Posted: Sat Feb 21, 2015 2:10 am
by Bman
Jeremy, is it possible you can adapt your editor to also import fully textured or untextured .3ds models and in any color format ?
Right now Anim8tor (from Anim8tor.com) a 3D program I use will only allow me to save/export it's .an8 model files into .3ds files (with it's in-house UV mapping tool), but they only allow 24-bit 8R8G8B textured .bmp files. .Obj files can also be exported but come with .mtl (materials reference file too, not the actual textured .bmp files.)
Or if your editor could import Anim8tor's native .an8 file format with textures already applied on the models, that would be even better.
No worries, i can find other solutions, but wanted to ask anyway. Thanks
Re: [OPTing] a new opting tool is under construction
Posted: Sun Feb 22, 2015 7:47 pm
by JeremyaFr
When importing .obj files, the associated .mtl file is taken account. Let me know if you import an .obj file and the textures are not imported.
The .an8 file format looks simple. So it would be relatively easy to write an importer.