Texture specular highlights

Blitz3D Forums/Blitz3D Programming/Texture specular highlights

Well, you can use a greyscale cubemap to generate the highlight areas, then put the mask atop that. that would at least generate the specular highlights as intended

I'd imagine something like this:

texturelayer 0 = a color cubemap used to calculate surface normals for DOT3 (setcubemode 2, blending with multiply on a white fullbright model)...can also be done through verticy coloring, or even a seperate "light map" containing normals converted to colors

texturelayer 1 = the normal map DOT3 blending...see this thread: http://www.blitzbasic.com/Community/posts.php?topic=39353 which has my normalmapped animated mesh example that used cubemaps

texturelayer 2 = a color cubemap (setcubemode 2, multiply or mod2 blending) to generate the effect of colored lighting (agin see how that works in the link above)...this could also be a conventional "lightmap"...or not used at all

Texturelayer 3 = normal diffuse color layer

Texturelayer 4 = a greyscale cubemap for spectral highlights (setcubemode 1 or even 3, additive blending)...either store in a file or modified when loading by reduceing the brightness to half or less...basicly no RGB color value greater then 127 ...basicly you want this to be pretty dark (may have to play a bit with how dark it should be)

texturelayer 5 = the greyscale spectoral highlight mask (multiply blending)...again like the cubemap...either store it in a file or modify it at runtime so no RGB color value is less then 127...basicly you want this to be fairly bright (again, you would likely half to play with it a bit)

colors are in the range of 0 to 1.0 on the GFX card...which can work to your advantage...as long as you realise that anything over 1.0 is truncated, you can use the textureblending settings to do all sorts of things.

say you have a RGB color value of 32,32,32 (or about .125,.125,.125) a very dark grey...the spectoral highlight cubemap has an RGB pixel color of 8,8,8 (or .03125,.03125,.03125) at that particular pixel location when rendered...as the cube map is additve blended the result would be an RGB value of about 40,40,40 (.125 + .03125 = .15625)...then the spectoral mask is multiplied atop that...say the RGB pixel color at that location is 235,235,235 (or about .9179688,.9179688,.9179688) and the resulting RGB color would be about 37,37,37 (.9179688 * .15625 = .1434326) slightly brighter then before..which might be exactly what you want...on the other hand if you didn't want that particular pixel to be brightened at all, effectively remaining the same 32,32,32 RGB color...if the spectoral mask RGB color for that location were 209,209,209 or .81641,.81641,.81641) then multiplying it with .15625 (the surface grey with the additve blended spectoral highlight) results in .127564 or RGB values of about 32,32,32 takeing you right back to where you started...which again, might just be what you wanted.

The darker the spectoral cubemap and the lighter the spectoral mask, the more subtle the effect...at least in theory :P