PRV over a shadowed terrain

Posted By: txesmi

PRV over a shadowed terrain - 03/05/15 16:12

Hi,
I realized the prv entity values are lost when putting a terrain as ground. It seems they are taking their values from the shadowmap of the block below the terrain that is full shadowed by the terrain itself.

Posted By: jcl

Re: PRV over a shadowed terrain - 03/06/15 09:38

A block is not shadowed by a terrain.

I rather think that the entities use the terrain's own shadow map.
Posted By: txesmi

Re: PRV over a shadowed terrain - 03/06/15 14:27

I can see a terrain casting shadows on blocks crazy Look at this:

Click to reveal..



I did some test and checked the terrain lightmap color by myself.

Click to reveal..

Code:
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
Code:
float4 color = float4(vecEmissive.xyz * vecColor.xyz, 0) + vecAmbient * vecLight;

Posted By: jcl

Re: PRV over a shadowed terrain - 03/10/15 14:10

Ccan you check your "Terrain lighting" setting in the map compiler? It determines if the terrain is included in the lighting process or not.
Posted By: txesmi

Re: PRV over a shadowed terrain - 03/11/15 08:29

Hi,
Yes. The terrain lighting is activated. I changed nothing in the compiler settings. There are no dynamic lights in the scene. Just a single static light with high resolution flags set. The terrain and blocks lighmaps are created by the compiler.
Posted By: jcl

Re: PRV over a shadowed terrain - 03/11/15 09:52

Ok, can you then contact support and send them the project? We'll have to look into that.
Posted By: txesmi

Re: PRV over a shadowed terrain - 03/11/15 14:13

sent
Posted By: jcl

Re: PRV over a shadowed terrain - 03/16/15 15:51

Thanks, we got it and will look into it.
© 2024 lite-C Forums