shader help- lightmaps and dotproduct2

Post anything to do with editing Nexuiz here. Whether its problems you've had, questions, or if you just want to show off your work.

Moderators: Nexuiz Moderators, Moderators

shader help- lightmaps and dotproduct2

Postby torus » Wed Feb 20, 2008 6:22 pm

Alright, a final 2 questions-

With my dotproduct2 shader and textures, the blending seems to work, but on really steep surfaces (near 90 degrees) the textures get really distorted. Also, the dotproduct doesn't seem to follow the original UV map, in that the textures aren't scaled like they would be without DP2. Can this be fixed via my shader?

Also, my map is lit by the skybox, but I have a bunch of flat planes for a tree canopy that covers the map. Underneath them, nothing is lit well- everything is just a flat grey- but the places that aren't covered are lit correctly. I don't understand, because I have the line "surfaceparm alphashadow" in the canopy shader, which should let light through (right?) the canopy has an alpha channel. Any ideas?

Thanks!
Image
torus
Forum addon
 
Posts: 1341
Joined: Sun Dec 24, 2006 6:59 am
Location: USA

Postby tZork » Thu Feb 21, 2008 4:16 am

first q: the "issue" here is not DorProduct2 but rather q3map_tcGen. This generated new mapping coords based on what you feed it. commonly ppl use
Code: Select all
q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )

or similar with this type of shaders to avoid manualy haveing to aligin theit tri/quad soup (radiant sucs at that). Twhi this does is what you described - it projects the texture top-down every X units over the geometry.

If you use a model or will aligen the textures manauly you sould take that line out from yer shader. ex:

Code: Select all
textures/terrain_dotproduct2/leafs01-rock02
{
   qer_editorimage textures/terrain_dotproduct2/leafs01-rock02
   
   q3map_lightmapSampleOffset 8
   q3map_globalTexture
   q3map_nonplanar
   q3map_shadeangle 95

   surfaceparm dust

   // Dont use texture projection.
       // q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
   q3map_alphaMod dotproduct2 ( 0 0 0.95 )

   {
      map textures/terrain_data/rock02.tga   // Primary
   }

   {
      map textures/terrain_data/leafs01.tga   // Secondary
      blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA      
      alphaGen vertex
   }

   {
      map $lightmap
      blendFunc GL_DST_COLOR GL_ZERO
   }
}


Second q: Likely your ground's lightmap dont have enougth lightmap area to represents the fine shadow from a canopy in a good way. Try using a unice shader under those trees with
Code: Select all
q3map_lightmapSampleSize 2

in its general section. Dont use this where you dont need very fine shadows or you will end up with a hugely bloated bsp that takes forever to compile.
HOF:
<Diablo> the nex is a "game modification"
<Diablo> quake1 never had a weapon like that.
<Vordreller> there was no need for anything over 4GB untill Vista came along
<Samua>]Idea: Fix it? :D
<Samua>Lies, that only applies to other people.
tZork
tZite Admin
 
Posts: 1337
Joined: Tue Feb 28, 2006 6:16 pm
Location: Halfway to somwhere else

Postby torus » Fri Feb 22, 2008 12:36 am

Wouldn't that shader need a rgbGen identity after map $lightmap?

Thanks for the help!
Image
torus
Forum addon
 
Posts: 1341
Joined: Sun Dec 24, 2006 6:59 am
Location: USA


Return to Nexuiz - Editing

Who is online

Users browsing this forum: No registered users and 1 guest

cron