Yes I see what std shadow shader use position and texcoords.
actually I use almost the same: position, texcoord(only for randomization in GS, real texcoord generated in GS for PS shader), and VertexColor
anyway I guess I find the solution.
I find that the shadow pass are rendered through Graphics::Draw(…) but I was thinking what it use only Batch::Draw(…). (with my GS hack code)
So that’s why it was not be visible.
Fixed Graphics::Draw()
[spoiler][code]
void BatchGroup::Draw(View* view, Camera* camera, bool allowDepthWrite) const
{
Graphics* graphics = view->GetGraphics();
Renderer* renderer = view->GetRenderer();
if (instances_.Size() && !geometry_->IsEmpty())
{
// Draw as individual objects if instancing not supported or could not fill the instancing buffer
VertexBuffer* instanceBuffer = renderer->GetInstancingBuffer();
if (!instanceBuffer || geometryType_ != GEOM_INSTANCED || startIndex_ == M_MAX_UNSIGNED)
{
Batch::Prepare(view, camera, false, allowDepthWrite);
graphics->SetIndexBuffer(geometry_->GetIndexBuffer());
graphics->SetVertexBuffers(geometry_->GetVertexBuffers());
for (unsigned i = 0; i < instances_.Size(); ++i)
{
if (graphics->NeedParameterUpdate(SP_OBJECT, instances_[i].worldTransform_))
{
graphics->SetShaderParameter(VSP_MODEL, *instances_[i].worldTransform_);
graphics->SetShaderParameter(GSP_MODEL, *instances_[i].worldTransform_);
}
PrimitiveType gsPrimitiveType = graphics->GetEffectivePrimitiveTypeOverGSInput(geometry_->GetPrimitiveType());
graphics->Draw(gsPrimitiveType, geometry_->GetIndexStart(), geometry_->GetIndexCount(),
geometry_->GetVertexStart(), geometry_->GetVertexCount());
}
}
else
{
Batch::Prepare(view, camera, false, allowDepthWrite);
// Get the geometry vertex buffers, then add the instancing stream buffer
// Hack: use a const_cast to avoid dynamic allocation of new temp vectors
Vector<SharedPtr<VertexBuffer> >& vertexBuffers = const_cast<Vector<SharedPtr<VertexBuffer> >&>(
geometry_->GetVertexBuffers());
vertexBuffers.Push(SharedPtr<VertexBuffer>(instanceBuffer));
graphics->SetIndexBuffer(geometry_->GetIndexBuffer());
graphics->SetVertexBuffers(vertexBuffers, startIndex_);
PrimitiveType gsPrimitiveType = graphics->GetEffectivePrimitiveTypeOverGSInput(geometry_->GetPrimitiveType());
graphics->DrawInstanced(gsPrimitiveType, geometry_->GetIndexStart(), geometry_->GetIndexCount(),
geometry_->GetVertexStart(), geometry_->GetVertexCount(), instances_.Size());
// Remove the instancing buffer & element mask now
vertexBuffers.Pop();
}
}
}
[/code][/spoiler]
But now I have other problem unlit box with texture and shadows are gone )