Closed slipher closed 3 years ago
This is right. For reference this was the old material, quake3-like that is still supported but is very verbose and may be less performant (without special engine optimizations):
textures/parpax_custom/squarelamp_blue_40k
{
qer_editorImage textures/parpax_custom_src/squarelamp_blue_d
q3map_lightImage textures/parpax_custom_src/squarelamp_blue_a
q3map_surfacelight 40000
surfaceparm nomarks
{
map $lightmap
rgbGen identity
}
{
map textures/parpax_custom_src/squarelamp_blue_d
blendFunc GL_DST_COLOR GL_ZERO
rgbGen identity
}
{
map textures/parpax_custom_src/squarelamp_blue_a
blendfunc GL_ONE GL_ONE
}
}
This is the doom3-like syntax we also support but does not cover all the use cases:
textures/parpax_custom/squarelamp_blue_40k
{
qer_editorImage textures/parpax_custom_src/squarelamp_blue_d
q3map_lightImage textures/parpax_custom_src/squarelamp_blue_a
q3map_surfacelight 40000
surfaceparm nomarks
diffuseMap textures/parpax_custom_src/squarelamp_blue_d
glowMap textures/parpax_custom_src/squarelamp_blue_a
}
This is the syntax we recommend, as it allows for multiple stages, each one having their own diffuse/normal/specular/other textures, making possible to blend those multiple stages together (like, for terrain blending).
textures/parpax_custom/squarelamp_blue_40k
{
qer_editorImage textures/parpax_custom_src/squarelamp_blue_d
q3map_lightImage textures/parpax_custom_src/squarelamp_blue_a
q3map_surfacelight 40000
surfaceparm nomarks
{
diffuseMap textures/parpax_custom_src/squarelamp_blue_d
glowMap textures/parpax_custom_src/squarelamp_blue_a
}
}
The parent {}
block delimits the material definition for the given material name.
The inner {}
block delimits a stage: the renderer can blend more than one stage for one single material.
Previously in Quake 3, the color map, the light map and the glow map were separate stages meant to be run sequentially by the engine then blended, so, without optimization (heuristics trying to merge them to reduce the renderer pass count), there would be three renderer passes for that material. While this is still supported, such syntax is better used for special effects only.
The diffuseMap/normalMap/glowMap Doom 3 syntax outside of stage block were handled in Dæmon as aliases for those q3 stages and then the engine did heuristics to merge them, with the limitation of not being able to stage multiple diffuse textures (neither normal/specular/glow ones).
The diffuseMap/glowMap syntax in a stage block just defines feature textures for the same stage that will be processed as one pass in all case, and there is no need for optimization.
@slipher Did you get a warning or did you just catch it on sight, or did the render was wrong? I wonder if the stage collapse heuristic was able to fix that at run time or not…
I got ^3Warn: Shader textures/parpax_custom/squarelamp_blue_40k has a colormap stage with no image
I didn't test it and don't understand what's correct; just copied the one above it.
This is to fix
^3Warn: Shader textures/parpax_custom/squarelamp_blue_40k has a colormap stage with no image