0 registered members (),
1,089
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
skies and matWorld
#421362
04/16/13 07:15
04/16/13 07:15
|
Joined: Jul 2001
Posts: 6,904
HeelX
OP
Senior Expert
|
OP
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
Hi, when setting a pan != 0, my skycubes won't change. I wrote then a simple shader to sample from the sky as cubemap:
effect_load(mtl_sky, "skyCube.fx");
g_entSky = ...
bmap_to_cubemap(bmap_for_entity(g_entSky, 0));
Out.Pos = mul(In.Pos, matWorldViewProj);
Out.Tex = (mul(float4(In.Pos.xyz, 1), (float4x4)matWorld)).xyz - vecViewPos.xyz;
...
return float4(texCUBE(skin, normalize(In.Tex)).rgb, 1);
The skycube is rendered as desired, but when changing the pan of my sky entity, it doesn't rotate, so it seems to me that matWorld isn't properly set. Is this intended or a bug?, I dont know
|
|
|
Re: skies and matWorld
[Re: jcl]
#421396
04/16/13 14:45
04/16/13 14:45
|
Joined: Jul 2001
Posts: 6,904
HeelX
OP
Senior Expert
|
OP
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
Hm, there must be a world matrix because if it were an identity-matrix,
float3 vec = (mul(float4(In.Pos.xyz, 1), (float4x4)matWorld)).xyz - vecViewPos.xyz;
would be reduced to
float3 vec = In.Pos.xyz - vecViewPos.xyz;
but this doesn't work for me. On the other hand, I face other problems: when I replace matWorldViewProj in my calculation of Out.Pos with
mul(matWorld, matViewProj)
The sky gets clipped: This doesn't happen, when I concatenate matWorldView with matProj like this:
mul(matWorldView, matProj)
|
|
|
|