Gamestudio Links
Zorro Links
Newest Posts
Where's the Wiki?
by Quad. 06/25/19 22:16
Published Gamestudio Games?
by Dooley. 06/25/19 16:59
Updating to A8 [SOLVED]
by Dooley. 06/25/19 16:00
Message from IB of open position
by Zheka. 06/25/19 13:58
FXCM: "Can't connect to price server"
by riinvest. 06/25/19 10:35
New Zorro version 2.12
by jcl. 06/25/19 09:42
Aum120 is ready
by Emre. 06/24/19 17:54
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
5 registered members (JeyKey II, wdlmaster, alibaba, jenGs, kvm), 574 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Theaisback, redye, rhe2564, Qw3rty, Dal
18239 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Open WMB file #476666
03/20/19 22:19
03/20/19 22:19
Joined: Mar 2019
Posts: 4
Q
QuartzLoop Offline OP
Guest
QuartzLoop  Offline OP
Guest
Q

Joined: Mar 2019
Posts: 4
Hello,
I really like the lighting WED does and would love to find any way to extract level geometry & lightmaps from WMB in any useful 3D format. Only thing I found is this:
https://forum.unity.com/threads/importing-wmb-files-from-3dgs.36300
...but it didn't really work.

I don't use Unity, I would only like to have model lightmapped in WED so I can open it in Blender/use it on SketchFab website.

Re: Open WMB file [Re: QuartzLoop] #476670
03/21/19 13:37
03/21/19 13:37
Joined: Mar 2019
Posts: 4
Q
QuartzLoop Offline OP
Guest
QuartzLoop  Offline OP
Guest
Q

Joined: Mar 2019
Posts: 4
...small update, I've tried DX3DRipper and NinjaRipper, DX3D was terrible, all my geometry was distorted & half was missing. Ninja was a bit better but also had missing geometry and only lightmaps with no textures.
However both programs did extract lightmaps so I guess it's at least possible. If I could get lightmap UV's they could be manually applied in MED and then all is left is importing lightmap-texture files extracted with DX3D or Ninja.

Re: Open WMB file [Re: QuartzLoop] #476671
03/21/19 15:55
03/21/19 15:55
Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
You could dig through the WMB documentation and write an extractor:
http://www.conitec.net/beta/prog_mdlhmp.htm

If you already have the lightmaps extracted you could use ent_buffers on level_ent and read mesh information from blocks (in particular DirectX vertices with 2 UV sets). Or maybe even try ent_getmesh on level_ent, not sure if that works.
You can then save the directX mesh as a file, or write your own OBJ exporter (the most simple model format).


However... it's probably the better idea to just learn lighting in another program, I bet Blender can do that just as fine/ much better.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Open WMB file [Re: Superku] #476673
03/21/19 17:54
03/21/19 17:54
Joined: Mar 2019
Posts: 4
Q
QuartzLoop Offline OP
Guest
QuartzLoop  Offline OP
Guest
Q

Joined: Mar 2019
Posts: 4
The ent_getmesh sounds great but unfortunately my coding is extremely limited. Can this be done in SED with some sort of on_click event? Can I find ent_getmesh & ent_savemesh in documentation?

I really like the way WED does lights because it creates a nice retro-Quake-Wolfenstein-CBsUndying style that I was unable to do in Blender. The closest program with similar lights that I used is DeleD but he is handling bigger geometry very badly. Also I like the fact that both DeleD and WED are automatically creating lightmap UV/size calculations. In Blender I have to manually unwrap parts of the model for second UV & maps usually have visible seams because of the margins or too much faces so I have to go back, further separate model parts, unwrap new parts again... it becomes very tedious very fast.

Re: Open WMB file [Re: QuartzLoop] #476674
03/21/19 22:37
03/21/19 22:37
Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Oh, I never realized that ent_getmesh is specifically intended (among others) to be used for level blocks:
http://www.conitec.net/beta/ent_mesh.htm

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <windows.h>
#include <d3d9.h>
///////////////////////////////

HRESULT WINAPI 
D3DXSaveMeshToXA(
char* pFilename,
LPD3DXMESH pMesh,
void* pAdjacency,
void* pMaterials,
void* pEffectInstances, 
DWORD NumMaterials,
DWORD Format
);

#define D3DXF_FILEFORMAT_BINARY 0
#define D3DXF_FILEFORMAT_TEXT 1
#define D3DXF_FILEFORMAT_COMPRESSED 2

char *cTextureFile = "someFile.tga";

D3DXMATERIAL d3dmaterial[2];

void wmbSaveAllBlocksToFiles()
{
	d3dmaterial[0].pTextureFilename = cTextureFile;
	d3dmaterial[1].pTextureFilename = cTextureFile;
	int blockNum = 0;
	while(1)
	{
		LPD3DXMESH mesh = ent_getmesh(NULL,blockNum ,0);
		if(!mesh) break;
		
		STRING *str = str_printf(NULL,"export\block%d.x",blockNum);
		D3DXSaveMeshToXA(str->chars, mesh, NULL, d3dmaterial, NULL, 2, D3DXF_FILEFORMAT_BINARY);
		
		blockNum++;
	}
}

void main()
{
	fps_max = 60;
	video_mode = 10;
	level_load("deathMountain.wmb");
	wait(1);
	wmbSaveAllBlocksToFiles();
}



Just gave it a quick shot, almost worked immediately. You need to supply a material so it exports the UVs as well. Apparently sadly though, only the first UV map is saved. Might be wrong though. (The model shows up as black in MED because I did not fully set up the d3dmaterial.)

MED has some sort of skin mapping import and export. Maybe you could look at it, then write a basic code that outputs the 2nd UV map in the correct format (to a text file) and import in MED.
Could work but might not be that easy.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Open WMB file [Re: Superku] #476681
03/22/19 12:53
03/22/19 12:53
Joined: Mar 2019
Posts: 4
Q
QuartzLoop Offline OP
Guest
QuartzLoop  Offline OP
Guest
Q

Joined: Mar 2019
Posts: 4
Thank you for the code, I tried it but unfortunately nothing happened.
My steps:

I build my level with lights (wmb was created).
Clicked Publish, engine asked for script, I've chosen Empty Script.
I've opened SED and added your script plus:
Copied all c and h files from engine's 'include' folder in folder where EXE is.
Placed 32bit TGA texture (1024/1024) in folder where EXE is, changed the name in script: char *cTextureFile = "oldbricks1tga.tga";
Changed level name to my wmb name: level_load("Kata20old.wmb");
Started EXE file, everything went fine, level started, I was able to look around after clicking 0, closed the app.

Folder 'export' was not created by the engine, so I've created it manually in the EXE folder, started everything again, closed everything, looked inside manually created 'export' folder, still nothing there.

I'm not sure what I'm doing wrong?

Last edited by QuartzLoop; 03/22/19 13:05.
Re: Open WMB file [Re: QuartzLoop] #476682
03/22/19 14:34
03/22/19 14:34
Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Hmmmm. Some things:

Don't "publish" your script or level.
Just create a new text file, rename it to someScript.c, paste my code.
Change the level name.
Do not copy over any files from GStudio include folder. It finds them automatically (copying them over will break stuff should you ever update your GStudio installation).
Just start the script from SED, for example with the left-most triangle/ play button.

If your GStudio installation is in a subfolder of Program Files, well, that's bad, it shouldn't (I just have it in C:GStudio8 for example). Otherwise it will not be allowed to create files because if missing rights.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Moderated by  HeelX, rvL_eXile 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1