Textures, What is each specific shader is used for? More specifically "When" should it be used?


(Major Stress) #1

This topic has been covered before. I have read the shader details, but much is still unclear. I am no stranger to shaders. However there are times the HWRM system just baffles me, and gives me fits.

For example. I just NOW realized (after 3 years of modding this game) that the SPEC, and REFL shaders should be used in TANDUM with each other. I just used SPEC for hull plating with no REFL before, and lets just say i get some very mixed results. Also i did not realize that you had to start from BLACK, and work your way up.

Heres some examples of the fits i have been having…

My goal was to have the hull plating or “aztec” only be seen when the ship is backlit. However the old way i did my spec maps was similar to how Bridge Commander modders did theirs. The results as you can see is that the ship is way too shiny, and the aztecs are visible no matter the direction of the light sources. It looked especially bad when viewed from top down, or bottom up.

After i realized SPEC/REFL symbiosis…

Following the examples from the HWRM sample ships i made a REFL map identical, but darker than the SPEC map (with a few exceptions for mirror like surfaces). I also darkened the original SPEC map. The results are much more like was intended, and the aztecs reflect the backlit light source as they should.

Can some people with more experience elaborate on the non self explanatory on how, and when each shader should be used? Also the PAIN map is still baffling me. What exactly is its purpose?

It took me 3 years to figure out what i did on my own. I hope i dont have to take another 3 years to figure out the rest.


(Taiidan Republic Mod) #2

I have a very limited understanding of shaders. I would love someone to explain the planet shaders.

One thing that intrigues me is how you can pass the shader custom parameters by placing MAT[xx]_PARAM[yy] joints in the ship. This is quite powerful, if I knew what I was doing…


(Sastrei) #3

AFAIK the PAIN map is used for paint, and should reflect which areas are covered in glossy paint. For example, arrowhead pennants, the orange areas around RCS thrusters, and those bigass federation and Starfleet seals on space stations. Oh plus the hull registries.


(Herbyguitar) #4

Specular map is going to give you shine. Use it to enhance the metallic properties. A neat effect can be had by using it to enhance panels. Shading the panels with slight different color variations and varying SPEC intensities is very cool but you want to use it sparingly for a subtle effect.

Reflection is going to give you glass/water. Use it on canopies and windows/portals… and yes, you need to use it with SPEC.

Paint is going to give you the look of … paint :smiley: … Varying the amount can give you the look of worn or slightly mottled areas.

There’s really no ‘one size fits all’ solution.


(Major Stress) #5

Herby you said a while back that you made TMP style aztec paneling using only the PAIN shader. Can you show an example?

I pretty much nailed the SPEC/REFL part. I just wish i figured out sooner that you needed similar SPEC, and REFL maps. Also most modders start their specular maps with 50% gray, and go dark for dull areas, and light for shiny. HWRM as i recently found out does not work that way. You must start from black, and work your way up until it looks right. 50% gray in photoshop is way too damn much specular. Same with REFL. Start from black, and work your way up until it looks right.

The PAIN is pretty much the icing on the cake. IF it is used how i think it is used… Like various layers of matte, or dull coat.

As far as one size fits all? I know there is no such thing lol. Pretty much just trial, and error until it looks right.


(Herbyguitar) #6

… I did some experiments with panels and the different shaders to achieve the same effect that the 1701 had in TMP. I don’t remember what happened to them but I’ll look and see if I still have anything. As I recall I used REFL and SPEC in slightly differing intensities to get very subtle panel separation and added a slight hue/color variation to the DIFF layer. PAIN was used over the top to dull the effect. I never really used it on anything because it was only a close up effect and didn’t really show up at any distances that were set by the ship files, which was one of my main gripes with the mod. No default closeups.


(Bmon1291) #7

Are you familiar with traditional/PBR materials?

HWRM to my knowledge uses a blend of traditional and PBR.

Spec map is your every day spec map, nothing too crazy about it. Whatever the RGB color is on the spec map is how intense the light is on the model in direct light. The reflection (gloss) map is what sets the surface smoothness. 5% gloss and you’re looking at an egg shell. 50% gloss is like semi-gloss paint. 100% gloss would be like a window, or gloss paint (think car clear coat). The paint map is a metalness map as I interpret it. It determines what is an insulator and what is a conductor. In simpler terms, what is painted and what is bare metal. This has to be either pure black or pure white (white being painted, black not painted) because it goes into the alpha channel of a pure white texture. What you set here is going to have an effect on the rendering in game. On the Hiigaran carrier, for example, everything that’s yellow is in the paint map and everything else isn’t. So the painted yellow parts on the carrier have very different rendering in game than the rest of the ship, even though their spec and reflection values are not that much different.

I should note, that after looking at the examples some, the reflection values seem to be 35,35,35 RGB for the standard 50% gloss (or thereabouts) that we saw in the original Homeworld 2. If you’re going to darken the spec to make the gloss, try to shoot for this 35,35,35 RGB value.

And, this is also personal preference, but anything that glows should be black in both the spec, reflection and paint maps.

I have had great success in importing and making stuff look stunning in the HWRM engine. You need all three. On this ship, the base hull has a spec value of 135,135,135 RGB (a bit shinier than 50% spec) and 35,35,35 gloss (just like the vanilla textures) with the paint texture applied to the entire hull that’s purple (this was done intentionally for the style I wanted).


(Taiidan Republic Mod) #8

I have looked into some of the shader files but I don’t really know what I’m looking at. Can anyone help me to know how I can work out which files (DIFF, SPEC, etc) are used by the shader, from looking at the shader files?


(ajlsunrise) #9

Your best/easiest bet is to look at the SHADERS.MAP file that HODOR uses.

It should be pretty straight forward, and is actually what DAEnerys uses (although hardcoded) in its render pipeline.

The textures output by HODOR (and stored in the HOD) actually are a combination of those source files, so it gets a little fuzzy to determine what is what if you only go off of what is in the shaders.


(Taiidan Republic Mod) #10

Thanks, and what do the numbers in SHADERS.MAP mean:

	$diffuse[DXT1] = 1 1 1 1		# diffuse param
		DIFF = R G B 1
	$glow[DXT1]= 0 0 0 1
		GLOW = G G G G
		SPEC = B B B B
		REFL = R R R R

(Herbyguitar) #11

I don’t know how many times I asked that question and never got a straight answer…


(Bmon1291) #12

So 1 1 1 (1) is probably referencing the alpha channel.
R G B (1) is the alpha channel specifically.

The way the glow texture is organized, its how classic textures were made: spec in blue channel, glow in green channel and gloss (if you used the B5 custom shaders) was in the red channel. As to why the glow is 0 0 0 1, I’m not sure but it most likely has to do but it’s most likely so the texture is not overwritten. The DIFF uses RGB 1 and uses 1 1 1 1 across the board. the GLOW map is divided by R G B based on the texture name, so 0 0 0 1 is most likely denoting that those layers are input individually instead of all together. The 1 at the end for alpha must also have to do with overwriting the alpha channel so it can pull from the TEAM and SPEC maps. Notice how the TEAM and SPEC maps only store their data in the alpha layer? There you go.


(ajlsunrise) #13

Not quite…

Format is $name[compression] = default_r default_g default_b default_a

So $diffuse[DXT1] = 1 1 1 1 sets the base texture to non-transparent white.

Then, for each source file (DIFF, SPEC, GLOW, etc.), the format is SOURCE_NAME = src_r_to_dst src_g_to_dst src_b_to_dst src_a_to_dst.

The “src_x_to_dst” flags are (meaning put “x” channel into the destination named by this flag):
UPPERCASE R, G, B, A: put this “x” source channel into the “flag” destination channel.
lowercase r, g, b, a: inverts the source

So GLOW = G G G G puts the average of all channels into the Green channel of the destination.


(Sastrei) #14

Some of the lines have a 5 instead of a 1 - any idea why?


(ajlsunrise) #15

Which lines were they again? I think I figured it out at one point, just need a trigger to my memory.


(Sastrei) #16

Further down in SHADERS.MAP, though it looks like every instance occurs for a $normal parameter, so I guess it has something to do with that.

$normal[DXT1] = 5 5 1 1

Edit: also occurs for $warp.

$warp[DXT1] = 5 5 0 1


(ajlsunrise) #17

I actually don’t think I ever figured that out… I just ignored it and used 1 instead. I’ll do some more testing, if anyone has some normal maps they can send me. @Dom2, are there source files in the TRP Dropbox?


(Taiidan Republic Mod) #18

I don’t think so, the got too big. I can send some to you if you like.


(Herbyguitar) #19

I heard someone say that PAIN is an ‘all’ or ‘nothing’ layer. Is this correct? I haven’t been using it like that at all.


(Bmon1291) #20

How have you been using it? Because it is technically either on or off, just like an alpha transparency layer.