Realtime shader with shoing texture od a car

Posted By: Progger

Realtime shader with shoing texture od a car - 11/15/11 20:14

Hi Community does someone have a realtime +texture visible shader like in most race games i really need this.
Thanks for reading this post!
WFG Progger laugh
Posted By: Roel

Re: Realtime shader with shoing texture od a car - 11/15/11 21:11

I might be wrong, but an effect that might help is the
Cubic_Enviroment_Shading_Shader
it uses a cubemap for reflections, which can be a sky cube.
these reflections, however aren't realtime(which gives rendering speed in return).
Posted By: lostclimate

Re: Realtime shader with shoing texture od a car - 11/15/11 22:08

Yeah, if you use what he just showed you, and every few frames render surrounding views to the cube map. wink
Posted By: Timothy

Re: Realtime shader with shoing texture od a car - 11/15/11 22:17

I made this, maybe you have to change some things:

http://www.opserver.de/ubb7/ubbthreads.p...true#Post375716
Posted By: Progger

Re: Realtime shader with shoing texture od a car - 11/15/11 22:40

@roel and lostclimate
ill take a look
@Timothy i saw this by searching but dont know how to also show the texture.i want a textured car with real time.Like in F1 2011
there is a texture and it is also reflecting
I also tried to make the view transparent timothy but i failed^^
Can you help me with that ?
Thanks for reading again laugh
And i really need your help.
ANd also thanks for answering me laugh
WFG PRogger laugh
Posted By: Progger

Re: Realtime shader with shoing texture od a car - 11/16/11 07:49

i cant get it work frown is there some tutorial for it i tried to use it but the car gets white no reflection at all.Do i need a normal map or something to get it work?
MFG Progger laugh
Posted By: Timothy

Re: Realtime shader with shoing texture od a car - 11/16/11 13:45

Well the main part of the code is that you get a realtime rendered cubemap. So you have to use a shader that uses both, the texture of the car and the cubemap.

The code works like this:
There is a camera always at the same position as the reflecting object (in this case the car). The camera changes its direction all the time to combine the different angles and renders them on a cubemap.

My code only generates this dynamic cubemap. In the example I used a simple shader from Slins collection. It uses just one cubemap which is rendered on the model.
So in your case you have to use a different shader (Environment Mapping) which also supports texture blending and that uses a cubemap (generated by the code).

I hope you understand crazy

Edit: I think I saw such a shader in one of the AUMs.


Posted By: Progger

Re: Realtime shader with shoing texture od a car - 11/16/11 14:26

@Timothy thank you very much i completly forgot to look in the aums.I remember that shader with the cola thing with the enviroment shader on it.So ill look in the aums laugh
Thanks for helping laugh
WFG Progger laugh
Posted By: Progger

Re: Realtime shader with shoing texture od a car - 11/16/11 17:09

Im totally cofused it would be very nice if someone could explain me how it works
I converted it to lite-c no error at all
but when i use it only the texture of the car gets brighter nothing more frown
I really need you help!!!!!!
THanks for helping laugh
PS:WOuld be nice if someone could upload a working code in lite-c
with an example cube or something

Here is the shader iam using:
Code:
BMAP* bmp_envcube = "skycube1+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;
	set(my,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
	";
}



WFG Progger
Posted By: Progger

Re: Realtime shader with shoing texture od a car - 11/16/11 18:45

Sorry for tripple post here is a screenshot

with Shader:


without Shader:


WFG Progger laugh
© 2024 lite-C Forums