Terrain blending problems

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Terrain blending problems

Post by Bliccer »

I've already posted that problem in my other thread, but it seems like nobody goes there.
First the pic: terrain
Now the question: How can I solve that shadow problem + that different light using thing (between that normal brush on the left side (where the shadow is) and the ones with the terrainblending texture)?
I'm using this shader for the blending.

Code: Select all

textures/suriel/dirt2grass
{
   	qer_editorimage textures/suriel/ter_dirtgrass.jpg
   	q3map_nonplanar
   	q3map_shadeAngle 120
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.75 )

   	{
      map textures/suriel/grass_01_alpha.tga	// Primary texture
      rgbGen identity
   	}
  	{
      map textures/suriel/dirt_grass.tga	// Secondary
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
      alphaFunc GE128
      rgbGen identity
      alphaGen vertex
  	}

	{
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
      rgbGen identity
   }
}
I guess it is also necessary to know that I am using a normal texture on the "normal" brush. Just that rocky one.

Thanks for help =)
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Terrain blending problems

Post by obsidian »

Do you also have an editor screenshot of the same area, also perhaps a screenshot in game with r_showtris 1? Another one with r_lightmap 1? It's still hard to tell exactly what's going on.

First off, it looks like there is a mismatch between the two textures and how they are tiling. You may want to select both surfaces and make sure they are axial as well on the same texture scale (your iVector settings in the shader makes the texture tile once every 256x256 units along the z-axis).

I also recommend you create a shader for your base texture with the following:

q3map_nonplanar
q3map_shadeAngle 120
q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
[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]
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Re: Terrain blending problems

Post by Bliccer »

For the ivector I thought I have to use half of the image resolution it actually has...
Screens in a sec
sock
Posts: 424
Joined: Sat Sep 09, 2000 7:00 am

Re: Terrain blending problems

Post by sock »

Bliccer wrote:How can I solve that shadow problem + that different light using thing (between that normal brush on the left side (where the shadow is) and the ones with the terrainblending texture)?
Do what obs said, you cannot easily match a 'normal' texture projection and an ivector projection unless you use special editor textures. It is possible, but honestly it is not worth the trouble across large floor areas. Convert the texture on the left of the image to ivector (using the obs shader) and it will texture match. Also func_group all the floor brushes together to make sure the lighting is consistent.

Code: Select all

alphaFunc GE128
You are aware that the above statement in your grass blend shader makes hard edges? If you want a soft alpha blend then remove it so the dotproduct can use the full alpha range.

I did write a tutorial on all of the above and talked about alpha blending terrain to normal brushwork on page 6. Please take the time to read it, all of the source files are available to go with the tutorial so it should be easy to follow.
Well he was evil, but he did build alot of roads. - Gogglor
My [url=http://www.simonoc.com/]Website[/url] & [url=http://twitter.com/SimsOCallaghan]Twitter[/url]
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Re: Terrain blending problems

Post by Bliccer »

So I have written a shader for my base texture now like obsidian suggested:

Code: Select all

textures/suriel/dirt_grass_ivector
{
	qer_editorimage textures/suriel/dirt_grass.tga
	q3map_nonplanar
	q3map_shadeAngle 120
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	{
		map textures/suriel/dirt_grass.tga
		rgbGen identity
	}
}
Without lightcompile the terrain looks good:
00_ingamewolight

But when it comes to light it looks like this:
06_ingamelightmap3

So here are the tris and the lightmap screenshots:
03_ingametris
04_ingamelightmap

Now the shadow somehow splits up into 3 parts:
05_ingamelightmap2

Editorshot: 01_editor

This is the shader for the green grasstexture:

Code: Select all

textures/suriel/grasswplants
{
        qer_editorimage textures/suriel/grass_01.tga
	q3map_nonplanar
	q3map_shadeangle 120
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.75 )
	q3map_surfacemodel models/mapobjects/suriel/nggrass.ase 100 0.15 0.6 1.2 0 360 1
	{
		map textures/suriel/grass_01.tga
		rgbGen identity
	}
}

And this is the modified one for the blending texture:

Code: Select all

textures/suriel/dirt2grass
{
   	qer_editorimage textures/suriel/ter_dirtgrass.jpg
   	q3map_nonplanar
   	q3map_shadeAngle 120
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.75 )

   	{
      map textures/suriel/grass_01_alpha.tga	// Primary texture
      rgbGen identity
   	}
  	{
      map textures/suriel/dirt_grass.tga	// Secondary
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA      
      rgbGen identity
      alphaGen vertex
  	}

	{
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
      rgbGen identity
   }
}
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Terrain blending problems

Post by obsidian »

Your grass shader needs a lightmap stage.

Make sure all terrain textures have a lightmap stage.

Make sure all terrain textures have the same light affecting q3map_ directives as I wrote above.

That includes the dirt, grass and dirt-to-grass blend shaders.
[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]
jal_
Posts: 223
Joined: Mon Mar 24, 2008 4:13 pm

Re: Terrain blending problems

Post by jal_ »

I don't know if someone said it already, but the terrain in that screenshot is in desperate need of q3map_lightmapaxis z (in all shaders)
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Re: Terrain blending problems

Post by Bliccer »

Light works nicely now. Only the shadow and all explosions are getting split up. It seems like the terrain blending texture doesn't cast any shadow or prohibit the explosions being displayed.

screen

I've also already goruped the whole terrain, but no effect.
TTI
Posts: 13
Joined: Thu Oct 11, 2007 1:30 pm

Re: Terrain blending problems

Post by TTI »

Bliccer: There's nothing you can do about it. I'd personally use surfaceparm nomarks for the terrain shaders.
Bliccer
Posts: 341
Joined: Thu Nov 26, 2009 4:27 pm

Re: Terrain blending problems

Post by Bliccer »

Hm... but looks totally idiotic. :/
Post Reply