Hard Light Productions Forums

Community Projects => The FreeSpace Upgrade Project => Topic started by: ARSPR on May 29, 2006, 01:44:37 pm

Title: -shine, -glow, envmapping and alpha channel
Post by: ARSPR on May 29, 2006, 01:44:37 pm
Well I'm trying to fix HTL Triton alpha envmapping (within 3.6.8. zeta) but there's actually a lot of things I don't understand. So please, can anyone check my statements or answer my dudes?


Thank you in advance
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Wanderer on May 29, 2006, 03:31:30 pm
FSwiki..... (http://www.hard-light.net/wiki/index.php/Texturing)

If you are using alpha env then game uses the alpha of the shinemaps for envmapping. Extra textures are usually used by other levels-of-details (LODs) especially when named that way.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Flipside on May 29, 2006, 03:57:03 pm
Oddly enough, I only updated that a few days ago :D Thanks to whoever added the -trans definition as well, forgot that one.

I'm working my way through the modding section, I'm going to try and explain Hierarchies and PCS/Modelview in a way that'll make it easier for new modders to get their ships working :)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: ARSPR on May 29, 2006, 04:23:53 pm
FSwiki..... (http://www.hard-light.net/wiki/index.php/Texturing)

If you are using alpha env then game uses the alpha of the shinemaps for envmapping. Extra textures are usually used by other levels-of-details (LODs) especially when named that way.

BEATING MYSELF WITH A CLUB (I'm always saying 'look in the wiki or Karajorma's FAQ') :headz:

Tomorrow I will make my next try...

Just one thing, are Triton_HTL1_b and Triton_HTL1_c useless? Does the _b or _c endings have any 'special' meaning as -glow or -shine?

Thank you

Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on May 29, 2006, 04:32:55 pm
As already said, the alpha of the specmaps is used for envmaps.  But unless that specmap is actually using alpha transparency then it should have NO alpha channel.  Save the file as DXT1c (with no alpha) and then it should work better.  The code only checks that a texture has an alpha channel when using -alpha_env, not whether it makes full use of that alpha channel.  The only way to make it work right is to use full alpha transparency provided by the alpha channel, or not have an alpha channel at all.  The code isn't smart enough (without being a billion times slower) to figure it out otherwise.

And the _b/_c stuff is usually the LODed textures.  If you UV map it against only _a (and use mipmaps instead) then you should be able to get rid of them.  Basically, if they aren't referenced in the POF then they aren't used.  Only -glow, -shine, -trans, and -bump (in the future) are special since they aren't referenced in the POFs but loaded by the game itself.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Turambar on May 29, 2006, 04:37:40 pm
im waiting for the ptah to release my big fix of all of the maps.

i find that my various texture improvements are accepted much better when they are accompanied by a high-polygon model.

unfortunately, unknown target has disappeared
and micropsycho too (for the dragon)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Flipside on May 29, 2006, 04:47:42 pm
Thanks for the info Taylor, I've updated the Wiki to reflect what you said about Shine-maps.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on May 29, 2006, 05:30:05 pm
im waiting for the ptah to release my big fix of all of the maps.

i find that my various texture improvements are accepted much better when they are accompanied by a high-polygon model.
Just don't wait too long.  Some of us would be just as happy with fixed maps as with a new model. :)

There will probably be a new MediaVP set before long since there is a backlog of missing/broken things.  There is a new feature for effects which is disabled by default now since it breaks with the current MediaVPs, for instance.  Just be sure to make sure DaBrain knows about the new maps when they are ready since he is the man in charge of the MediaVPs now.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Turambar on May 29, 2006, 09:49:43 pm
ah, unknown target has just returned from his mysterious disappearance

won't be too long now.

the reason that i'm waiting is because the envmap on the ptah currently is borked, you can tell on the cockpit window that its all shifted down on the model for some reason. 
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Vasudan Admiral on May 29, 2006, 09:54:24 pm
Wow - all my ships excluding the Fenris are now flying mirrors, which is awesome......and weird,........and awesome.

I'll go through my HTL stuff now and update it to take full advantage of env mapping and Taylor's guide. :)
Has anyone already done/started anything for any of them? Ie, going over the map and 'properly' giving it env mapping that could save me time?

BTW, since I will have all the source files out, should I make some bump maps up too?

i find that my various texture improvements are accepted much better when they are accompanied by a high-polygon model.
Just don't wait too long.  Some of us would be just as happy with fixed maps as with a new model. :)
There's that and the fact that new maps might inspire peeps to make a HTL model in the first place. ;)
*doesn't mention the word 'poseidon'*
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on May 29, 2006, 10:43:07 pm
BTW, since I will have all the source files out, should I make some bump maps up too?
Up to you.  The code has been updated to actually load and use the maps properly now, but it still can't do anything with them after that.  The rendering code needs to be updated first and I don't know when that's going to happen.  Could be a while.

Having some ready to use maps would greatly encourage the code work to happen though.  Not having anything to test with makes it take much longer to get the code working properly.  I don't really have to the time to work on any new features (other than what I've already got on my plate) but if you do maps for one or two ships then I might be able to find a couple hours here and there to hack on it. :)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Vasudan Admiral on May 29, 2006, 10:44:59 pm
Now _that_ would be awesome. :D

*scurries away to do some bump mapping*
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Flipside on May 29, 2006, 10:45:10 pm
Are we talking 256-colour displacement maps or normal maps here?
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on May 29, 2006, 10:58:34 pm
Are we talking 256-colour displacement maps or normal maps here?
Normal maps.

EDIT: Or whatever you guys would prefer I guess. :)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Flipside on May 29, 2006, 11:09:39 pm
I think normal maps would be better, they have a slight disadvantage of being slightly harder to produce (but then, if you can make displacement maps, you can make normals using the NVidia plugin). And, I believe, give a better effect, though my actual understanding of the difference is pretty limited.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: ARSPR on May 30, 2006, 01:48:51 am
Hey thank you to all of you. I'm learning a lot so I think even if it's going to be a full 'official' patch I'm going to play a little trying to fix Triton or giving it different env-mapping qualities...

Thanks for the info Taylor, I've updated the Wiki to reflect what you said about Shine-maps.

I'm at work and Wiki needs a login now (I didn't have to before...) so I'm not going to open a count just now.

There's a little mistake in Texturing > SCP Team Recommendations. So if someone wants to correct it:

Other alternatives to TGA -- in cases where DXT compression is unacceptable (noticable errors/artifacts) -- are u888, u8888, or u1555. u888 is 24 bit color and u8888 is 32 bit color (24 bit plus 8 bit alpha map), just like the types of TGA. The file doesn't get any smaller than TGA, but it can now have mipmaps (see Models). u1555 is 15-bit color, usually best for files that used to be PCX.

So there's a missing 8 and I also think that DDS are smaller than TGAs because they're compressed (or they can be bigger but because of mipmaps...)

And now just one question. If you open a JPG, modify it and then save it again, and you keep doing this, (even without modifying), you loose quality because in each saving step the file is lossly recompressed. So, is it the same with DDS compressed format?

I ask this because if it is true, I think it could be a good idea for all the modders to distribute 'SDK' uncompressed TGAs of their textures to help people who might want to modify them. In this way you could make a zip with a data folder structure or just a MyHTLSuperModel.vp containing DDS mipmapped textures and POF for playing and a SDK folder with the uncompressed TGAs textures. Even if nooby people, as myself, just unzip this archive within Freespace folders they will waste HD space but their game performance won't suffer as FSOpen does not use SDK folder in any way.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on May 30, 2006, 02:15:21 am
So there's a missing 8 and I also think that DDS are smaller than TGAs because they're compressed (or they can be bigger but because of mipmaps...)
DDS doesn't mean compressed so it doesn't automatically mean that it's smaller.  DXT (DXT1, DXT3, DXT5) are the compressed versions of DDS (same file and extension, but different image format).  Those will be anywhere from 4 to 8 times smaller than a 32-bit TGA version of the same image.  Uncompressed DDS (the u???? stuff) will be the same size as a TGA (as image formats go they are almost identical data wise).  Mipmaps will add approximately 30% to the original file size of a DDS (whether it's compressed or not).

I make use of both compressed and uncompressed DDS since some effects just don't look very good with the compression artifacts.  Using uncompressed DDS for them lets me still have mipmaps, but not have to lose any image quality.

And now just one question. If you open a JPG, modify it and then save it again, and you keep doing this, (even without modifying), you loose quality because in each saving step the file is lossly recompressed. So, is it the same with DDS compressed format?
Correct, if it's actually a compressed DDS (DXT).  DDS can be uncompressed too and so would not sacrifice any quality by saving them over and over again.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: ARSPR on May 30, 2006, 04:38:13 am
Thank you, Taylor  :yes:

So in this case, and if the modder wants to fully share his/her work, I think it could be a good idea to distribute new model add-ons with the data/vp playable structure, (using compressed textures if possible), AND the 'SDK' folder with the uncompressed textures and even raw 3D models (TrueSpace files, 3dmax or whatever).

In this way, as I've said before, if people are not careful or do not understand what they're unzipping they will just waste HDD space but without affecting the game, (but nowadays people usually have HUGE HDDs).
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Flipside on May 30, 2006, 07:49:12 am
Thanks for the info Taylor, I'll alter the modding side of the Wiki to reflect that as well.. Now I've finally got Truespace working on my machine again, I should hopefully be able to do more about that side of things in the next week or so :)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: bkd86 on May 30, 2006, 01:50:48 pm
I think normal maps would be better, they have a slight disadvantage of being slightly harder to produce (but then, if you can make displacement maps, you can make normals using the NVidia plugin). And, I believe, give a better effect, though my actual understanding of the difference is pretty limited.

Normal maps can be produced several different ways depending on the program used and the modeler's/texturer's familiarity/skill. Most game engines don't use displacement maps, rather bump maps or normal maps. Displacement maps are usually used for rendering programs such as maya and 3dsmax to keep the poly counts low.

The best ways here to do this would be with a pluggin (ATI or nvidia) or do a high poly version of the base mesh and project it onto it for the normal map (can get the best results, but you have to really know what your doing).

The third option is to use Zbrush. This wouldn't work very well for the federation ships, but may work really well for the Shivan. As long as the model has a UV map already, they can be produced pretty fast. The HL2 mod I'm working on has used all the above to great effect, especially the zbrushed normal maps on organic models.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: bkd86 on May 30, 2006, 01:57:21 pm
Sorry for the double post, but I did this in 1.5 hours normal mapped and textured in zbrush, (rocks for cliff face).

(http://img145.imageshack.us/img145/4933/pic14rz.th.jpg) (http://img145.imageshack.us/my.php?image=pic14rz.jpg)
(http://img112.imageshack.us/img112/2602/stoutdoors1yp.th.jpg) (http://img112.imageshack.us/my.php?image=stoutdoors1yp.jpg)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Flipside on May 30, 2006, 02:01:38 pm
ZBrush looks pretty good, I use Deep Paint 3D which is pretty similar for my stuff. I can produce normals either way really, but the 'proper' way is pretty labour intensive, I can actually convert the bump map into anything up to a 16 million polygon model and then yank normals, but the process takes a fair while, so I'll probs stick to the 'cheaper' way of doing it :)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Vasudan Admiral on May 31, 2006, 09:37:22 am
Well, the Aeolus has been done - bumpmap, envmap, fewer textures and more texture format optimisations. However, I seem to be encountering problems in exporting DDS's with an alpha map. Most of the things I've tried result in the env map 'hiding' much of the shine map - as in, it's not stored as an alpha map, which results in this in-game:
(http://sectorfiles.net/ti-file-dump/VasudanAdmiral/Pics/EnvWashout.png)
(basically - the export to dds turned the shinemap mostly white with some splotchy exceptions as seen above)
And just when I think I've set the file up correctly, I get a "Unsupported input format" message from the DDS plugin.

So my question is, how exactly do you go about properly exporting an alpha mapped DDS? (photoshop or preferably PSP)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Turambar on May 31, 2006, 10:10:48 am
oh, i'd already taken care of aeolus, no problems...
refer to my thread: New Feature Demands New Textures
for my list of what has and hasnt been fixed
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on May 31, 2006, 10:31:53 am
So my question is, how exactly do you go about properly exporting an alpha mapped DDS? (photoshop or preferably PSP)
What DDS format are you saving in?  With true alpha you need to be using DXT5 only.  DXT3 has alpha support but it's only 4-bit and that's probably not enough for this purpose.  DXT1 doesn't have alpha (as far as the game is concerned anyway).
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Colonol Dekker on May 31, 2006, 10:36:08 am
Env Mapping, = Reflective surfaces?
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: ARSPR on May 31, 2006, 10:40:04 am
Yesterday I played for a while with Triton main shinemap (Triton_HTL1-shine.DDS) and what I did (with Photoshop) was just the following steps (sorry if I post very obvious ones):


I hope this info can be useful for you. Does FSOpen support bumpmaps?

Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on May 31, 2006, 10:53:27 am
I can't remember how Photoshop handles this (been a few years since I've used anything but GIMP), but you need to only have RGB channels, no alpha channel, when saving DXT1.  That way you make sure not to get the white/black alpha channel in there.  Remember that DXT1 does support 1-bit alpha so it can have a basic alpha channel.  The game doesn't use this properly though so you have to make sure that it's only RGB before saving to DXT1.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: ARSPR on May 31, 2006, 11:02:18 am
I
I can't remember how Photoshop handles this (been a few years since I've used anything but GIMP), but you need to only have RGB channels, no alpha channel, when saving DXT1.  That way you make sure not to get the white/black alpha channel in there.  Remember that DXT1 does support 1-bit alpha so it can have a basic alpha channel.  The game doesn't use this properly though so you have to make sure that it's only RGB before saving to DXT1.

It doesn't matter. If I use DXT1 (RGB or ARGB) I always get the alpha even if there's no alpha channel in the drawing I'm saving.

OTOH, I've turned off envmapping, (just to avoid mixing effects), and at least Triton and Aeolus (unmodified 3.6.8. zeta versions) have a huge differences in spec brights between LOD0 and LOD1. But other models do not show that differences.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Flipside on May 31, 2006, 12:48:03 pm
Does DXT MipMap the Alpha channels as well as the colour channels? Also, does the Engine auto-mipmap? Does that mipmap both the colour and alpha channels?
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on May 31, 2006, 01:08:37 pm
Does DXT MipMap the Alpha channels as well as the colour channels? Also, does the Engine auto-mipmap? Does that mipmap both the colour and alpha channels?
It doesn't distinguish between channels as far as mipmaps go, it only sees the image as a whole and replicates the top image as it drops down the mipmap chain.  Whatever properties exist in the main level will also exist in each subsequent mipmap level.  The engine will use mipmaps automatically but only create them if using -mipmap with -img2dds and/or -env, and only for images affected by those options.  If the main image includes an alpha channel then any mipmap levels created by the game will also contain the alpha channel.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Flipside on May 31, 2006, 01:27:58 pm
Got it thanks :) Sorry, just read through my last post and I sound like my own boss there, gatling gun questions ftl :(
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Vasudan Admiral on June 01, 2006, 05:16:36 am
W00t! Shiny! Thanks all. :)
Turns out I needed to flatten the already flattened image for that new exporter to work (thanks ASPSR), else it gave me a "too many channels to export(5)" error.
But it works now!

Quote from: Turambar
oh, i'd already taken care of aeolus, no problems...
Err, that was what I said this for. :p
Quote
Has anyone already done/started anything for any of them? Ie, going over the map and 'properly' giving it env mapping that could save me time?
No matter though - I still needed to learn how to do it, and more than just the env map was fixed this run through.
Since I'll be performing optimisations for the Aeolus, TC-Tri, Triton and Fenris, would you be willing to send me any env/shine maps you've done for those ships? (Lucifer should be fine - I've not heard of any performance issues/bugs about it)



Quote from: ASPSR
But OTOH I also noticed that LOD0 has much more spec brights than LOD1. But I don't know if that's normal or if it is some kind of bug.
This is one of the things I've just fixed actually - it was simply because the LODs used a separate texture to the main texture, and these other textures did not have shinemaps. Now - in accordance with Taylors modding guide, the lods all use the same texture as LOD 0, with mipmaps handling texture shrinkage. Faster performance, smaller RAM footprint. :)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on June 01, 2006, 06:17:46 am
Since I'll be performing optimisations for the Aeolus, TC-Tri, Triton and Fenris, would you be willing to send me any env/shine maps you've done for those ships?
DaBrain already fixed the specmap for the TC-Tri, making it a true alpha map.  If you don't already have that let me know and I'll dig it up from my VPs for you.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: Vasudan Admiral on June 01, 2006, 09:14:07 am
It doesn't appear to be in the latest media vps, so nope, and thanks the both of you. :)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: taylor on June 01, 2006, 09:24:18 am
Here it be ... http://icculus.org/~taylor/fso/misc/tc-tri-htl-shine.dds
(it was too big, even compressed, to attach here)
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: ARSPR on June 01, 2006, 09:25:29 am
This is one of the things I've just fixed actually - it was simply because the LODs used a separate texture to the main texture, and these other textures did not have shinemaps. Now - in accordance with Taylors modding guide, the lods all use the same texture as LOD 0, with mipmaps handling texture shrinkage. Faster performance, smaller RAM footprint. :)

I'm just learning, but as I posted in the first one, within Modelview I do not get Triton_HTL1_b and Triton_HTL_c, (with no associated shinemaps), listed as used textures. It doesn't matter if I change LOD.

But with PCS I get a list of 6 textures that includes these two ones.

Can I assume that Modelview has a bug and it only shows LOD0 textures? Or is there a way to show LODx textures that I can't find?

Thank you.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: karajorma on June 01, 2006, 09:31:43 am
Modelview has a bug and does a bad job of showing non-LOD0 textures.
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: ARSPR on June 01, 2006, 10:19:03 am
Well. for some days I've been playing with textures within Photoshop and I've been searching in Internet about compression and texturing and what I think I have learned is the following knowledge, (in plain, non-technical words):

(I hope that this info wasn't very wrong and that it could be interesting to someone as general info ;) ).
Title: Re: -shine, -glow, envmapping and alpha channel
Post by: neoterran on June 10, 2006, 10:49:10 am
You should always use the latest version of nvdxt to do the conversion with the new -quality_highest switch, which enables their improved algorithms.