|
|
Re: PRV over a shadowed terrain
[Re: jcl]
#449172
03/06/15 14:27
03/06/15 14:27
|
Joined: Jun 2007
Posts: 1,337 Hiporope and its pain
txesmi
OP
Serious User
|
OP
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
I can see a terrain casting shadows on blocks  Look at this: I did some test and checked the terrain lightmap color by myself.
var my_floor_ambient ()
{
if ( !me )
return 0;
// set ( my, LIGHT | UNLIT );
vec_set ( &my->blue, COLOR_WHITE );
VECTOR vPos;
vec_set ( &vPos, &my->x );
vPos.z -= 300 - my->min_z;
you = NULL;
var height = c_trace ( &my->x, &vPos, IGNORE_ME | IGNORE_MODELS | IGNORE_SPRITES | SCAN_TEXTURE );
if ( HIT_TARGET )
{
if ( you ) // if you exits, is a terrain for sure
{
if ( you->lightmap )
{
BMAP *bmpSkin1 = ent_getskin ( you, 1 );
var scale = bmap_width(you->lightmap) / bmap_width(bmpSkin1); //
var format = bmap_lock ( you->lightmap, 0 );
var cX = hit.u1 * scale;
var cY = hit.v1 * scale;
var pixel = pixel_for_bmap ( you->lightmap, cX, cY );
COLOR col;
pixel_to_vec ( &col, NULL, format, pixel );
vec_set ( &my->blue, &col );
// vec_set ( &col, COLOR_WHITE );
// pixel = pixel_for_vec ( &col, 100, format );
// pixel_to_bmap ( you->lightmap, cX, cY, pixel );
bmap_unlock ( you->lightmap );
set ( my, LIGHT | UNLIT );
}
}
else // hit a block
{
reset ( my, LIGHT | UNLIT );
// vec_set ( &my->blue, &hit.blue );
}
}
return height;
}
and I use vecLight as ambient color into the shader
float4 color = float4(vecEmissive.xyz * vecColor.xyz, 0) + vecAmbient * vecLight;
|
|
|
|