Shader problem...


(BoltyBoy) #1

If someone knows the answer to this or if it is even possible I would be very grateful…

I’m trying to create a winding track. For this I am using a patch mesh that sits at the same level as the ground. As such the shader used on the mesh acts like a decal to avoid z-fighting. The image for the track has an alpha channel to create transparency at the edges to make the edge of the track less linear looking. Now the problem Iam having is that I can not get the lightmap and blending of layers in the shader to work correctly. Here is the shader I am using:

textures/ww_canyon/canyon_track

{
	qer_editorimage textures/ww_canyon/canyon_track.tga
	polygonOffset
	entityMergable
	surfaceparm alphashadow
	{
		map textures/ww_canyon/canyon_track.tga
		rgbGen identity
		blendFunc blend
	}
	{
		map $lightmap
		blendfunc filter
		rgbgen identity
	}
}

Here is a pic of what this produces - so you can see that the edges of the track produce an orange glow and bad shadow where the edges fall in to shade.

[/img]


(ydnar) #2

You can’t have a blended stage with a multiplicative stage following it.

Make the shader vertexlit by adding surfaceparm pointlight, removing the lightmap stage, and changing the texture stage to rgbGen vertex.

y


(BoltyBoy) #3

As such…

textures/ww_canyon/canyon_track

{
	qer_editorimage textures/ww_canyon/canyon_track.tga
	polygonOffset
	entityMergable
	surfaceparm alphashadow
	surfaceparm pointlight
	{
		map textures/ww_canyon/canyon_track.tga
		blendfunc blend
		rgbGen vertex
	}
}

If this is correct would these results be expected…

If so is there’s not a lot I can do about it?

Cheers


(ydnar) #4

You could also do alphaFunc GE128 & depthWrite on first pass, then depthFunc equal on the lightmap pass…

y


(BoltyBoy) #5

I’d say that’s pretty damn near to the desired effect - many thanks. Pic of results in-situ below…note the ASE terrain made possible by some awesome dude :slight_smile: Ahh on that note, I’ve been informed one potential way to smooth the shadows on the terrain is to use phong shading (other than making more complex models)…do you concur? Oh yes, and I trust you’re enjoying England - if they ever let you out that is - warm beer, fish and chips and rain - bring it on!!


(ydnar) #6

Make sure to put q3map_nonplanar & q3map_shadeangle on the rock shaders you’re using on the brushwork.

Nice shot. :slight_smile: