PDA

View Full Version : light map maker



virtual
11-02-2010, 04:10 PM
hi

is there a good Light map maker tool , that import 3ds file format

i've found awingsoft's light map maker , its good program and provide an SDK suport , but because i am not familier with c++ and plugins , i could not write my own plugin

also there is LMTS maker of lord trancos , but this one dosn't do a good job especially
the casting shadows isn't really good .

the last one is Lightmapper of Nitrogen , as the author of this tool said that this program is only for educational purpose only ( thats good ) but the fact is its very slow .

thanks in advance

Brainer
11-02-2010, 04:39 PM
AFAIK, you can use DeleD for that purpose. :) It imports 3DS files and produces lightmaps. It's open source, so no need to worry about anything. :)

NecroDOME
11-02-2010, 10:04 PM
Dunno, but you can write your own. It's not that hard to do.
I did it a while back for use in my old engine. It was slow dough...
But I think you can optimize it pretty easy with the use of an physics engine :)

virtual
12-02-2010, 01:30 PM
thanks for replys , but i don't think that i can write my own right now (seems hard)

i finished my spline editor and all i want to do is lightmapping my world then the rest will be easy

tpascal
13-02-2010, 09:30 PM
The best/powerfull lightmapper i have seen is called Giles, used to be comercial but now it is free!!,

http://www.frecle.net/index.php?show=&section=giles&sub=screenshots

Brainer
14-02-2010, 03:56 PM
Wow, this one really seems to be rocking! :) Downloaded and bunkered it just in case the site goes down (like it was with FontStudio). :)

virtual
14-02-2010, 08:05 PM
very nice , but how could we read the file format
do you know some (delphi) loader for that ?

Brainer
14-02-2010, 08:16 PM
You can try making your own. The specification is available from their website: http://www.frecle.net/download/glsspecs.htm

I did a quick search and found this (http://forumfiles.thegamecreators.com/download/754605) one. It's written in C++. I didn't take a deeper look, but maybe it won't be that much hassle to convert it to Pascal. ;)

EDIT
It shouldn't be too hard to convert it. I started it, but was a little busy to study the specs in detail. :) I didn't test the code, but it compiles under D2010. Here's what I've got so far:


type
{ .: TGiles :. }
TGiles = class sealed(TObject)
strict private
{ Strict private declarations }
type
{ .: TGLSChunk :. }
TGLSChunk = record
ID: Integer;
Size: Integer;
end;

{ .: TGLSHeader :. }
TGLSHeader = record
S: AnsiString;
Version: Single;
end;

{ .: TGLSAuthor :. }
TGLSAuthor = record
S: AnsiString;
end;

{ .: TGLSLightmap :. }
TGLSLightmap = record
Name: AnsiString;
FileName: AnsiString;
Width: Word;
Height: Word;
NonUniform: Boolean;
UseCustomTexels: Boolean;
CustomTexelSize: Single;
Repack: Boolean;
Data: array of Byte;
end;

{ .: TGLSTexture :. }
TGLSTexture = record
FileName: AnsiString;
ScaleU: Single;
ScaleV: Single;
OffsetU: Single;
OffsetV: Single;
Angle: Single;
Flags: Integer;
Blend: Integer;
CoordSet: Byte;
end;
private
{ Private declarations }
Data: array of Byte;
Offset: DWORD;
FileSize: Integer;
FFileAuthor: AnsiString;

procedure ReadHeader(Header: TGLSHeader);
procedure ReadHeaderSubChunks();
procedure ReadAuthorChunk();
procedure ReadModelsChunk();
procedure ReadModelData();

function ReadString(): AnsiString;
function ReadFloat(): Single;
function ReadChunk(): TGLSChunk;
public
{ Public declarations }
constructor Create(const AFileName: String);

property FileAuthor: AnsiString read FFileAuthor;
end;

{ TGiles }

constructor TGiles.Create(const AFileName: String);
var
FS: TFileStream;
Header: TGLSHeader;
begin
inherited Create();

FS := TFileStream.Create(AFileName, fmOpenRead);
try
Offset := 0;
FileSize := FS.Size;

SetLength(Data, FileSize);
FS.Read(Data[0], FileSize);
finally
FS.Free();
end;

ReadHeader(Header);
end;

procedure TGiles.ReadAuthorChunk;
begin
FFileAuthor := ReadString();
end;

function TGiles.ReadChunk: TGLSChunk;
begin
CopyMemory(@Result, @Data[Offset], SizeOf(TGLSChunk));
Offset := Offset + SizeOf(TGLSChunk);
end;

function TGiles.ReadFloat: Single;
begin
Result := 0.0;

CopyMemory(@Result, @Data[Offset], SizeOf(Single));
Offset := Offset + SizeOf(Single);
end;

procedure TGiles.ReadHeader(Header: TGLSHeader);
var
Chunk: TGLSChunk;
begin
Chunk := ReadChunk();

if (Chunk.ID = $FFFF) then
begin
Header.S := ReadString();
Header.Version := ReadFloat();
end;
end;

procedure TGiles.ReadHeaderSubChunks;
var
Chunk: TGLSChunk;
begin
while True do
begin
Chunk := ReadChunk();

case Chunk.ID of
$F000:
ReadAuthorChunk();
$1000:
ReadModelsChunk();
end;
end;
end;

procedure TGiles.ReadModelData;
begin

end;

procedure TGiles.ReadModelsChunk;
var
Chunk: TGLSChunk;
begin
while True do
begin
Chunk := ReadChunk();

if (Chunk.ID = $1001) then
ReadModelData()
else
begin
Offset := Offset - SizeOf(TGLSChunk);
break;
end;
end;
end;

function TGiles.ReadString: AnsiString;
var
StrLength, StrOffset: Integer;
C: AnsiChar;
begin
Result := '';
StrLength := 0;
StrOffset := Offset;
C := #0;

while True do
begin
C := AnsiChar(Data[StrOffset]);
Inc(StrOffset);
Inc(StrLength);

if (C = #0) then
break;
end;

SetLength(Result, StrLength);
CopyMemory(@Result[1], @Data[Offset], StrLength * SizeOf(AnsiChar));
Offset := Offset + (SizeOf(AnsiChar) * StrLength);
end;

Hopefully you can expand it and use it in your work. ;)

tpascal
14-02-2010, 11:23 PM
There are some paths you can fallow to put/get your geometry with others 3d tools, use intermediary supported file format, write your own native file reader/writer, or write your plugin for your own file format.

If you current dosent have any well know 3d file format exporter for your pipeline then you should consider doing one if you pretend to use free 3d tools out there for your pipeline production; one you have at least one file format support then you can use some free 3d file converter

Giles allow to import/export the geometry from some popular files like 3ds,directx *.x files, Obj, LWO, b3d.

The files native file format is al documented so you can try to code a raeder/writer for it.

Giles also support building DLL plugins (which you can do it with delphi), for build importer/exporter for your own file format, i have seen the pluging sdk documents and it looks very simple, just few functions that pass/get a pointe to block memory with data from the program to be parsed.

Me personally think i will use the b3d (blitz3d) intermediary file format path, it support to import/export all necessary data to giles and it is well popular for been used to communicate (directly or indirectly using a converter) for other tools out there. IF you get GLSCENE source code, ypu can found there an unit to read b3d files. ::)

BTW, i sugest to download also Giles 1.36 verson, curent 2.0 beta crash to often in my computer.