Delta Hawk 1829 Posted December 14, 2011 Hi, I have a texture set with a diffuse, normal and specular map and in game when viewed from a certain angle, my textures flicker as if the hue of my diffuse was changed to blue. I'm assuming this is because of the specular map since it started happening after I turned up the specular RGBA in the rvmat. Anyway to avoid this? Thanks Share this post Link to post Share on other sites
max power 21 Posted December 14, 2011 Perhaps if you post your rvmat and gives us some details of your model... like whether it's a port or a new model, etc. Share this post Link to post Share on other sites
Delta Hawk 1829 Posted December 15, 2011 It's not BIS's model or textures. It's a brand new model with textures I made. Right now, it's only the LC2 gear which shares the same texture file that is doing this flickering. It's also the only texture set with a specular map that has bright parts. This flickering happens on every object with this texture in the game world at the same time. I made the specular map by whiteing out the red and blue channels in photoshop. Here's the RVMAT ambient[]={1,1,1,1};diffuse[]={1,1,1,1}; forcedDiffuse[]={0,0,0,0}; emmisive[]={0,0,0,1}; specular[]={0.30000001,0.30000001,0.30000001,0.30000001}; specularPower=76.699997; PixelShaderID="Super"; VertexShaderID="Super"; class Stage1 { texture="P:\DHI_USMilitary\Textures\LC2gear_nohq.paa"; uvSource="tex"; class uvTransform { aside[]={1,0,0}; up[]={0,1,0}; dir[]={0,0,0}; pos[]={0,0,0}; }; }; class Stage2 { texture="#(argb,8,8,3)color(0.5,0.5,0.5,0.5,DT)"; uvSource="tex"; class uvTransform { aside[]={1,0,0}; up[]={0,1,0}; dir[]={0,0,0}; pos[]={0,0,0}; }; }; class Stage3 { texture="#(argb,8,8,3)color(0,0,0,0,MC)"; uvSource="tex"; class uvTransform { aside[]={1,0,0}; up[]={0,1,0}; dir[]={0,0,0}; pos[]={0,0,0}; }; }; class Stage4 { texture="#(argb,8,8,3)color(1,1,1,1,AS)"; uvSource="tex"; class uvTransform { aside[]={1,0,0}; up[]={0,1,0}; dir[]={0,0,0}; pos[]={0,0,0}; }; }; class Stage5 { texture="P:\DHI_USMilitary\Textures\LC2gear_smdi.paa"; uvSource="tex"; class uvTransform { aside[]={1,0,0}; up[]={0,1,0}; dir[]={0,0,0}; pos[]={0,0,0}; }; }; class Stage6 { texture="#(ai,64,64,1)fresnel(1,0.7)"; uvSource="tex"; class uvTransform { aside[]={1,0,0}; up[]={0,1,0}; dir[]={0,0,0}; pos[]={0,0,0}; }; }; class Stage7 { texture="Examples\data\env_land_co.tga"; uvSource="tex"; class uvTransform { aside[]={1,0,0}; up[]={0,1,0}; dir[]={0,0,0}; pos[]={0,0,0}; }; }; Share this post Link to post Share on other sites
max power 21 Posted December 15, 2011 (edited) texture="P:\DHI_USMilitary\Textures\LC2gear_nohq.p aa"; texture="P:\DHI_USMilitary\Textures\LC2gear_smdi.p aa"; Is that space in the file? You're not making the best use of the blue channel of the smdi map but there's nothing in the values of the map itself that should be giving you problems. How are you producing these paas? texture="Examples\data\env_land_co.tga"; Is this a valid path to a mod that's loaded? Edited December 15, 2011 by Max Power Share this post Link to post Share on other sites
Delta Hawk 1829 Posted December 15, 2011 I'm using the oxygen rvmat editor. There's no spaces in the editor or the text file when I open it with notepad. It seems to add a space when I copied it on its own. I get the magenta smdi in photoshop, save it as tga 32 bit, open it with texview 2 and save it as a paa. I don't know the best way or the optimal way of doing it, so I have no clue what you mean by the blue channel. Share this post Link to post Share on other sites
max power 21 Posted December 16, 2011 I'm using the oxygen rvmat editor. There's no spaces in the editor or the text file when I open it with notepad. It seems to add a space when I copied it on its own.I get the magenta smdi in photoshop, save it as tga 32 bit, open it with texview 2 and save it as a paa. I don't know the best way or the optimal way of doing it, so I have no clue what you mean by the blue channel. [imghttp://i864.photobucket.com/albums/ab202/themethodbehindthemadness/specularpreview3.jpg[/img] The blue channel is a gloss map... but that's for another time. The way you're making the paas is fine. I think the problem is with the path to your env map. Try making it "ca\Data\env_land_co.paa" Or, to see it in buldozer without packing it and ingame, copy that one in the examples folder into your addon's Data folder and path to that. "DHI_USMilitary\Textures\env_co.paa" Share this post Link to post Share on other sites
Delta Hawk 1829 Posted December 16, 2011 You sir are my hero! I fix the env map and stared at my model for about ten minutes and it didn't flicker at all. Thank you. As for the gloss map could you explain it some? Is that why my gear looks like it's plastic? Share this post Link to post Share on other sites
max power 21 Posted December 16, 2011 (edited) It could be. The difference between metal and plastic is that metals reflect in the colour of the metal, and plastic reflects in the colour of the light that is shining on it. I suspect that your specular levels are too high. This is going to be a bit complicated to bear with me. So, you have two basic materials on there. Metal and fabric. Let's take a look at the properties of metal and fabric using the material templates on the biki. http://community.bistudio.com/wiki/Material_templates We see that for cloth, it suggest an average specular of 0.03, a specular power of 50, and a fresnel setting of fresnel(1.32,0.94) For metal it figures that an average specular of 0.16, a specular power of 100, and a fresnel setting of fresnel(4.01,2.86) How does this relate to the smdi map? Well, it has to do with the channels. The green channel of the smdi map is a specular map, and the blue channel is a gloss map. They correspond to the specular and specular power settings respectively, in a multiplication relationship per pixel. If a pixel on the green channel is 0.5 (50% grey), and the specular setting is 0.6, the resultant specular behaviour is 0.03. 0.5 * 0.6 = 0.3. The same goes for the gloss map. A value of some pixel on the gloss map of 0.5, and a specular power of 60, would result in a specular power behaviour of 30 for that pixel. Why compare materials? Well, we're describing different materials on your smdi map by the way they interact with light, so it's important to know what the difference is. BIS suggests that metal is 5x more reflective (specular) than cloth (compare 0.16 to 0.03). They also suggest that metal is twice as smooth/glossy (specular power) as cloth (compare 100 to 50) (note: I don't believe that specular power is linear). So, if you have these two materials on your map, you would want the pixels for the metal to be stronger on both channels than cloth, at about these proportions. What material settings should be used? The material template suggestions? Well, I wouldn't. You want to try to get the most tonal range out of your spec and gloss maps as possible. Maybe as a stylistic choice, you want the scratches on the metal to appear very shiny. For very shiny things, you would need a very shiny rvmat. If that is the case, then you would want to set the specular to 1.0 (or whatever looks good), have the scratches very bright on the spec map, and then have the average metal pixels be around 0.16. But what about the cloth? Its average is around 0.03, maybe the maximum is twice that, so you have only 6 tones to describe the cloth specular. Is that a good idea? Is that 'high tonal range'? It's the same balancing act for the gloss map, but I think it's easier to manage. What I do is I separate the different materials into masks and control their lightness and darkness relative to each other until I get something resembling 'the right look'. Tonal range isn't so important on the gloss map, but proportion is. I hope this is as at least as clear as mud for you. In short, the gloss map (blue smdi channel) controls the relative glossiness of the material per pixel, and is related mathematically to the specular power setting in the rvmat. If you are unsure of what it does just place with it. And for the fresnel, just choose something that gives you some soft, all around lighting. Those settings are so different that it's quite impossible to try and get something 'physically accurate'. But note, that it does control the specular output based on the normal's angle compared to the camera, so if you have all oblique facing normals blacked out, you will see very little specular on the surface. Edited December 16, 2011 by Max Power Share this post Link to post Share on other sites