nonsolid Degenerate Patches


(Godmil) #1

I recently tried making terrain from degenerate patches (simplet patch meshes which have the verts joined up to make a triangle). I love how easy it is to work with the patch triangles ( vertex manipulating to my hearts content - with no gtkR crashing :slight_smile: )

However I noticed a wee problem after I’d finished making my terrain.
Some of the triangles had become nonsolid. They all have a basic shader on them (just so I can specify the texture scale), and the majority of them are fine. Further every triangle started from the one patch which I just copied and pasted to fill the area.

I’m guessing that my vertex stretching may have twisted or contorted a few of the patches in ways they dont like… which is fine… I can just go through the terrain shooting every triangle to find the ones that are nonsolid and then replace them…

but since I have >500 triangles its going to be a slow process.

I dont suppose anyone knows of a simpler fix? :slight_smile:


(pazur) #2

maybe -patchmeta could solve your problem… it makes brushes from patches as far as i know

patchmeta
Creates meta surfaces from patches. Pre-tessellates patches in the bsp. Merges a set lod into a surface (subdivision of 8 ). Planars are reduced nicely, and degenerate strips on patches have the bad triangles removed.


(Godmil) #3

nice suggestiong :slight_smile: but I’m afraid I already tried and it didn’t work.

I think I may try converting it into a model then playing around with the autoclip :confused:
does anyone know if the autoclipped models cause BSP splits?


(ydnar) #4

I’d convert the resulting BSP to an ASE model and use that in your real map. Using 1-tri patch meshes or even -patchmeta will result in a very inefficient BSP.

BTW, do you mind posting your terrain shader?

y


(Godmil) #5

ok, thanks ydnar, I’ll do that. :slight_smile:

here is the shader if its of any use.

textures/godmil_dm1/xxx_terrain
{
qer_editorimage textures/godmil_dm1/xxxx.tga
q3map_forceMeta
q3map_nonplanar
q3map_shadeAngle 10
q3map_lightmapAxis z
q3map_tcGen ivector ( 128 0 0 ) ( 0 128 0 )
{
rgbGen identity
map $lightmap
}
{
map textures/godmil_dm1/xxxx.tga
blendFunc GL_DST_COLOR GL_SRC_ALPHA
rgbGen identity
alphaGen lightingSpecular
}
}


(ydnar) #6

I modified your shader a bit, it had some confusing and nonfunctional parts (like the alphaGen lightingSpecular nonsense, which won’t work on world surfaces):


textures/godmil_dm1/xxx_terrain
{
	qer_editorimage textures/godmil_dm1/xxxx.tga
	
	q3map_forceMeta
	q3map_nonplanar
	q3map_shadeAngle 160
	q3map_lightmapAxis z
	q3map_tcGen ivector ( 128 0 0 ) ( 0 128 0 )
	
	{
		map $lightmap
	}
	{
		map textures/godmil_dm1/xxxx.tga
	}     
}

Note, the texture projected every 128 units is a bit small. You might want to crank it up to 256 or 512 to make the tiling less obvious.


(Godmil) #7

thanks for suggesting the changes, I still have a lot to learn concerning shaders so tips on the little touches are always appreciated :slight_smile:

eh, I’m afraid I’m going to stick with the lightingspecular and the very low shadeangle, it creates a very specific (read: unusual) effect which I’m after. I’ll show you a pic of what I’m trying to do once I get it fully built :slight_smile:


(ratty redemption) #8

please do post some pics of the effects of using alphagen lightingspecular on terrain, I thought that was mainly used on models? …and shouldn`t it be used in conjunction with rgbgen lightingdiffuse in a previous stage?

Im just curious, as Ive only simulated specular highlighting in map shaders before, although I have used it in model shaders.