car environment reflection

Posted By: painkiller

car environment reflection - 12/12/10 20:30

Does anyone know about a shader for a car surface which uses skycube to reflect?
Posted By: Hummel

Re: car environment reflection - 12/14/10 20:33

Julz wrote such a shader for his own game but there is not pre-defined one.
Posted By: painkiller

Re: car environment reflection - 12/14/10 20:59

Finally I used the cube environment mapping shader from AUM 59, maybe it isn't the best shader for this, but it does the trick laugh




Posted By: 3run

Re: car environment reflection - 12/15/10 17:05

Bro, can you please upload it some where? Or send me it by e-mail laugh Thank you.
Posted By: painkiller

Re: car environment reflection - 12/15/10 18:01

you mean the shader code?
Posted By: 3run

Re: car environment reflection - 12/15/10 20:36

Yes bro, if it is not hard for you to do laugh
Posted By: painkiller

Re: car environment reflection - 12/15/10 21:13

It isn't neccesary to upload it, I can copy it here:

Code:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include this script in your project. Make sure to use the same name for your sky cube bitmap and for the bmp_envcube 
// definition from below. Place any model in your level and attach it the action named "cubic_map". That's all.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

BMAP* bmp_envcube = "t_sunrise_sky+6.tga";

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function mtl_envmirror_view()
{
	mat_set(mtl.matrix, matViewInv);
	mtl.matrix41 = 0;
	mtl.matrix42 = 0;
	mtl.matrix43 = 0;
	mat_scale(mtl.matrix, 1, -1, 1);
}

function mtl_envmirror_init()
{
	bmap_to_cubemap(mtl.skin1);
	mtl.event = mtl_envmirror_view;
	/*mtl.flags=*/set(mtl,ENABLE_VIEW);
}

MATERIAL* mtl_envmirror = // environment cube
{
	skin1 = bmp_envcube;
	event = mtl_envmirror_init;
	effect = "
	texture mtlSkin1;
	texture entSkin1;
	matrix matMtl;
	technique envcube
	{
		pass p0
		{
			AddressU[0] = Clamp; // don't wrap around edges
			AddressV[0] = Clamp;
			TexCoordIndex[0] = CameraSpaceReflectionVector;
			TextureTransformFlags[0] = Count3;
			TextureTransform[0] = <matMtl>; // transform camera space back to world space
			Texture[0] = <mtlSkin1>;
			ColorArg1[0] = Texture;
			ColorArg2[0] = Diffuse;
			ColorOp[0] = Modulate2x;
			Texture[1] = <entSkin1>;
			TextureFactor = 0xC0FFFFFF;
			ColorArg1[1] = Texture;
			ColorArg2[1] = Current;
			ColorOp[1] = BlendFactorAlpha; // blend by 75% (= oxC0)
		}
	}
	//technique fallback { pass p0 { } } // empty fallback causes normal rendering without effect
	";
}

action cubic_map()
{
	my.material = mtl_envmirror;
}


Posted By: 3run

Re: car environment reflection - 12/16/10 14:30

Thank you a lot laugh
Posted By: Tobias

Re: car environment reflection - 12/18/10 08:15

Why use that old shader? The integrated shader looks better.
Posted By: MMike

Re: car environment reflection - 02/25/11 18:42

real time reflections would be better.. is this possible already?
Posted By: Hummel

Re: car environment reflection - 02/27/11 01:13

You had to render in the cubemap in realtime. Using a low res cubemap, rendering the models in a simplified version (if high poly) und updating the cubemap not every frame but every second or third would make it quite fast.
Posted By: MMike

Re: car environment reflection - 05/06/11 22:53

yes but.. i see those games like need for speed and so on,tthat seams to update the cube everyframe, well i see no lag.. and they seam very good resolution.
© 2024 lite-C Forums