Operating System: :OpenSuse Leap 15.2:
Render System: :GLSL3Plus:
Hello, I try to implement the dynamic shadows into OpenDungeons game. however I get a tons of artifacts and incorrect shadows:
Here's example material file I do use
Code: Select all
// Claimed
// import RTSS/NormalMapping_MultiPass from "RTShaderSystem.material"
vertex_program myClaimedTileVertexShader glsl
{
source ClaimedTile.vert
default_params
{
param_named_auto projectionMatrix projection_matrix
param_named_auto viewMatrix view_matrix
param_named_auto worldMatrix world_matrix
param_named_auto lightMatrix texture_worldviewproj_matrix 0
}
}
fragment_program myClaimedTileFragmentShader glsl
{
source ClaimedTile.frag
default_params
{
param_named_auto ambientLightColour ambient_light_colour 0
param_named_auto lightDiffuseColour light_diffuse_colour 0.0
param_named_auto lightSpecularColour light_specular_colour 0.0
param_named_auto lightPos light_position 0.0 0.0 0.0 0.0
param_named_auto cameraPosition camera_position 0.0
param_named_auto diffuseSurface surface_diffuse_colour 0.0
param_named seatColor float4 1.0 1.0 1.0 1.0
}
}
material Claimed //: RTSS/NormalMapping_MultiPass
{
technique
{
pass
{
diffuse 1.0 1.0 1.0 1.0
vertex_program_ref myClaimedTileVertexShader
{
}
fragment_program_ref myClaimedTileFragmentShader
{
param_named decalmap int 0
param_named normalmap int 1
param_named crossmap int 2
param_named shadowmap int 3
}
// We use blending, so that we can see the underlying texture.
texture_unit decalmap
{
texture Claimed.png
}
texture_unit normalmap
{
texture ClaimedNormal.png
}
texture_unit crossmap
{
texture ClaimedMask.png
}
texture_unit shadowmap
{
content_type shadow
tex_address_mode clamp
filtering bilinear
}
}
}
}
vertex:
Code: Select all
layout (location = 0) in vec4 aPos;
...
VertexPos = lightMatrix * aPos;
Code: Select all
vec4 shadow = vec4(1.0, 1.0, 1.0,1.0);
vec4 tmpVertexPos = VertexPos;
/* compute shadowmap */
if(tmpVertexPos.z > 0 ){
tmpVertexPos /= tmpVertexPos.w;
shadow = texture(shadowmap, tmpVertexPos.xy);
}
In RenderManager.cpp I put :
Code: Select all
mSceneManager->setShadowTechnique(Ogre::ShadowTechnique::SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);
What interest me the most is why the creatures cast rarely correct shadows and only in some particular position to light and camera ? ....