Re: Screenshots for Irrlicht
Posted: Thu May 05, 2016 9:27 pm
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Code: Select all
// - F O G -
// Fragment Snippet for inspiration..
varying vec2 UVCoordsXY; // Vanilla..
varying vec2 UVCoordsXYLIGHTMAP; // Possible with "*.irrmesh" from Blender with Tubras's IRRB..
// I ignored the scene and just loaded the "*.irrmesh" and gav it this material ID..
varying vec3 VNormal;
varying vec3 VertexGLPosition;
varying vec3 VertexGLColour; // Could be used as another method of Image Mixing i.e. Splatting..
// But then your 3D format must support Vertex Colours like "*.stl" (Stanford Polys)
// -------- ---- -- - other code
uniform vec3 CameraPos; // The Position of the camera i.e. the EYE..
// *** F O G ***
float FragCamDist;
float DBFogFact; // The key..
vec3 FragCamDeltas; // Used in Camera to Vertex Distance which matters in Fog..
// = M A I N = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
void main()
{float FOG_MAX_DIST = 150.0;
vec3 FOG_COLOUR = vec3(0.529, 0.627, 0.608);
FragCamDeltas = VertexGLPosition - CameraPos;
// *** other code ***
// Must do a GPU bitshift!!??
FragCamDist = sqrt ((FragCamDeltas.x * FragCamDeltas.x) + (FragCamDeltas.y * FragCamDeltas.y) + (FragCamDeltas.z * FragCamDeltas.z));
if (FragCamDist <= FOG_MAX_DIST)
{DBFogFact = (1.0 / FOG_MAX_DIST ) * FragCamDist;
}
// It's either Linear Fog with a Further Distance or Squared Fog with a closer distance..
// DBFogFact *= DBFogFact; // Bring about a Squared Curve or keep it linear..
if (FragCamDist >= FOG_MAX_DIST) {DBFogFact = 1.0;} // Otherwise fragments sudenly appear beyond the Fog Radius..
// *** other code ***
// Where MappedMixImageOnLightmapUV.x and y is Mixing Determinant, best painted on vertii and baked on Bitmap Image..
vec3 PreFogOutput = ((MappedMixImageOnLightmapUV.x * MappedDiffuseOnDiffuseUV.xyz)
+ (MappedMixImageOnLightmapUV.y * MappedSpecular.xyz))
* MappedLightMap.xyz;
PreFogOutput *= 1.25; // Just an Amp..
gl_FragColor.xyz = lerp(PreFogOutput , FOG_COLOUR, DBFogFact);
gl_FragColor.w = MappedDiffuse.w; // Our "Clip" mapping (not transparency)
// "The_Glitch".. This is GLSL but maybe you can convert to HLSL!
}// -- END --
Code: Select all
<buffer>
<material bmat="001_WORLD:001_D_WORLD_GRASS_A.tga:Untitled.001">
<enum name="Type" value="lightmap"/>
<color name="Ambient" value="ffffffff"/>
<color name="Diffuse" value="ffcccccc"/>
<color name="Emissive" value="ff000000"/>
<color name="Specular" value="ffffffff"/>
<float name="Shininess" value="0"/>
<float name="Param1" value="0"/>
<float name="Param2" value="0"/>
<bool name="Wireframe" value="false"/>
<bool name="GouraudShading" value="true"/>
<bool name="Lighting" value="true"/>
<bool name="ZWriteEnable" value="true"/>
<int name="ZBuffer" value="1"/>
<bool name="BackfaceCulling" value="true"/>
<bool name="FrontfaceCulling" value="false"/>
<bool name="FogEnable" value="false"/>
<bool name="NormalizeNormals" value="false"/>
<bool name="UseMipMaps" value="true"/>
<int name="AntiAliasing" value="1"/>
<int name="ColorMask" value="15"/>
<int name="PolygonOffsetFactor" value="0"/>
<enum name="PolygonOffsetDirection" value="Front"/>
<texture name="Texture1" value="DATA/0158_OAK_FOREST/001_D_WORLD_GRASS_A.tga"/>
<enum name="TextureWrapU1" value="texture_clamp_repeat"/>
<enum name="TextureWrapV1" value="texture_clamp_repeat"/>
<bool name="BilinearFilter1" value="true"/>
<bool name="TrilinearFilter1" value="false"/>
<int name="AnisotropicFilter1" value="0"/>
<int name="LODBias1" value="0"/>
<texture name="Texture2" value="DATA/0158_OAK_FOREST/001_A_WORLD_A.tga"/>
<enum name="TextureWrapU2" value="texture_clamp_repeat"/>
<enum name="TextureWrapV2" value="texture_clamp_repeat"/>
<bool name="BilinearFilter2" value="true"/>
<bool name="TrilinearFilter2" value="false"/>
<int name="AnisotropicFilter2" value="0"/>
<int name="LODBias2" value="0"/>
<texture name="Texture3" value="DATA/0158_OAK_FOREST/001_D_WORLD_ROCKS_A.tga"/>
<enum name="TextureWrapU3" value="texture_clamp_repeat"/>
<enum name="TextureWrapV3" value="texture_clamp_repeat"/>
<bool name="BilinearFilter3" value="true"/>
<bool name="TrilinearFilter3" value="false"/>
<int name="AnisotropicFilter3" value="0"/>
<int name="LODBias3" value="0"/>
<texture name="Texture4" value="DATA/0158_OAK_FOREST/001_M_WORLD_A.tga"/>
<enum name="TextureWrapU4" value="texture_clamp_repeat"/>
<enum name="TextureWrapV4" value="texture_clamp_repeat"/>
<bool name="BilinearFilter4" value="true"/>
<bool name="TrilinearFilter4" value="false"/>
<int name="AnisotropicFilter4" value="0"/>
<int name="LODBias4" value="0"/>
</material>
<vertices type="2tcoords" vertexCount="387">
16.314362 7.8625 -2.083676 0.110965 0.993103 etc etc etc ......
I like it! Looks good. Would look interesting with rain, which, I'm under the impression can be done cheaply with the existing built-in particle system. Anyways... What's the project for?Vectrotek wrote: