KillerKind wrote:OK, alpha channels. What I want, or what is needed, is for the model skins to be able to use an alpha channel. There are certain situations where this is desirable for the model. [...]
Ah, okay. My question about specifics was more related to wether you want alpha-tests (as is required for grates, ladders, etc. ("masked" textures)) vs. alpha-blending (translucency, as for glass).
Good news is that both kinds are already supported.
Personally, I would rather you released the shader scripts (cmaps) as at least modifiable, even if this requires code to be compiled.
cmat scripts (the more important ones) are simple text files that are parsed by the MatSys on each init anyway. Thus, yes, they are modifyable by everybody. This does not even require the MDK, the demo will be enough.
I would think that if you can not compile, you have no business modifying the code in the first place.
For Shaders (C++ modules) that is certainly true.
Shaders implement a specific way of rendering something. For example, a Shader may be responsible for rendering a standard Material that has a diffuse-map, a light-map, and a normal-map, but no luminance-map and no specular-map. Another shader may implement rendering for standard materials that come with all five kinds of maps, another renders the materials that only have the diffuse-map etc.
Normally, each shader can tell autonomously wether it works well with a material or not. Thus, on initialization, for each material, the shader library is queried for auto-detecting the most suitable shader for each material.
The cmat script however may override this automatic shader assignment, e.g. if you want to write a Shader that implements the latest GPU fragment-program effect and want to use that with a certain material (rather than the auto-assigned shader), this can be stated in the materials cmat definition.
Unless someone wants to write brand-new Shaders (e.g. a Shader containing a fragment-program for metallic car paint), no source code modification and no compiling is required.
Finally, here are some examples for cmat contents, for reference above:
Code: Select all
table sosTable { snap { 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0 } }
Textures/Kai/barrel_rst
{
diffusemap Textures/Kai/barrel_rst_diff.png
normalmap Textures/Kai/barrel_rst_norm.png
specularmap Textures/Kai/barrel_rst_spec.png
lightmap $lightmap
}
meshColorsTest
{
useMeshColors
}
blueMaskedTest
{
// diffusemap blue2alpha(Textures/Kai/crossport_diff.png)
diffusemap blue2alpha(Textures/Kai/dc_cage_side_diff_masked.png)
// diffusemap blue2alpha(Textures/Kai/ladder_red_diff.png)
lightmap $lightmap
twoSided
alphaTest 0.5
// blendFunc one one
// red div(add(sinTable[mul(time, 0.25)], 1), 2)
}
D3Test1a
{
diffusemap Textures/D3Test/lfwall2.png
normalmap Textures/D3Test/lfwall2_local.png
specularmap Textures/D3Test/lfwall2_s.png
lumamap Textures/D3Test/lfwall2_add.png
lightmap $lightmap
rgb div(add(sinTable[mul(time, 0.5)], 1), 2)
}
// Don't worry about this one for now...
// I'll provide documentation with the release...
Textures/Terrains/Lindstrom
{
AmbientShader A_custom_Terrain // Override the automatic shader selection.
LightShader none1234 // Override the automatic shader selection - make sure no light shader is selected.
// noDynLight // Same effect as the previous line.
diffusemap Textures/Terrains/ps_Texture_1k_a.png, wrapS clampToEdge, wrapT clampToEdge
lightmap $lightmap // Ambient shader "A_custom_Terrain" requires a lightmap.
lumamap Textures/Terrains/CommonDetail1.png // "A_custom_Terrain" takes the Luma-map as Detail-map (optional).
shaderParamExpr fParam4 // The first eight shader parameters are taken from fParam4 to fParam11
shaderParamExpr fParam5 // and specify the coefficients of two planes for automatic tex-coord generation.
shaderParamExpr fParam6
shaderParamExpr fParam7
shaderParamExpr fParam8
shaderParamExpr fParam9
shaderParamExpr fParam10
shaderParamExpr fParam11
shaderParamExpr 100 // Scale / Repetitions of the Detail-map.
twoSided // "twosided" is required for the SOAR terrain algorithm.
}