Jump to content
The Dark Mod Forums

Darkradiant Dds Support


Recommended Posts

Currently, RXGB compressed normalmaps are not supported. The warning Orbweaver has implemented works fine, so DarkRadiant at least knows what it encountered.

 

I've searched a bit on the web and found that the DevIL library is capable of loading RXGB normals, so I downloaded the source and took a brief look. There is a lot of bit-shifting going on, but I think that I can wrap my head around it if I bite into that.

 

Question is: should we extract the relevant part from the DevIL sources (given that is possible) and move them into our codebase or should we link against the DevIL libraries themselves and incorporate the headers into DarkRadiant? I don't know how platform-independent DevIL is, so we would have to check that.

 

Opinions?

Link to comment
Share on other sites

The best thing to do is to use the DevIL library as a source of the format information, then document this and re-implement it in the existing libdds library if possible. The coding is not the difficult part, it is figuring out how the format needs to be processed -- once this is done, the transformation into code is pretty easy (even if it is C rather than C++).

 

Fortunately it appears that DevIL is also (L)GPL, so if it does become necessary to lift source code this should be legal.

Link to comment
Share on other sites

Ok, I'll try to extract the relevant information then. It's not so much different to DXT5, the two colour fields have to be preprocessed a bit, as far as I can see now.

 

I'll post back here what I find.

Link to comment
Share on other sites

DevIL is platform independent IMO, and considering that we already use it for the main mod as well, why would you reimplement the same code again? Anybody who has the mode, you can be sure that DevIL is already installed, so you can be sure that DR would work with it.

Gerhard

Link to comment
Share on other sites

DevIL is platform independent IMO, and considering that we already use it for the main mod as well, why would you reimplement the same code again?

 

Because there is already a DDS library which has a switch statement to deal with the existing formats, and adding a new function to cope with RXGB is easier than trying to farm out that one format to yet another library, dealing with all of the linker and interface issues that would arise.

 

Of course it might be possible to completely replace the DDS library with calls to DevIL, but it isn't broken so fixing it is hardly a priority.

Link to comment
Share on other sites

It may be less work (and cause less disruption) than ripping out libdds and replacing it with DevIL. You could just add DevIL without replacing libdds and use it for the RXGB format only, but having two image-loading libraries co-existing seems a bit messy and redundant.

 

On the other hand, I guess DevIL loads more image formats than libdds does, so maybe it would be nice to have it... but on the other other hand, Doom 3 doesn't necessarily support all those formats and there's not much point having the level editor able to support a format when the game doesn't.

 

It sounds like it shouldn't be too hard to re-implement anyway - it's just fiddling with the layout of the colour values, right?

 

Edit: Orb beat me to it. :)

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

Heh, that's nice: compare this comment in ddslib.c (DarkRadiant):

/* four-color block: derive the other two colors.	
  00 = color 0, 01 = color 1, 10 = color 2, 11 = color 3
  these two bit codes correspond to the 2-bit fields 
  stored in the 64-bit block. */

to this one (DevIL):

// Four-color block: derive the other two colors.	
// 00 = color_0, 01 = color_1, 10 = color_2, 11 = color_3
// These 2-bit codes correspond to the 2-bit fields 
// stored in the 64-bit block.

:D

Link to comment
Share on other sites

From what I can say so far, DarkRadiant's ddslib is a bit better structured than the DevIL source. And I think I found a bug in the Radiant's ordinary DXT5 decompression code as well (could stem from copy&paste from what it looks), although I don't know if it's noticeable as it would only affect one single bit.

Link to comment
Share on other sites

Ok, I think I figured it out, but I need to test it. From viewing at the texture (I used the normalmap as diffusemap to inspect the result) it seems to be ok.

 

This is what DarkRadiant "saw" before:

ddsbeforebs3.th.jpg

 

And this after my changes:

ddsafterpa8.th.jpg

 

So far I tested it just with one single DDS encoded with ATI's compressonator (R:0 G: 0.5, B: 0.5, the usual procedure).

Link to comment
Share on other sites

Just tested it and took two identical screenshots, one with TGA one with DDS:

 

DDS: rgbddsxf3.th.jpg

 

TGA: rgbtgasu1.th.jpg

 

And I substracted the DDS shot from the TGA shot and this what comes out:

rgbddsminustgaqk6.th.jpg

 

Looks good. :)

Link to comment
Share on other sites

It sounds like this is well on it's way to being implemented (woot). I'm not sure if it's a matter of hours or weeks though, so a question - until it is fully implemented, is there currently a way to tell DR *not* to attempt to use DDRs at all? I don't know what if anything has changed recently (and fully expect to be called crazy for this) but suddenly I notice that textures I've used over the past months (e.g., masonry_brick_001) - in DR, without problem, in render mode - suddenly (I don't know 'as of when' exactly, but it worked when I was texturing my map with the new DR texture tools) have no/broken normals in DR. As soon as I delete the DDR files, they look fine again (because then DR goes to the TGAs instead).

 

Since updating SVN will keep giving me the DDS' back, this isn't really a great option though, so I'm wondering if I can tell DR to just not use DDS at all, for now. If on the other hand, this is working as fast as it looks like it is, nevermind! :laugh:

Link to comment
Share on other sites

At the moment I think I'm finished with the DDS stuff, as it seems to work. Regular use will show if there are any issues left. :)

 

It is theoretically possible to force DarkRadiant not to use DDS textures, but what's the point if Doom3 is loading the textures anyway?

Link to comment
Share on other sites

Right, it was just for the presumed interim. Now that I have SVN, I have all the DDS files (I used to delete/not get them on CVS), so I'm seeing this problem. Took me a while to figure that minor mystery out.

 

If your fixes for DDS support are already in and coming soon, then this isn't an issue (hoping it works for me, of course). ^_^

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 5 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...