Problems with phong shading

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Problems with phong shading

Post by dONKEY »

I am experiencing a problem with phong shading on my terrain.
I was doodling some cave sections in GTK for a CTF level. My cave has a base rock texture and two separate alpha blended section, one on the floor, one on the ceiling. All in all I have 3 separate shaders, one for the rock-to-floor blend, one for the rock-to-ceiling blend and one phong shaded rock.
My problem is that the phong shaded rock isn't being smoothed:
Image
All the dark area is the non-blended shader.
I've spent anytime aligning textures yet, this was just a first test. However I got stuck when I ran into this problem. I guess I could simply use the two blending shaders, but being a bit anal I wanted to solve the problem not go around it.
Just in case it's my scripts here they are...the blending script first and then the phong only script:

Code: Select all

textures/fi/rock_to_rock2
{
		qer_editorimage textures/fi/2.tga
		q3map_nonplanar 
		q3map_shadeAngle 179

	{
		map textures/fi/rock.tga
		rgbGen identity
	}
	{
		map textures/fi/rock_2.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		rgbGen identity
		alphaGen oneMinusVertex
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
		rgbGen identity
	}
}

textures/fi/rock_phong
{
		qer_editorimage textures/fi/3.tga
		q3map_nonplanar 
		q3map_shadeAngle 179

	{
		map textures/fi/rock.tga
		rgbGen identity
	}

	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
		rgbGen identity
	}
}

The screenshot was taken after a light -fast compile

Thanks
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Problems with phong shading

Post by dONKEY »

hmm, could just be the angle of my brush edges and the light source...dunno, smoothing on models in idtech4 is far easier :)
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Problems with phong shading

Post by obsidian »

If everything is just one big smoothing group, I think Q3Map2 may have problems UV'ing the lightmap pages onto a complex shape like that. My hunch is that Q3Map2 is trying to take a flat lightmap texture and wrap it around something complex like an inverted sphere.

You may have to break it up into a couple of chunks (func_grouping and playing with the entity keys them might help). Depending on how big the room is, larger sized external lightmaps might help too.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Kat
Posts: 952
Joined: Tue Nov 14, 2000 8:00 am

Re: Problems with phong shading

Post by Kat »

Strip it back to a standard shader with phong to test whether it *is* the brushwork or not, that way you at least know where the problem is (which relates to what obsidian said). Also, phong-fu doesn't like really sharp corners (greater that 90 degrees) so check that isn't an issue.
[url=https://www.katsbits.com/tutorials#q3w]Tutorials, tools and resources[/url]
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Problems with phong shading

Post by dONKEY »

Belated thanks to both. I *think* it was more the brush angle issue. I have two versions of a test map, one made from brushes, the other a model. The smoother angles on the mesh work much better.
Post Reply