Page 10 of 19

Re: 4ds files hacked

Posted: Thu Aug 11, 2011 12:19 am
by hdmaster
Thanks for the advice!
Is an exact vertex position of a mesh somehow important for the LMs? Because the exported positions do not coincide completely. A vertex imported to X = 0.000041 may show up in a 3ds Max exported file as 0.000042.

Re: 4ds files hacked

Posted: Thu Aug 11, 2011 11:13 am
by Marvin (hun)
The other interesting thing is that the original game has many-many lightmap bugs. I play the full campaign now on skill3, so I need to stay in hidden. During the game I can easy "find" points on the map with extreme visible value. For example: I creep in the shadow with ~18m visible value and in the next step I'm suddenly visible from 227m or 452m (and I stayed in the shadows of course) I found this kind of bug almost on every map.

Re: 4ds files hacked

Posted: Thu Aug 11, 2011 4:01 pm
by Ikaros
If the tree.klz comprehension proves out right (and clues are at our side  :grin:),
what do we miss to make maps from scratch?

Maybe, just the lightmaps and light sectors?

Re: 4ds files hacked

Posted: Thu Aug 11, 2011 5:28 pm
by lexov
hdmaster wrote: Thanks for the advice!
Is an exact vertex position of a mesh somehow important for the LMs? Because the exported positions do not coincide completely. A vertex imported to X = 0.000041 may show up in a 3ds Max exported file as 0.000042.
Hm no, that should be no issue, at least for Mafia. Things that need to match (at least IIRC) are
  • the # of lod levels of each lightmap level compared to the number of lod levels of the mesh (<- not sure on that one)
  • the # of face groups of each lightmap lod level compared to the # of face groups of the corresponding mesh lod level
  • the # of indices of each lightmap lod level compared to the # of indices of the corresponding mesh lod level
  • the order of the face groups in each lightmap lod level compared to the order of the face groups of the corresponding mesh lod level
Maybe H&D 2's lightmaps are a little bit more advanced and require additional data to match. The best approach is probably to compare the orignal mesh with the exported one to see what's different.

Re: 4ds files hacked

Posted: Sat Aug 13, 2011 12:57 am
by MCh2207Cz
hdmaster wrote: Screenshot of Africa1_mp exported from 3ds Max. I don't know why that turquoise color appears..
I remember seeing this error on several surfaces (mostly outside rubble) at coop map Poland (Enemy HQ) by Zdenda.
When I tryed to see the default DM Poland map, the error was not there.

Re: 4ds files hacked

Posted: Sat Aug 13, 2011 11:37 am
by -ViTaMiHnM203-
It was before SS, that map was made using the original maps files, named London. The SS patch/expansion updated the map, and named it Poland.

Re: 4ds files hacked

Posted: Sat Aug 13, 2011 3:15 pm
by Marvin (hun)
Maybe the HDD-editor can help to make the lightmaps

Re: 4ds files hacked

Posted: Sat Aug 13, 2011 5:55 pm
by MCh2207Cz
To -ViTaMiHnM203-
So you mean that Zdenda made his coop Poland map from the early "London" version (not from the corrected "Poland" version)?

It could be true because the coop Poland map (asside from that lighting problem) had a lot of nonfunctional ladders.
On the contrary, the Poland DM map has functional ladders.

Re: 4ds files hacked

Posted: Sun Aug 14, 2011 3:00 am
by -ViTaMiHnM203-
Yes, as far as I know.

Re: 4ds files hacked

Posted: Tue Aug 23, 2011 10:15 am
by Ikaros
Am I wrong, or the standard for rotation is different between .BIN and .4DS?

It seems to me that for .4DS, null rotation is 0 0 0 1, while for .BIN null rotation is 1 0 0 0.

HDMaster (in his script) import the 4 floats from .4ds to 3dsmax in the same order as they are written in the file. And I think that, for 3dsmax standard, null rotation is 0 0 0 1:
http://www.cuneytozdas.com/tutorials/maxscript/

Otherwise, many many objects found in scene2.bin have the 4 floats equal (or very close) to 1 0 0 0,
which let me suppose .bin have a different standard.

Does anybody found out how exactly this works?
I'd like to have info on how to convert quaternion to eulerian angles and back.

Until now, I've used this code to convert angles from .BIN files (and seems to me it's working):

Code: Select all

        double sqw = qReal*qReal;
        double sqx = qIf*qIf;
        double sqy = qJf*qJf;
        double sqz = qKf*qKf;
        double unit = sqx + sqy + sqz + sqw; // if normalised is one, otherwise is correction factor
        double test = qIf*qJf + qKf*qReal;
        if (test > 0.499*unit) { // singularity at north pole
            rZf = 2.0f * (float)Math.atan2(qIf,qReal);
            rYf = (float)Math.PI/2;
            rXf = 0.0f;
        }else if (test < -0.499*unit) { // singularity at south pole
            rZf = -2.0f * (float)Math.atan2(qIf,qReal);
            rYf = (float)-Math.PI/2;
            rXf = 0.0f;
        } else {
            rZf = (float)Math.atan2(2*qJf*qReal-2*qIf*qKf , sqx - sqy - sqz + sqw);
            rYf = (float)Math.asin(2*test/unit);
            rXf = (float)Math.atan2(2*qIf*qReal-2*qJf*qKf , -sqx + sqy - sqz + sqw);
        }
Where qReal, qIf, qJf, qKf are the 4 floats, found in this very order inside the .bin file, while rYf is rotation along the VERTICAL axis (as used by DC|ED, and not by 3dsmax, which uses Z as vertical axis)

How can I use the same code to convert angles from .4DS, then?

Real, I, J, K from .bin translate to I, J, K, Real from .4ds? Or maybe to K, J, I, Real?

Edit:
I think the correspondence is:
- .BIN > Real (or W), I, J, K
- .4DS > I, J, K, Real

Re: 4ds files hacked

Posted: Tue Aug 23, 2011 2:12 pm
by lexov
From my experience there's no standard on the order of the components of a quaternion. Some write it according to alphabet (w,x,y,z), others prefer (x,y,z,w). Interestingly IS used the same order for both file types in Mafia IIRC...

Re: 4ds files hacked

Posted: Sat Sep 03, 2011 4:37 pm
by hdmaster
@lexov:
Thanks, it was the number of face groups and the face order that caused the problem.

So here's the new version. Click Me. Don't forget to read the readme file

New in 2.1:
  • import files with morph data ( morph data will be skipped ) e.g. soldiers
  • CREATE sectors, occluder and LODs (Level of detail)
  • EXPORT sectors, occluder and LODs
  • texture import has been improved: twosided materials, reflection maps, color keys...
Currently only available for 3ds Max and tested only with 2011 x64. But I've also have a 'working' version for GMAX ( still a few bugs ). PM me for the GMAX version.

If you have any trouble running the tools or any error messages occure, please let me know.

Re: 4ds files hacked

Posted: Sat Sep 03, 2011 6:28 pm
by JonnySniper
Hi,installation for 3D Max 2010 dont work for me...
ive changed many things like compatipility and i dont see the HD2 button in 3D Max.
-Win 7 64bit

Re: 4ds files hacked

Posted: Sat Sep 03, 2011 6:50 pm
by hdmaster
Do you have a folder called 'H&D 2' in '3ds Max\Scripts\' and does the folder '3ds Max\Scripts\Startup' contain 3 .ms files starting with 'HD2_' ?

Re: 4ds files hacked

Posted: Sat Sep 03, 2011 8:50 pm
by JonnySniper
'3ds Max\Scripts\Startup' contain 3 .ms files starting with=>no

ive only "3ds Max Design 2010\4ds Tools\Scripts\Startup"
and there "HD2_init.ms","HD2_plugins.ms" and "HD2_toolbar.ms" files.