Silgrad Tower from the Ashes

Full Version: How to model and texture a semi-transparent object
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

Just wanted to ask a basic question. If i wanted to make an object semi-transparent, eg. say, a block of bluish tinted glass, how would i go about doing it, to stop it looking like a piece of solid blue rock?
Does it need transparency (alpha channel) to be enabled from both the mesh structure model for the block and the texture alpha channel (.dds file), or will having alpha in either of the mesh or texture work, or else, any particular one of them?
Basically, what is the difference if transparency is enabled from the mesh or else from the texture? Will the glass block look different in both the cases?
The textures alpha layer controls how transparent it will be. White- opaque black-invisible. Save the texture as a dxt5. As a ARGB dxt1 have 1 bit alpha. which means its either totally black or its totally white. If you want any kinda gradient go with dxt5.

as far as I know the nialphaproperty must be added or else the nif will not understand any alpha layer information. I think it just controlls wether its on or off all together. I am just assuming that though. I can't remember what happened when I was messing with alpha last.
Ghogiel: That's a good tip about the alpha layer. Do you know if keeping a white alpha channel (under DXT1) does anything negative to normal maps' specularity? I thought saving them as DXT1 would get rid of the alpha channel, but it always confused me why I got a white channel in Photoshop anyways. Unticking the alpha channel checkbox when saving it didn't seem to make a difference.

debug13: To make a glass material you'll need four maps. A color map, an opacity map, a normal map, and a specular map.

[Image: th_MakingAGlassMaterial1.jpg]

The opacity map go in the color map's alpha channel, and the specular map go in the normal map's alpha channel. Photoshop is the best way to put them together. As Ghogiel said, the brighter the opacity color is the more visible your surface will be. It doesn't have to be a single-color, but it's the easiest and gives an even, predictable result. The brighter the specular map is, the more your surface will glisten/shine. (I haven't quite gotten the hang of the Gloss setting yet, but back when I was doing max renders Gloss had a way of equalizing the glare in a specular map.)

[Image: th_MakingAGlassMaterial2.jpg]

Then open the nif you want to apply the material to in Nifskope.
Right-click on the NiTriStrips block and choose "Node > Attach Property". Now attach first an NiAlphaProperty, then a NiSpecularProperty, and optionally a NiStencilProperty.

Set the flag of the NiAlphaProperty to 4845, then set the flag of the NiSpecularProperty to 1, and finally set the Draw Mode of the NiStencilProperty to DRAW_BOTH.

Now, on the NiTexturingProperty block, set the Apply Mode to Apply Highlight. (Not Apply Highlight2, that's parallax). And that should be it.

The NiStencilProperty makes your material visible on both sides without you having to double the facecount (by cloning it and flipping the normals). If you're making a flat surface, like the window in my screenshot, it's not needed. If you're making a bottle then it could be very useful. Just keep in mind it lets the player peek inside the model, so you need to ensure there aren't open borders in view else it'll look weird.
WOW!!! Thanks guys, that was a pretty quick and neat tutorial for me. =) Now it's time to get down to my tools =)

Razorwing: I did not understand the significance of this -

Set the flag of the NiAlphaProperty to 4845

What does that do and why is it needed? Is it some kind of a unique ref id for the material?

Also, if i were not to set the NiAlphaProperty property in my mesh at all, would the texture file, assuming its a dxt5 (colour and opacity about 50% for alpha) create a problem while getting applied to the mesh in game, and look wierd? Or does the game engine simply overlook the alpha channel in that case for the dds file?

Anyways, i'll experiment with that and get back. Thanks again.
Quote:Originally posted by debug13
Razorwing: I did not understand the significance of this -

Set the flag of the NiAlphaProperty to 4845

What does that do and why is it needed? Is it some kind of a unique ref id for the material?

Also, if I were not to set the NiAlphaProperty property in my mesh at all, would the texture file, assuming its a dxt5 (colour and opacity about 50% for alpha) create a problem while getting applied to the mesh in game, and look wierd? Or does the game engine simply overlook the alpha channel in that case for the dds file?

Anyways, i'll experiment with that and get back. Thanks again.

Setting the flag of the NiAlphaProperty to 4845 enables what I like to call 'multilayered transparancy'. Basically, if you keep the default flag assigned by NifSkope, viewing two overlapping transparant surfaces will cause graphical glitches. An example from the main game is if you view a gloom wraith through a cobweb. The cobwebs actually use the flag 4333, but what good that does I don't know and neither did the author of Nifskope Alchemy but it seems very close to the default 237. But I digress. The important bit is that if you're sure that the player will never be able to see another transparant surface behind your surface then 237 is probably the way to go, but in all other cases 4845 is best.

If you don't add a NiAlphaProperty node, the color map's alpha channel won't do anything (except hog video memory). Unless you're going for parallax maps, which are also stored in the color map's alpha channel.
No it seems you can't actually get rid of an alpha channel even when you save without an alpha. :S

the other thing is when you wave as a dxt1 with 1 bit alpha and fill the alpha solid black it trips out and makes the texture come up black/blank....basically its nothing, like the texture decided itself wasn't there because the alpha layer was black it thought hey its 100% transparent so lets just not save any RGB! yay I'm clever.

even weirder.....it vanishes the alpha layer itself. :S that puzzles me.

You can save a Normal map as dxt1. I think, I cannot see any reason why not. as long as it wants a white alpha channel. and lets face it There can't be that many Textures that will want white alphas it the normal.
Hmm, well, the way I do it:

Just a complete transparency can be done in the mesh, granted you have a pre-existing texture. If it doesn't have one already, under NiTriStrips where the window is, right click, Attatch Property, and select NiAlphaProperty. The alpha won't work immediately, so just go to the Alpha property and select Flags and just hit ok. Then, in the branch of the window data, there should be a picture that looks like a paint pallet. Click that icon, and there should be an alpha tab. Just slide that down a bit and it will become see-through, go all the way and it will disappear. The CS will flash a minor warning whenever the object is placed, something about FadeNode files an only be done with blah blah blah or something like that. It's absolutely harmless, as some default objects in Oblivion do the same thing.

Another way is more complicated for me as it involves millions of dots I have no way of implementing save placing them myself. Just open the texture in photoshop, go to the select option at the top, pick load selection, and pick alpha01. Then you just take the selection brush and place away, avoiding the metal parts and whatnot. The color part when you pick mask is the transparent parts. Then, just implement the same process to the mesh above using the new texture on the window, except don't move the Alpha Slider. It will make a similar and more high quality effect as it lets you control the specific parts you want to be transparent, and it has no issue in the CS.[EDIT: Wait, now do I realize you can make the alpha secection transparent itself with a brush option.....sry]