texture blending - help?

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

Tue Dec 09, 2008 3:41 pm

  • After I released Woden's Pit, I was advised to try texture blending to make the nature parts of my maps look a little more realistic. Arboria was given as en example of how to do this. Here's the shader used in Arboria for texture blending:

    Code: Select all
    textures/arboria/rockmod
    {
       qer_editorimage textures/arboria/rockmod.tga
       q3map_lightmapSampleOffset 8
       q3map_globalTexture
       q3map_nonplanar
       q3map_shadeangle 110
       q3map_alphaMod dotproduct2 ( 0 0 0.95 )
       q3map_tcmod scale 1.7 1.7
       q3map_tcMod rotate 30

       {
          map textures/arboria/rockwall.tga   // Primary
       }

       {
          map textures/arboria/mossfloor.tga   // Secondary
          blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA     
          alphaGen vertex
       }

       {
          map $lightmap
          blendFunc GL_DST_COLOR GL_ZERO
       }
    }


    I did a cut and paste into my shader, renamed the textures, and ended up with this:


    Code: Select all
    textures/rockyhills/dirtmod
    {
       qer_editorimage textures/rockyhills/dirtmod.tga
       q3map_lightmapSampleOffset 8
       q3map_globalTexture
       q3map_nonplanar
       q3map_shadeangle 110
       q3map_alphaMod dotproduct2 ( 0 0 0.45 )
       q3map_tcmod scale 1.7 1.7
       q3map_tcMod rotate 30

       {
          map textures/rockyhills/dirtground.tga   // Primary
       }

       {
          map textures/rockyhills/leafground.tga   // Secondary
          blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA     
          alphaGen vertex
       }

       {
          map $lightmap
          blendFunc GL_DST_COLOR GL_ZERO
       }
    }


    I applied the dirtmod.tga texture to the meshes (and a test-brush). But what I get after compilation is just the leafground.tga texture. Is there something wrong with my shader? Or is the problem in the textures?
    2 GHz Mac Pro
    Mac OS X 10.6.2
    nvidia GeForce 8800 GT
    Clueless Newbie
    Keyboard killer
     
    Posts: 518
    Joined: Wed Jan 03, 2007 1:01 pm

Tue Dec 09, 2008 7:59 pm

  • OpenGL 2 shaders have to be enabled -- are they?
    Image
    User avatar
    torus
    Forum addon
     
    Posts: 1341
    Joined: Sun Dec 24, 2006 6:59 am
    Location: USA

Tue Dec 09, 2008 8:55 pm

  • On Macs OpenGL 2 shaders are disabled due to unreliable drivers.
    User avatar
    SavageX
    Site Admin
     
    Posts: 442
    Joined: Wed Mar 01, 2006 9:34 am

Tue Dec 09, 2008 9:29 pm

  • Um, they are? I thought that wasn't the case since... 2.3? OpenGL 2 works just fine on my Mac.
    Image
    User avatar
    torus
    Forum addon
     
    Posts: 1341
    Joined: Sun Dec 24, 2006 6:59 am
    Location: USA

Wed Dec 10, 2008 9:34 am

  • torus wrote:OpenGL 2 shaders have to be enabled -- are they?

    According to my Nexuiz settings, yes. And the blending in arboria works.
    2 GHz Mac Pro
    Mac OS X 10.6.2
    nvidia GeForce 8800 GT
    Clueless Newbie
    Keyboard killer
     
    Posts: 518
    Joined: Wed Jan 03, 2007 1:01 pm

Wed Dec 10, 2008 2:05 pm

  • Code: Select all
    textures/rockyhills/dirtmod
    {
       qer_editorimage textures/rockyhills/dirtmod.tga
       q3map_lightmapSampleOffset 8
       q3map_globalTexture
       q3map_nonplanar
       q3map_shadeangle 110
       q3map_alphaMod dotproduct2 ( 0 0 0.45 )

    You could try a sharper falloff here, I usually go with ~ 0 0 0.95.
    Code: Select all
       q3map_tcmod scale 1.7 1.7
       q3map_tcMod rotate 30

       {
          map textures/rockyhills/dirtground.tga   // Primary
       }

       {
          map textures/rockyhills/leafground.tga   // Secondary
          blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA     
          alphaGen vertex
       }

       {
          map $lightmap
          blendFunc GL_DST_COLOR GL_ZERO
       }
    }


    The rest looks fine, did you add the .shader's file name to shaderlist.txt? You can also use alpfa fade brushes to see if blending is working at all.
    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.
    User avatar
    tZork
    tZite Admin
     
    Posts: 1337
    Joined: Tue Feb 28, 2006 6:16 pm
    Location: Halfway to somwhere else

Wed Dec 10, 2008 4:05 pm

  • dotproduct2 ( 0 0 0.45 )


    Indeed, that is wrong. This vector should really always be a unit vector (like 0 0 1), or you may get very unusual results (namely, one of the textures never being completely used).

    In your case, one of the textures gets at most 20% used, as you are using dotProduct2 which squares the result.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Fri Dec 12, 2008 9:52 am

  • tZork wrote:You could try a sharper falloff here, I usually go with ~ 0 0 0.95.

    I started with 0.95, but tried other values when it didn't work. 0.45 was the value I happened to have when I copied and pasted into the OP.

    The rest looks fine, did you add the .shader's file name to shaderlist.txt?

    Yep.

    You can also use alpfa fade brushes to see if blending is working at all.

    How do I do that?
    2 GHz Mac Pro
    Mac OS X 10.6.2
    nvidia GeForce 8800 GT
    Clueless Newbie
    Keyboard killer
     
    Posts: 518
    Joined: Wed Jan 03, 2007 1:01 pm

Fri Dec 12, 2008 9:53 am

  • divVerent wrote:
    dotproduct2 ( 0 0 0.45 )
    Indeed, that is wrong. This vector should really always be a unit vector (like 0 0 1), or you may get very unusual results (namely, one of the textures never being completely used).

    I tried 0 0 1 after reading your post. Made no difference.

    Could the problem be that I'm using MacRadiant?
    2 GHz Mac Pro
    Mac OS X 10.6.2
    nvidia GeForce 8800 GT
    Clueless Newbie
    Keyboard killer
     
    Posts: 518
    Joined: Wed Jan 03, 2007 1:01 pm

Fri Dec 12, 2008 11:53 am

  • Clueless Newbie wrote:
    divVerent wrote:
    dotproduct2 ( 0 0 0.45 )
    Indeed, that is wrong. This vector should really always be a unit vector (like 0 0 1), or you may get very unusual results (namely, one of the textures never being completely used).

    I tried 0 0 1 after reading your post. Made no difference.

    Could the problem be that I'm using MacRadiant?


    Maybe. Are you using the q3map2 that came with it? in that case its possible its hopelessly outdated.

    Have a look here: http://www.simonoc.com/pages/articles/terrain1_1.htm for more info in terrain blends and alpha fade brushwork.
    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.
    User avatar
    tZork
    tZite Admin
     
    Posts: 1337
    Joined: Tue Feb 28, 2006 6:16 pm
    Location: Halfway to somwhere else

Sun Dec 14, 2008 8:32 am

  • tZork wrote:
    Clueless Newbie wrote:Could the problem be that I'm using MacRadiant?


    Maybe. Are you using the q3map2 that came with it? in that case its possible its hopelessly outdated.


    Yep. Looked at the compiler log yesterday. Found "unknown shader" or something to that effect. I guess I'll pass on the blending for now.
    2 GHz Mac Pro
    Mac OS X 10.6.2
    nvidia GeForce 8800 GT
    Clueless Newbie
    Keyboard killer
     
    Posts: 518
    Joined: Wed Jan 03, 2007 1:01 pm



Return to Nexuiz - Editing




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest