[map-sdk]修改天空盒雾化效果

This commit is contained in:
jiaguofeng
2024-01-06 14:04:00 +08:00
parent c6967f3d4d
commit 1d6f0052b3
3 changed files with 9 additions and 6 deletions

View File

@@ -241,8 +241,7 @@ void setLinearFog()
float distanceFromCamera = length(posInEye-cameraPos);
if(distanceFromCamera<fogStart)
return;
float fogAlpha=(distanceFromCamera-fogStart)/(fogEnd-fogStart);
fogAlpha=clamp(fogAlpha,0.0,1.0)*fogDensity;
float fogAlpha = smoothstep(fogStart,fogEnd,distanceFromCamera)*fogDensity;
fragColor.rgb = mix(fragColor.rgb,fogColor,fogAlpha);
}
void setGuideLine(){
@@ -301,8 +300,6 @@ void main()
if (isShadow)
setShadow();
}
setLinearFog();
setBlur();
float y = (ndc.y / ndc.w+1.0)*0.5;
y = smoothstep(0.0,1.0,y);
if(isDaytime || isMorning || isEvening || isRoadbed || isGreenBelt || isPlane){
@@ -321,4 +318,6 @@ void main()
}
fragColor.rgb = mix(fragColor.rgb,c.rgb,c.a);
}
setLinearFog();
setBlur();
}

View File

@@ -16,7 +16,8 @@ void setLinearFog()
{
if(!isFogEnable)
return;
float a = clamp(0.0,1.0,(1.0-gl_FragCoord.y/resolution.y)*3.0);
float f = gl_FragCoord.y/resolution.y;
float a = 1.0-smoothstep(0.75,1.0,f);
fragColor.rgb = mix(fragColor.rgb,fogColor,fogDensity*a);
}
void main()

View File

@@ -29,7 +29,6 @@ rsu.type.3=9FB6D6 //rsu颜色
selfCar.light=0.8,0.8,0.8;0.2,0.2,0.2;0.1,0.1,0.1;100.0 //自车
otherCar.light=0.7,0.7,0.7;0.02,0.02,0.02;0.15,0.15,0.15;11.0 //他车
others.light=0.7,0.7,0.7;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //除自车和他车外的其他3d锚点
fog=d0e4ff;40;80;0.8 //雾颜色,起始距离,结束距离,密度
skybox.lookat=0;-13;8.5;0;0;3; 0;1;0 //天空盒lookat参数
skybox.proj=60;0.1;100 //天空盒fov,近平面,远平面
grayscale=#A3C4EAFF
@@ -61,6 +60,10 @@ plane.gradientColor=66B5C8E6;00B5C8E6
plane.gradientColor_morning=00f2c3b1;66f2c3b1
plane.gradientColor_daytime=66B5C8E6;00B5C8E6
plane.gradientColor_evening=00f2c3b1;66f2c3b1
fog=C4E1FF;20;65;0.9 //雾颜色,起始距离,结束距离,密度
fog_morning=D6CFDC;20;65;0.9 //雾颜色,起始距离,结束距离,密度
fog_daytime=C4E1FF;20;65;0.9 //雾颜色,起始距离,结束距离,密度
fog_evening=D6CFDC;20;65;0.9 //雾颜色,起始距离,结束距离,密度