Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 755 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
AnimTree shader and PSSM shadows #436334
01/23/14 17:30
01/23/14 17:30
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
In 3DGS shader folder there's a AnimTree.fx shader which makes vegetation move in the wind. As this is done in the vertex shader it doesn't effect PSSM shadows. This means the trees move but the shadow doesn't.

Is there any way to combine both shaders (I don't need code. Just looking for an explenation how it's done)?

Re: AnimTree shader and PSSM shadows [Re: oliver2s] #436340
01/23/14 18:56
01/23/14 18:56
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
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 wink

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.

Re: AnimTree shader and PSSM shadows [Re: HeelX] #436346
01/23/14 20:50
01/23/14 20:50
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
I like your ideas HeelX. And, I hope Oliver2s will make it work, somehow.

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 Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Originally Posted By: HeelX
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 wink

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 Offline
Expert
Slin  Offline
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:
Code:
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: Slin] #436367
01/24/14 08:47
01/24/14 08:47
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
in current MapBuilder it is already solved. I use a modified depth and shadow shader, probably the depth is the key elelmtent, I don't rememebr exactly. but I use no self shadows on trees in case of pssm.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: AnimTree shader and PSSM shadows [Re: sivan] #436370
01/24/14 11:19
01/24/14 11:19
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Didn't you say you don't use PSSM in Map Builder?

Re: AnimTree shader and PSSM shadows [Re: oliver2s] #436374
01/24/14 13:54
01/24/14 13:54
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I personally don't use but made it optional. in startup settings menu you can select shadow_stencil value: -1 means shade-c shadowmapping, 8 means PSSM, and 0,1 are also available for decal and stencil shadows.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: AnimTree shader and PSSM shadows [Re: sivan] #436388
01/24/14 16:23
01/24/14 16:23
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Thank you all. It's now working laugh

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 Offline
User
BoH_Havoc  Offline
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 laugh
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 crazy

Last edited by BoH_Havoc; 01/27/14 23:39.

Shade-C EVO Lite-C Shader Framework

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1