2 registered members (AndrewAMD, Quad),
755
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: AnimTree shader and PSSM shadows
[Re: HeelX]
#436347
01/23/14 21:36
01/23/14 21:36
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
OP
Expert
|
OP
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
You would have to write a special vp_pssm.fx and vp_depth.fx shader just for the trees. In detail, you need to bring the vertex transformation of the AnimTree.fx shader into the vertex shaders of the pssm fx files. You have to do this because the tree has to waive in the depth view, too, to cast the waived silhouette to the ground. And to reiceive it, of course The tricky thing is to bring this kind of "pssm shaded tree waiving" logic as addition into <shadows.c>. There, the shaders are applied as view materials to each and every entity as far as I can see. You would have to write something like an interceptor - a view event - that switches the shaders dependent if it is a tree or not. Thank you. But that's the things I already know. You gave an explenation why the shadow doesn't move with the trees. But I looking for an explenation how to bring the vertex transformation from the tree shader into the pssm shader.
|
|
|
Re: AnimTree shader and PSSM shadows
[Re: oliver2s]
#436353
01/23/14 22:39
01/23/14 22:39
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
Whats the problem with that? You could just take the animtree vertex shader together with the depthmap pixelshader as well as with the pssm pixelshader. You may need to add some needed calculations to the vertex shader and could remove some that aren´t. I don´t have the files here right now but from a google search and the animtree shader I found, I´d say you have to take the following parts of the tree shader:
float3 P = DoPos(inPos); //this might already be there, so just reuse it if it is
float force_x = DoDefault(vecSkill41.x*(0.1/50),0.1);
float force_y = DoDefault(vecSkill41.y*(0.1/50),0.1);
float offs = vecTime.w+0.2*(P.x+P.y+P.z);
float speed = sin(offs * DoDefault(vecSkill41.z*(0.05/50),0.05));
if(inPos.y > 0 ) // move only upper part of tree
{
inPos.x += speed * force_x * inPos.y;
inPos.z += speed * force_y * inPos.y;
inPos.y -= 0.1*abs(speed*(force_x+force_y)) * inPos.y;
}
Out.Pos = DoTransform(inPos); //this should already be in the other shaders, just make sure to put the code above in front of it
|
|
|
Re: AnimTree shader and PSSM shadows
[Re: oliver2s]
#436492
01/27/14 23:38
01/27/14 23:38
|
Joined: Jun 2004
Posts: 655 to your left
BoH_Havoc
User
|
User
Joined: Jun 2004
Posts: 655
to your left
|
Not sure if you are using Shade-C for this, but if you do, then have a look at 05_livingBloomShadow.fx in the examples/fx folder. Its a shadowmap-replacement shader for an object which has vertex movement in it's main shader. Just kick out the wiggle vertex movement stuff and add the tree wind animation instead Then use sc_skill(entity, SC_OBJECT_MATERIAL_SHADOWMAP, yourCustomVertexAnimationMaterial); to set a shadowmap-replacement shader for this object. [edit] Eh, just saw you already found a fix, sorry
Last edited by BoH_Havoc; 01/27/14 23:39.
|
|
|
|