Graphics 食人魔材料脚本;如何为一项技术提供多个lod_索引?
我有一个材质脚本,它定义了4种渲染技术。1使用GLSL着色器,然后是3个仅使用不同分辨率纹理的其他着色器Graphics 食人魔材料脚本;如何为一项技术提供多个lod_索引?,graphics,glsl,ogre,Graphics,Glsl,Ogre,我有一个材质脚本,它定义了4种渲染技术。1使用GLSL着色器,然后是3个仅使用不同分辨率纹理的其他着色器 如果图形卡支持GLSL着色器,我希望无条件地使用它,否则根据相机距离使用其他3种纹理 目前我的剧本是 material foo { lod_distances 1600 2000 technique shaders { lod_index 0 lod_index 1 lod_index 2 //various passes here } tech
如果图形卡支持GLSL着色器,我希望无条件地使用它,否则根据相机距离使用其他3种纹理 目前我的剧本是
material foo
{
lod_distances 1600 2000
technique shaders
{
lod_index 0
lod_index 1
lod_index 2
//various passes here
}
technique high_res {
lod_index 0
//various passes here
}
technique medium_res {
lod_index 1
//various passes here
}
technique low_res {
lod_index 2
//various passes here
}
额外信息 政府说 增加索引表示详细程度较低 你可以(而且经常会)为同一LOD索引指定多个技术,这意味着食人魔将从同一LOD索引中选择最佳技术 食人魔决定哪一个是“最好的”,哪一个被列在第一位 目前,在支持我使用的GLSL版本的机器上,脚本的行为如下:
- 摄影机>2000:着色器技术
- Camera>1600您针对不同LOD值使用不同技术的方法确实是正确的。包含材质LOD用法的完整示例文件如下所示
注意:您当然可以更改LOD策略以满足您的需要。食人魔手册中解释了所有有效的策略值及其行为
material testLOD { lod_strategy screen_ratio_pixel_count lod_values 0.8 0.6 0.4 0.2 technique red10 { pass red { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 1 0 0 1 } } technique green20 { lod_index 1 pass green { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 1 0 1 } } technique cyan100 { lod_index 2 pass cyan { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 0.945098 0.980392 1 } } technique blue200 { lod_index 3 pass blue { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 0 1 1 } } technique yellow1000 { lod_index 4 pass yellow { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 1 1 0 1 } } }
您针对不同LOD值使用不同技术的方法确实是正确的。包含材质LOD用法的完整示例文件如下所示 注意:您当然可以更改LOD策略以满足您的需要。食人魔手册中解释了所有有效的策略值及其行为material testLOD { lod_strategy screen_ratio_pixel_count lod_values 0.8 0.6 0.4 0.2 technique red10 { pass red { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 1 0 0 1 } } technique green20 { lod_index 1 pass green { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 1 0 1 } } technique cyan100 { lod_index 2 pass cyan { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 0.945098 0.980392 1 } } technique blue200 { lod_index 3 pass blue { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 0 1 1 } } technique yellow1000 { lod_index 4 pass yellow { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 1 1 0 1 } } }
Compiler error: fewer parameters expected in foo.material(#): lod_index only supports 1 argument
technique shaders { lod_index 0 //Shader passes here } technique shaders1 { lod_index 1 //DUPLICATE of shader passses in lod 0 } technique shaders2 { lod_index 2 //DUPLICATE of shader passses in lod 0 }
material testLOD { lod_strategy screen_ratio_pixel_count lod_values 0.8 0.6 0.4 0.2 technique red10 { pass red { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 1 0 0 1 } } technique green20 { lod_index 1 pass green { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 1 0 1 } } technique cyan100 { lod_index 2 pass cyan { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 0.945098 0.980392 1 } } technique blue200 { lod_index 3 pass blue { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 0 0 1 1 } } technique yellow1000 { lod_index 4 pass yellow { ambient 0.698039 0.698039 0.698039 1 diffuse 0.698039 0.698039 0.698039 1 specular 0.898039 0.898039 0.898039 1 20 emissive 1 1 0 1 } } }