Page 10 of 104

Posted: Fri Oct 31, 2008 4:56 pm
by dlangdev
thanks, i'll be working on a shaded version next. Currently looking on a possible topic which will show a little bit of complexity on light reflection and scatter.

Posted: Fri Oct 31, 2008 5:16 pm
by dlangdev
Anyway, the tree model is here, free to anyone who feels like using it. I'll use that to learn leaf shader soon.

https://sourceforge.net/project/showfil ... _id=637269

Posted: Mon Nov 03, 2008 4:17 pm
by dlangdev
Image

Posted: Mon Nov 03, 2008 4:17 pm
by dlangdev
Image

Posted: Mon Nov 03, 2008 4:18 pm
by dlangdev
Image

Posted: Mon Nov 03, 2008 4:57 pm
by Steel Style
Really cool dlangdev. Why not add decals to make this sound more realistic ?

Posted: Mon Nov 03, 2008 5:28 pm
by dlangdev
Yep, frame, wall and floor are there. Though I need to add static objects that have physics in them later. Plus more RenderMonkey shader code will be added in there as well. Looking forward to the fabric shader and the garage with a shiny car in there, that one will demo environment mapping.

Image

Code: Select all

video::ITexture* colorMapRock = driver->getTexture("../../media/rockwall.bmp");
		video::ITexture* normalMapRock = driver->getTexture("../../media/rockwall_height.bmp");
		video::ITexture* colorMapBrick = driver->getTexture("../../media/brick01.dds"); 
		video::ITexture* normalMapBrick = driver->getTexture("../../media/brick01Bump.bmp");

	
		video::ITexture* colorMap = driver->getTexture("../../media/floor_wood_3light.dds"); 
		video::ITexture* colorMap2 = driver->getTexture("../../media/floor_wood_3.dds"); 
		video::ITexture* normalMap = driver->getTexture("../../media/floor_wood_3Bump.bmp");

		driver->makeNormalMapTexture(normalMap, 9.0f);
		driver->makeNormalMapTexture(normalMapRock, 9.0f);
		driver->makeNormalMapTexture(normalMapBrick, 9.0f);


		scene::IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(
			roomMesh->getMesh(0));
			room = smgr->addMeshSceneNode(tangentMesh);

		if (true)
		{
			irr::video::SMaterial m1;
			m1 = room->getMaterial(0);
			room->getMaterial(0).setTexture(0, colorMapBrick);
			room->getMaterial(0).setTexture(1, normalMapBrick);
			room->getMaterial(0).MaterialType = video::EMT_PARALLAX_MAP_SOLID;
			room->getMaterial(0).MaterialTypeParam = 0.035f; // adjust height for parallax effect
			room->getMaterial(0).SpecularColor.set(0,0,0,0);

			room->getMaterial(1).setTexture(0, colorMapWood);
			room->getMaterial(1).setTexture(1, normalMapWood);
			room->getMaterial(1).MaterialType = video::EMT_PARALLAX_MAP_SOLID;
			room->getMaterial(1).MaterialTypeParam = 0.035f; // adjust height for parallax effect
			room->getMaterial(1).SpecularColor.set(100,100,100,0);

		}
		else
		{
			room->setMaterialTexture(0, colorMapBrick);
			room->setMaterialTexture(1, normalMapBrick);
			room->setMaterialFlag(video::EMF_FOG_ENABLE, false);
			room->setMaterialType(video::EMT_PARALLAX_MAP_SOLID);
		}

		irr::core::vector3df s1(50,50,50);
		room->setScale(s1);

Image

Here's the model in Blender...

Image

Image

Posted: Tue Nov 04, 2008 4:12 am
by oldskoolPunk
Toon trees

Image

Posted: Tue Nov 04, 2008 6:53 am
by Dorth
HANDS UP! You will surrender the pretty shader without making a move OR ELSE! Come on! Drop it in the bag!

... wow ... me wanna o-O'

Posted: Tue Nov 04, 2008 8:28 am
by JP
that's pretty damned nice oldskoolpunk!

Posted: Tue Nov 04, 2008 9:05 am
by oldskoolPunk
Hey thank you.

Here is the toon shader on the trees. It uses vertex colors for the ambient lighting.

Code: Select all

// toon tree vertex shader

varying vec4 Color;
varying vec3 Normal; 
varying vec3 ViewDirection;
varying vec3 LightDirection;

void main()
{
	gl_Position = ftransform();
	gl_TexCoord[0] = gl_MultiTexCoord0;
	Normal  = gl_NormalMatrix * gl_Normal;
	vec3 Position = gl_ModelViewMatrix * gl_Vertex;
	LightDirection =  gl_NormalMatrix * vec3(0.75,1,-0.75);//directional sunlight
	ViewDirection = -Position;
	Color = gl_Color;
			
}

Code: Select all

// toon tree pixel shader

varying vec3 Normal;
varying vec3 LightDirection; 
varying vec3 ViewDirection;

varying vec4 Color;

void main()
{
	vec3 N = normalize(Normal);
	vec3 L = normalize(LightDirection);
   vec3 E = normalize(ViewDirection);
	vec3 R = reflect(-L, N);
	
	float light_angle = max(dot(R,E),0.0);
	if (light_angle > 0.01) Color *= 1.5;//diffuse
	if (light_angle > 0.9) Color=vec4(1,1,1,1);//specular
	
	float ink_angle = max(dot(N,E),0.0);
	if (ink_angle <0.25) Color=vec4(0,0,0,0);//inking
	
	gl_FragColor = Color;
}
Some unlit grass.

Image

Posted: Tue Nov 04, 2008 12:37 pm
by Eigen
As cute as kittens! I like it. So cheery!
But is it an image compression issue, that the black lines in the distance seem to disappear?

Posted: Tue Nov 04, 2008 12:42 pm
by Dorth
No, it's just that the black ink is based on the angle instead of a given width.

Posted: Tue Nov 04, 2008 12:53 pm
by MasterD
Thats an awesome toonshader. Does it work with anti-alias too?

Posted: Wed Nov 05, 2008 1:33 pm
by Midnight
crap all crap 8)