Nice work, Cutedge. One thing: seeing as this is mineshaft, the problem may not be with the texture at all. I don't think the floor is supposed to be metal. The color of it, particularly the blotchiness, indicates either stone or concrete to me, which would make much more sense with either of the carved textures. I do like yours better though, in either case; the old one looked like somebody had gouged a bunch of stuff out of the wall with their fingernail.
...just seen this. Holy ****. Gorgeous. Nice work chaps.
Just a quick edit: The detail textures which would have most effect are probably ladders and railings - you often see them at extremely close range and they currently look really blurry in contrast.
I'm not sure if a detail texture applies to most ladders, since they are func_seethrough or whatever. I think the detailing only is applied to walls.
Yeah, it kinda sucks because the infestation texture that is usually applied on top of another texture ends up looking low res over the detailed texture. It's not too bad, but it's noticable.
I'm surprised so many people are still trying to figure out the math behind the 'detail' textures.
The actual math is very simple, actually. Each channel is treated seperately, so we can pretend the actual math is done on a greyscale image with a greyscale 'detail' texture, and do this for the red, green, and blue channels seperately.
Final = Base * Detail * 2
First off, this 'mode' doesn't require pixel shaders. It's a basic OpenGL texturing mode, and one that's not that hard to calculate the 'Detail' value for an arbitrary 'Base' and 'Final' value. Without getting into the math to reverse this formula, the final one you need is:
Detail = Final / (Base * 2)
Now, calculating 'Base' is pretty easy, assuming you're using a 1.0 scaling factor for the 'Detail' texture. Otherwise, you simply can't, really.
If people need/want actual source code to do this stuff from a high-res .TGA to a 'Detail' .TGA and a seperate '.BMP' for the 8-bit texture, I can do that. It's pretty simple stuff, really. Only thing the program would need to know is how much smaller the 'in game' texture was supposed to be, and it could take anything up to a 512x512 .tga easilly enough.
Anyways, hope the formula helps. And if you look at it, it should be fairly obvious that some 'Base' texels won't allow you to modify them very much, so dark colours will be fairly immune to full-range 'Detail' effects. And yes, you can use a 'detail' texture to add extra effects in a single channel. 128-128-128 will give the least modification from a math perspective, 127 and 129 are probably not noticable to most players either, and in fact anything between 120 and 136 are probably not visible except on 32-bit screen modes.
I <b>did</b> describe it using math instead of OpenGL language. Simple, high-school math in fact, with the assumption you were treating the individual colour values like any video card does, which, since some people appear to not understand, is ((A*B)/255) for texture multiplication. More generally, video cards assume textures are floating-point values in their math, more or less, that happen to be stored in an effecient and low-precision format of 0.0-1.0 in steps of 1/255 that we can read as individual bytes that are 0-255.
In OpenGL, the texturing mode is (GL_DST_COLOR,GL_SRC_COLOR) so you know what describing it in OpenGL language is.
The texture already in use is <b>BASE</b>, which has a red, green, and blue component. The detail texture will be <b>DETAIL</b> and has a red, green, and blue component as well. The final 'texture' you want will be <b>FINAL</b>, and obviously has three components.
Assuming you know <b>BASE</b> and <b>FINAL</b> for any pixel on <b>DETAIL</b>, you can calculate <b>DETAIL</b> from that information.
Specifically, to alleviate the problem with <b>BASE</b> being smaller, you have to calculate the 'scaled up' version of it the same way the video card would, blurring the pixels together as a 24-bit image, in a linear, wrap-around fashion. Simple steps in PhotoShop: Load <i><u>indexed</u></i> texture in, convert to RGB, scale up to match size of <b>DETAIL</b>/<b>FINAL</b> needed, save as <b>SCALED-UP BASE</b> texture.
Now, for each pixel of <b>DETAIL</b>, grab the associated pixels from <b>FINAL</b> and <b>SCALED-UP BASE</b> and calculate the following, all as integers, no floating point or anything else:
The colours indicate which channels of the image you need to pull the associated information from. As you had better be able to see, you treat each channel totally seperately.
If any of the values (red, green, or blue) end up greater than 255, keep them at 255, and realize this pixel won't make it all the way to the desired <b>FINAL</b> value.
A way to do this in Photoshop is to use three layers.
<b>BASE</b> layer set to <i>Divide</i>. Black layer set to <i>Normal</i> at 50% transparency. <b>FINAL</b> layer set to <i>Normal</i>.
In that order, top to bottom, on the layer list, flatten that and use it for your <b>DETAIL</b> texture.
Here, I'll give some examples of how to make a 'detail/normal' texture pair from a single high-resolution texture.
In this case, I'll start with a 512x256 texture from Enemy Territory, since it's the only thing I have handy that has detailed mechanical textures and is freely available for anyone to download, and I'm too lazy to go out to find an equivilant texture on the free texture sites. =^.^=
First off, the end-over-end of the texture we'll start with, the HL texture we'd end up with, and the final 'Detailed' texture we'll have at the end.
Now, how to do this? Well, unfortunately I'll have to explain how using <a href='http://www.gimp.org' target='_blank'>GIMP</a> as, since I use Linux, I don't have PhotoShop installed, and again, I'm lazy. I'm not going to go out of my way to get PhotoShop running just to make my menu options identical to yours. If someone out there can correct my terms, I'll update this post.
First off, load the 'Half Life' texture, which should be a 256-colour image. Now, tile it to three times as wide and tall. <b>Not scale, <i>tile</i> the image.</b> This is to guarantee that we get a 'tiled' blur around the edges. In this case, tile the half-life texture up to 384x192. Next, convert the tiled Half-Life texture to RGB. Now, scale it up 4x. I.E. In this case, you'd end up with an image that's 1536x768. Throw away the left, right, top, and bottom third of the image. In this case, crop down to the 512x256 box starting at (512,256) and ending at (1024,512).
You now have the 'blurry' upscaled Half-Life texture, with the blurring wrapped around the edges properly.
Next, load up the 'Original' texture. Now, add a new layer. Fill the new layer with black. Set the new layer to 50% opacity/transparency/whatever you want to call it. The goal is to make the 'Original' texture exactly half as bright. Now, copy-and-paste the 'blurry' texture to a new layer on top of all the other ones. Set the 'blurry' layer to <i>Divide</i>. Flatten the image.
You now have the <b>DETAIL</b> texture you wanted, as accurately as can be done in PhotoShop.
Oh, and just to point out the one 'failing' in the detail-texture trick to make high-res textures...
Look at the block of knobs on a black plate at the upper-middle of the textures. Look at the upper-right knob. Look at the gray <span style='color:gray'>(</span> along the left-hand edge of both of them. The bottom ('Detailed') version has a dark smudge in the middle of it, because the half-life texture was too dark in that area to brighten it up to match the desired 'final' texture accurately.
As a quick side-note, also. The 'tiling' step can be skipped, but may result in textures that have a visible seam between tilings. For mechanical plates or computer terminals or textures never meant to be used for 'seamless' tilings, like this control panel, that's fine.
But for floors, seamless walls, and similair, the 'tiling, scale, crop' part is very much required.
Relax, I asked for a definition of texture multiply nothing else, that's not even high school math, that's like 6th grade math, stop insulting me <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html//emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->. And it appears I've allready allmost correctly guessed how detail textures work earlier in this thread with an error of at most 1 in each colour component at the high end. Surprised you didn't spot it.
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->i.e. z = x*y/127 where z is the final colour(disregarding the light map) x is the texture colour and y the detail texture colour. <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
This is an adequate description and with your correction we have z=x*y/127.5 instead which means there is no neutral colour(127.5 would allways be neutral).
The difference is a scholarly one at best, I suppose. And I did spot it, but I started making the posts to explain because so many later posts seemed to be complaining about 'not knowing quite how they work right' and so-forth.
I'm going to see about making a proper tool that'll take a high-res texture, and spit back a Half-Life .wad file and an attached .tga Detail file and appropriate line to add to the right .txt file, as a web-tool so folks don't need to worry about what OS they're running on. And since I don't have a decent Windows compiler suite set up. =^.^=
Unfortunately, I don't have Half-Life installed right now. Another reason I used an Enemy Territory texture.
Also, my 'technique' won't work unless I have a high-resolution version of a texture to start from. It's useless for 'building up' a detail-texture from an existing texture. It needs to start with the high-resolution version. Preferably around 4x the resolution of the original, so a 64x64 texture would start 256x256 to make a good 'Detail/Normal' pair. More of a difference in size than that, and the smaller texture has problems with details, less and the detail texture is a bit of a waste of time/space.
A quick example using one of the 'stamped sheet metal' <a href='http://www.planetquake.com/hfx' target='_blank'>HFX</a> released ages back though, to show it works just as well there.
This one's abbreviated. Original texture on the left (which was grayscale), final version on the right, half-size version the texture was turned into in the middle. It works just fine, but stamped-sheet-metal floors like that should almost <b>start</b> as a detail texture, perhaps from a roughly-grained noise pattern, as that's all they look like if you try to reduce them far at all.
If someone can get me a high-res source for the floor_diamonds though, or any other texture, it's very trivial for me to crank out the detail/normal pair. It's just turning out to be akward to do via a web-interface, so a web-page-version will be a while in coming. =-.-=
<!--QuoteBegin-007Bistromath+Apr 17 2004, 03:17 AM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (007Bistromath @ Apr 17 2004, 03:17 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> WolfWings: can you show us a floor_diamond using your technique? That seems to be the one nobody can get quite right. <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd--> Not to sound egotistical, but I proposed the idea first <!--emo&:(--><img src='http://www.unknownworlds.com/forums/html//emoticons/sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /><!--endemo--> I'm just a bit sad that the "project" so to speak has been taken out of my hands.
Though I must admit my goal was to simulate 24-bit colour depth rather than higher res textures, but the same technique can be applied to the higher res textures as Soylent pointed out a few pages back. I had planned to write the program in c#, and use one of the built-in interpolation methods available to handle the res change.
Ah, simulating 24-bit textures is quite possible, and actually a lot easier. Same math, different result. But just adding more colours to most textures won't improve the graphical quality noticably, as they're not large enough to be able to need more than 256 colours to get within 1-3% accuracy.
And I wasn't trying to 'steal' anything from you, Guspaz. I just saw confusion about the actual math behind the 'detail textures' and thought I'd explain it. I never intended to steal anyone's thunder, I just saw no reason to make a single-platform program to convert the textures when I could make a web-based one that anyone could simply go to and use.
You're more than welcome to make your tool. For some folks, I'm sure it will be easier. My tool was to be intended only for those that didn't want to install any software to make the texture-combo's. To be honest, making a unified 'detail/.wad editor' would likely be much more useful to everyone, so your program will be more useful long term. But it's quick to bash together a useful image-processing script on my web page and let folks use that until your downloadable tool is finished.
Also, a quick recommendation for you, Guspaz. Don't worry about using the highest-quality rescaling method for the downscaling I describe above. Simple linear average-and-downscale will work just as well as Lanczos in most cases, since you'll have to reduce it to 256 colours anyways.
For the upscale, <b>make sure it is a tiling scale effect</b> otherwise you'll end up with odd artifacts along the borders. I can't over-emphasize that enough. And make sure one of the center-point four pixels of the upscale is the same value as the original 'downscaled' 256-colour Half-Life texture, otherwise the detail texture can be ever-so-slightly out of phase with the Half-Life texture in-game, ruining the effect as well.
I.E. If you only scale the Half-Life texture to half the size of the original texture, no problems. But if you downscale it to a quarter of the size of the original texture, make sure the Half-Life texture is offset to start on, in the quarter-scale case, one of the 2x2 pixel blocks in the middle, not on the outer 'rim' of the 4x4 pixel area each pixel will become. That may sound complicated, but it just means do the rescale in a way that tiles the blurring around the edges, and then offset the texture by 1/2 the scaling factor. So at 4x, offset it by 2 pixels, at 8x, offset by 4 pixels, and at 2x, offset by only 1 pixel on both the X and Y.
Actually I hadn't planned on integrating WAD support. I haven't seen any detail texture packs yet that use WAD files, so I was simply going to spit out TGA files. Though I guess, if it's supported and desired I might end up doing it, though I have no knowledge of the WAD file format (I'm sure it's documented somewhere).
The idea was to support bulk conversions, to do an entire map in short order. Of course, maps tend to store all their textures in WAD files... I might have to extract them I suppose.
Speaking of downscaling, I'm not sure where that comes in. We take the original texture and upscale it, and then produce the output... where am I supposed to be downscaling?
Unless there are any hitches, I should have a prototype version that does one texture at a time up sometime today.
EDIT: Damn, it's so hard to find an image to work on while poking around in my pictures folder <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo--> I'll have to photoshop up a texture that mimmicks a highres/halflife pair.
This may be a bit of a sin talking about CS here but I'm starting work on making detail textures for it (if anyone knows if they already exist point me to them would be great).
Anyway I've been using the ns ones as starting point (ill recreate new textures later, I just want to get them loading correctly first) anyway I've started with de_dust and managed to get the sand with a detail texture and the blank walls, however all the other textures just stay as their ordinary self. (it appears to work for these textures, -0Sand, -1Sand, -2Sand, -3Sand, -0csSandWall, and -1csSandWall
I've played a little with detail textures for CS(not that I have any intention of making a full package). In many ways it's simpler because there is a lot of wood, stone, sand and concrete which are easy to texture.
I made a few fainter versions of the stone version I had in the NS pack and tried that at different scales(on dust as well <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html//emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->) and I made a texture out of the 4 randomtiling sand textures and tried that but it was ugly...
Can't say that I see something wrong with that file, it looks OK more likely it's the placement of one of your .tga's that is wrong or it is not namned the same as the entry in the detail texture list file. You might have one of your detail textures in 8 bit colour mode(e.g. grayscale) because you forgot to convert it back to 24 BPP when you where making it or working with it. It's also possible, if like me you are clumsy, that you have notepad open and you are saving your detail texture list to the wrong folder without thinking of it and therefor not overwriting the file you wanted to. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo-->
Everytime I've had a problem with getting detail textures to work I opened the console and enabled developer 1, then restarted the map. If there was a problem it would usually be explained in the console with an error message.
<!--QuoteBegin-Jabba The Hunt+Apr 18 2004, 01:42 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Jabba The Hunt @ Apr 18 2004, 01:42 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> This may be a bit of a sin talking about CS here but I'm starting work on making detail textures for it (if anyone knows if they already exist point me to them would be great). <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd--> /me points Jabba to CS:CZ <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo-->
seriously, have you guys checked how the official guys do it?
Yeah I would love to get cs:cz but hmm let me think get a computer game or have £20 less debt when i get out of uni? <!--emo&:)--><img src='http://www.natural-selection.org/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->
I've gone and resaved all the targa files as 24bit that didnt work. Cant be the naming of the targa files as the stone one works on some walls but not on others, and i've checked and rechecked the names of the textures.
One thing I was thinking it could be was my rendering mode "Detail textures don't appear correctly when additive rendermodes are used, but do appear properly when solid rendermodes are used" (found at <a href='http://collective.valve-erc.com/index.php?doc=1076548934-94242500)' target='_blank'>http://collective.valve-erc.com/index.php?...48934-94242500)</a> Where do I find that out from?
A quick update on my progress. This is taking a lot longer than I expected due to two problems:
1) Image format support in C# (or lack of it) 2) Figuring out how to do image processing in C#
I've gotten past number 2, and number 1 I intend to solve having the application use ImageMagick to convert formats around. Yes, it's a bit of a kludge, but you have to be able to support any format anyhow for the high-res version of the texture; who knows what the artist saved it in. This will make the size of my app ~5MB, but who cares if it works.
I've gotten it generating the detail texture, and when I make it simulate the OpenGL texture multiply, it seems to work fine. I'm not sure if the edges of the upscale are good, I'll test in game to see.
Next steps are saving of files, and then testing in game, and I'll have a working prototype to show.
EDIT: Keep in mind with compression (UPX, and ZIP, or RAR), this will probably be a distribution size of 2MB or so.
Jabba The Hunt when I tried detail textures worked straight forward on all dust textures. Are you getting an error message in the console(might need developer 1)?
Addative rendering makes things look like they are translucent and glowing, there's nothing like that in dust.
Yeah i've tried developer one and I dont seem to get any error messages. Kinda strange really, ah well im sure I'll sort it all out, unless you could send me your de_dust_detail.txt file? might help me see whats gone wrong?
Thanx for the suggestions <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->
Comments
Just a quick edit:
The detail textures which would have most effect are probably ladders and railings - you often see them at extremely close range and they currently look really blurry in contrast.
Yeah, it kinda sucks because the infestation texture that is usually applied on top of another texture ends up looking low res over the detailed texture. It's not too bad, but it's noticable.
The actual math is very simple, actually. Each channel is treated seperately, so we can pretend the actual math is done on a greyscale image with a greyscale 'detail' texture, and do this for the red, green, and blue channels seperately.
Final = Base * Detail * 2
First off, this 'mode' doesn't require pixel shaders. It's a basic OpenGL texturing mode, and one that's not that hard to calculate the 'Detail' value for an arbitrary 'Base' and 'Final' value. Without getting into the math to reverse this formula, the final one you need is:
Detail = Final / (Base * 2)
Now, calculating 'Base' is pretty easy, assuming you're using a 1.0 scaling factor for the 'Detail' texture. Otherwise, you simply can't, really.
If people need/want actual source code to do this stuff from a high-res .TGA to a 'Detail' .TGA and a seperate '.BMP' for the 8-bit texture, I can do that. It's pretty simple stuff, really. Only thing the program would need to know is how much smaller the 'in game' texture was supposed to be, and it could take anything up to a 512x512 .tga easilly enough.
Anyways, hope the formula helps. And if you look at it, it should be fairly obvious that some 'Base' texels won't allow you to modify them very much, so dark colours will be fairly immune to full-range 'Detail' effects. And yes, you can use a 'detail' texture to add extra effects in a single channel. 128-128-128 will give the least modification from a math perspective, 127 and 129 are probably not noticable to most players either, and in fact anything between 120 and 136 are probably not visible except on 32-bit screen modes.
In OpenGL, the texturing mode is (GL_DST_COLOR,GL_SRC_COLOR) so you know what describing it in OpenGL language is.
The texture already in use is <b>BASE</b>, which has a red, green, and blue component.
The detail texture will be <b>DETAIL</b> and has a red, green, and blue component as well.
The final 'texture' you want will be <b>FINAL</b>, and obviously has three components.
Assuming you know <b>BASE</b> and <b>FINAL</b> for any pixel on <b>DETAIL</b>, you can calculate <b>DETAIL</b> from that information.
Specifically, to alleviate the problem with <b>BASE</b> being smaller, you have to calculate the 'scaled up' version of it the same way the video card would, blurring the pixels together as a 24-bit image, in a linear, wrap-around fashion. Simple steps in PhotoShop: Load <i><u>indexed</u></i> texture in, convert to RGB, scale up to match size of <b>DETAIL</b>/<b>FINAL</b> needed, save as <b>SCALED-UP BASE</b> texture.
Now, for each pixel of <b>DETAIL</b>, grab the associated pixels from <b>FINAL</b> and <b>SCALED-UP BASE</b> and calculate the following, all as integers, no floating point or anything else:
<b><span style='color:red'>DETAIL</span></b> = ( ( <b><span style='color:red'>FINAL</span></b> * 256 ) / ( <b><span style='color:red'>SCALED-UP BASE</span></b> * 2 ) )
<b><span style='color:green'>DETAIL</span></b> = ( ( <b><span style='color:green'>FINAL</span></b> * 256 ) / ( <b><span style='color:green'>SCALED-UP BASE</span></b> * 2 ) )
<b><span style='color:blue'>DETAIL</span></b> = ( ( <b><span style='color:blue'>FINAL</span></b> * 256) / ( <b><span style='color:blue'>SCALED-UP BASE</span></b> * 2 ) )
The colours indicate which channels of the image you need to pull the associated information from. As you had better be able to see, you treat each channel totally seperately.
If any of the values (red, green, or blue) end up greater than 255, keep them at 255, and realize this pixel won't make it all the way to the desired <b>FINAL</b> value.
A way to do this in Photoshop is to use three layers.
<b>BASE</b> layer set to <i>Divide</i>.
Black layer set to <i>Normal</i> at 50% transparency.
<b>FINAL</b> layer set to <i>Normal</i>.
In that order, top to bottom, on the layer list, flatten that and use it for your <b>DETAIL</b> texture.
In this case, I'll start with a 512x256 texture from Enemy Territory, since it's the only thing I have handy that has detailed mechanical textures and is freely available for anyone to download, and I'm too lazy to go out to find an equivilant texture on the free texture sites. =^.^=
First off, the end-over-end of the texture we'll start with, the HL texture we'd end up with, and the final 'Detailed' texture we'll have at the end.
First off, load the 'Half Life' texture, which should be a 256-colour image.
Now, tile it to three times as wide and tall. <b>Not scale, <i>tile</i> the image.</b> This is to guarantee that we get a 'tiled' blur around the edges. In this case, tile the half-life texture up to 384x192.
Next, convert the tiled Half-Life texture to RGB.
Now, scale it up 4x. I.E. In this case, you'd end up with an image that's 1536x768.
Throw away the left, right, top, and bottom third of the image. In this case, crop down to the 512x256 box starting at (512,256) and ending at (1024,512).
You now have the 'blurry' upscaled Half-Life texture, with the blurring wrapped around the edges properly.
Next, load up the 'Original' texture.
Now, add a new layer.
Fill the new layer with black.
Set the new layer to 50% opacity/transparency/whatever you want to call it. The goal is to make the 'Original' texture exactly half as bright.
Now, copy-and-paste the 'blurry' texture to a new layer on top of all the other ones.
Set the 'blurry' layer to <i>Divide</i>.
Flatten the image.
You now have the <b>DETAIL</b> texture you wanted, as accurately as can be done in PhotoShop.
Look at the block of knobs on a black plate at the upper-middle of the textures.
Look at the upper-right knob.
Look at the gray <span style='color:gray'>(</span> along the left-hand edge of both of them.
The bottom ('Detailed') version has a dark smudge in the middle of it, because the half-life texture was too dark in that area to brighten it up to match the desired 'final' texture accurately.
But for floors, seamless walls, and similair, the 'tiling, scale, crop' part is very much required.
<!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->i.e. z = x*y/127 where z is the final colour(disregarding the light map) x is the texture colour and y the detail texture colour.
<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
This is an adequate description and with your correction we have z=x*y/127.5 instead which means there is no neutral colour(127.5 would allways be neutral).
I'm going to see about making a proper tool that'll take a high-res texture, and spit back a Half-Life .wad file and an attached .tga Detail file and appropriate line to add to the right .txt file, as a web-tool so folks don't need to worry about what OS they're running on. And since I don't have a decent Windows compiler suite set up. =^.^=
Also, my 'technique' won't work unless I have a high-resolution version of a texture to start from. It's useless for 'building up' a detail-texture from an existing texture. It needs to start with the high-resolution version. Preferably around 4x the resolution of the original, so a 64x64 texture would start 256x256 to make a good 'Detail/Normal' pair. More of a difference in size than that, and the smaller texture has problems with details, less and the detail texture is a bit of a waste of time/space.
A quick example using one of the 'stamped sheet metal' <a href='http://www.planetquake.com/hfx' target='_blank'>HFX</a> released ages back though, to show it works just as well there.
This one's abbreviated. Original texture on the left (which was grayscale), final version on the right, half-size version the texture was turned into in the middle. It works just fine, but stamped-sheet-metal floors like that should almost <b>start</b> as a detail texture, perhaps from a roughly-grained noise pattern, as that's all they look like if you try to reduce them far at all.
If someone can get me a high-res source for the floor_diamonds though, or any other texture, it's very trivial for me to crank out the detail/normal pair. It's just turning out to be akward to do via a web-interface, so a web-page-version will be a while in coming. =-.-=
<!--emo&:0--><img src='http://www.unknownworlds.com/forums/html//emoticons/wow.gif' border='0' style='vertical-align:middle' alt='wow.gif' /><!--endemo-->
You poor, unfortunate child. Come, let us bring you back into the light!
<!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo-->
Not to sound egotistical, but I proposed the idea first <!--emo&:(--><img src='http://www.unknownworlds.com/forums/html//emoticons/sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /><!--endemo--> I'm just a bit sad that the "project" so to speak has been taken out of my hands.
Though I must admit my goal was to simulate 24-bit colour depth rather than higher res textures, but the same technique can be applied to the higher res textures as Soylent pointed out a few pages back. I had planned to write the program in c#, and use one of the built-in interpolation methods available to handle the res change.
And I wasn't trying to 'steal' anything from you, Guspaz. I just saw confusion about the actual math behind the 'detail textures' and thought I'd explain it. I never intended to steal anyone's thunder, I just saw no reason to make a single-platform program to convert the textures when I could make a web-based one that anyone could simply go to and use.
You're more than welcome to make your tool. For some folks, I'm sure it will be easier. My tool was to be intended only for those that didn't want to install any software to make the texture-combo's. To be honest, making a unified 'detail/.wad editor' would likely be much more useful to everyone, so your program will be more useful long term. But it's quick to bash together a useful image-processing script on my web page and let folks use that until your downloadable tool is finished.
For the upscale, <b>make sure it is a tiling scale effect</b> otherwise you'll end up with odd artifacts along the borders. I can't over-emphasize that enough. And make sure one of the center-point four pixels of the upscale is the same value as the original 'downscaled' 256-colour Half-Life texture, otherwise the detail texture can be ever-so-slightly out of phase with the Half-Life texture in-game, ruining the effect as well.
I.E. If you only scale the Half-Life texture to half the size of the original texture, no problems. But if you downscale it to a quarter of the size of the original texture, make sure the Half-Life texture is offset to start on, in the quarter-scale case, one of the 2x2 pixel blocks in the middle, not on the outer 'rim' of the 4x4 pixel area each pixel will become. That may sound complicated, but it just means do the rescale in a way that tiles the blurring around the edges, and then offset the texture by 1/2 the scaling factor. So at 4x, offset it by 2 pixels, at 8x, offset by 4 pixels, and at 2x, offset by only 1 pixel on both the X and Y.
The idea was to support bulk conversions, to do an entire map in short order. Of course, maps tend to store all their textures in WAD files... I might have to extract them I suppose.
Speaking of downscaling, I'm not sure where that comes in. We take the original texture and upscale it, and then produce the output... where am I supposed to be downscaling?
Unless there are any hitches, I should have a prototype version that does one texture at a time up sometime today.
EDIT: Damn, it's so hard to find an image to work on while poking around in my pictures folder <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo--> I'll have to photoshop up a texture that mimmicks a highres/halflife pair.
Anyway I've been using the ns ones as starting point (ill recreate new textures later, I just want to get them loading correctly first) anyway I've started with de_dust and managed to get the sand with a detail texture and the blank walls, however all the other textures just stay as their ordinary self. (it appears to work for these textures, -0Sand, -1Sand, -2Sand, -3Sand, -0csSandWall, and -1csSandWall
Heres my file, any idea what im doing wrong?
-0Sand detail/stone 5 5
-1Sand detail/stone 5 5
-2Sand detail/stone 5 5
-3Sand detail/stone 5 5
-SandCCrete detail/concrete1 5 5
-0csSandWall detail/stone 4 4
-1csSandWall detail/stone 4 4
-SandWllWndw detail/stone 4 4
-SandWllWndw2 detail/stone 4 4
-SandWllWndw3 detail/stone 4 4
-CsSandWall2 detail/stone 4 4
-SandTrim detail/dustborder 5 5
-SandCrtLrgSd detail/wood 5 5
-SandCrtLrgTp detail/wood 5 5
-SandCrtSmSd detail/wood 5 5
-SandCrtSmTp detail/wood 5 5
-MltryCrteSd detail/wood 5 5
-MltryCrteTp detail/wood 5 5
-MltryCrteSd2 detail/wood 5 5
I made a few fainter versions of the stone version I had in the NS pack and tried that at different scales(on dust as well <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html//emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->) and I made a texture out of the 4 randomtiling sand textures and tried that but it was ugly...
Can't say that I see something wrong with that file, it looks OK more likely it's the placement of one of your .tga's that is wrong or it is not namned the same as the entry in the detail texture list file. You might have one of your detail textures in 8 bit colour mode(e.g. grayscale) because you forgot to convert it back to 24 BPP when you where making it or working with it. It's also possible, if like me you are clumsy, that you have notepad open and you are saving your detail texture list to the wrong folder without thinking of it and therefor not overwriting the file you wanted to. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo-->
Everytime I've had a problem with getting detail textures to work I opened the console and enabled developer 1, then restarted the map. If there was a problem it would usually be explained in the console with an error message.
/me points Jabba to CS:CZ <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo-->
seriously, have you guys checked how the official guys do it?
Guess I've heard wrong, it does look pretty nice in the screen shots.
I've gone and resaved all the targa files as 24bit that didnt work. Cant be the naming of the targa files as the stone one works on some walls but not on others, and i've checked and rechecked the names of the textures.
One thing I was thinking it could be was my rendering mode "Detail textures don't appear correctly when additive rendermodes are used, but do appear properly when solid rendermodes are used" (found at <a href='http://collective.valve-erc.com/index.php?doc=1076548934-94242500)' target='_blank'>http://collective.valve-erc.com/index.php?...48934-94242500)</a> Where do I find that out from?
1) Image format support in C# (or lack of it)
2) Figuring out how to do image processing in C#
I've gotten past number 2, and number 1 I intend to solve having the application use ImageMagick to convert formats around. Yes, it's a bit of a kludge, but you have to be able to support any format anyhow for the high-res version of the texture; who knows what the artist saved it in. This will make the size of my app ~5MB, but who cares if it works.
I've gotten it generating the detail texture, and when I make it simulate the OpenGL texture multiply, it seems to work fine. I'm not sure if the edges of the upscale are good, I'll test in game to see.
Next steps are saving of files, and then testing in game, and I'll have a working prototype to show.
EDIT: Keep in mind with compression (UPX, and ZIP, or RAR), this will probably be a distribution size of 2MB or so.
Addative rendering makes things look like they are translucent and glowing, there's nothing like that in dust.
Thanx for the suggestions <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->